Added: new boot.S, serial out for Xeon Phi
[barrelfish] / hake / symbolic_targets.mk
1 ##########################################################################
2 # Copyright (c) 2009-2013 ETH Zurich.
3 # All rights reserved.
4 #
5 # This file is distributed under the terms in the attached LICENSE file.
6 # If you do not find this file, copies can be found by writing to:
7 # ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
8 # Attn: Systems Group.
9 #
10 # This file defines symbolic (i.e. non-file) targets for the Makefile
11 # generated by Hake.  Edit this to add your own symbolic targets.
12 #
13 ##########################################################################
14
15 # Disable built-in implicit rules. GNU make adds environment's MAKEFLAGS too.
16 MAKEFLAGS=r
17
18 # Explicitly disable the flex and bison implicit rules
19 %.c : %.y
20
21 %.c : %.l
22
23 # Set default architecture to the first specified by Hake in generated Makefile.
24 ARCH ?= $(word 1, $(HAKE_ARCHS))
25 ARM_GCC?=arm-none-linux-gnueabi-gcc
26 ARM_OBJCOPY?=arm-none-linux-gnueabi-objcopy
27 # settings for the Intel Xeon Phi
28 K1OM_GCC?=x86_64-k1om-barrelfish-gcc
29 K1OM_OBJCPY?=x86_64-k1om-barrelfish-objcopy
30
31 # All binaries of the RCCE LU benchmark
32 BIN_RCCE_LU= \
33         sbin/rcce_lu_A1 \
34         sbin/rcce_lu_A2 \
35         sbin/rcce_lu_A4 \
36         sbin/rcce_lu_A8 \
37         sbin/rcce_lu_A16 \
38         sbin/rcce_lu_A32 \
39         sbin/rcce_lu_A64
40
41 # All binaries of the RCCE BT benchmark
42 BIN_RCCE_BT= \
43         sbin/rcce_bt_A1 \
44         sbin/rcce_bt_A4 \
45         sbin/rcce_bt_A9  \
46         sbin/rcce_bt_A16 \
47         sbin/rcce_bt_A25 \
48         sbin/rcce_bt_A36
49
50 # Default list of modules to build/install for all enabled architectures
51 MODULES_COMMON= \
52         sbin/init_null \
53         sbin/init \
54         sbin/chips \
55         sbin/spawnd \
56         sbin/startd \
57         sbin/flounder_stubs_empty_bench \
58         sbin/flounder_stubs_buffer_bench \
59         sbin/flounder_stubs_payload_bench \
60         sbin/hellotest \
61         sbin/mem_serv \
62         sbin/idctest \
63         sbin/memtest \
64         sbin/fread_test \
65         sbin/fscanf_test \
66         sbin/monitor \
67         sbin/ramfsd \
68         sbin/channel_cost_bench \
69         sbin/schedtest \
70         sbin/testerror \
71         sbin/yield_test \
72         sbin/xcorecap \
73         sbin/xcorecapserv \
74         sbin/xcorecapbench \
75
76 # List of modules that are arch-independent and always built
77 MODULES_GENERIC= \
78         skb_ramfs.cpio.gz \
79         sshd_ramfs.cpio.gz \
80
81 # x86_64-specific modules to build by default
82 # this should shrink as targets are ported and move into the generic list above
83 MODULES_x86_64= \
84         sbin/cpu \
85         sbin/skb \
86         sbin/mdbtest_range_query \
87         sbin/mdbtest_addr_zero \
88         sbin/mdb_bench \
89         sbin/mdb_bench_old \
90         sbin/ahci_bench \
91         sbin/ata_rw28_test \
92         sbin/apicdrift_bench \
93         sbin/bench \
94         sbin/bfscope \
95         sbin/bomp_benchmark_cg \
96         sbin/bomp_benchmark_ft \
97         sbin/bomp_benchmark_is \
98         sbin/bomp_sync \
99         sbin/bomp_cpu_bound \
100         sbin/bomp_cpu_bound_progress \
101         sbin/bomp_sync_progress \
102         sbin/bomp_test \
103         sbin/boot_perfmon \
104         sbin/bulkbench \
105         sbin/datagatherer \
106         sbin/ahcid \
107         sbin/e1000n \
108         sbin/NGD_mng \
109         sbin/e10k \
110         sbin/sfxge \
111         sbin/e10k_queue \
112         sbin/rtl8029 \
113         sbin/netd \
114         sbin/echoserver \
115         sbin/elver \
116         sbin/fbdemo \
117         sbin/fish \
118         sbin/fputest \
119         sbin/hpet \
120         sbin/lpc_kbd \
121         sbin/lpc_timer \
122         sbin/lrpc_bench \
123         sbin/mem_affinity \
124         sbin/mem_serv_dist \
125         sbin/net-test \
126         sbin/netthroughput \
127         sbin/elb_app \
128         sbin/elb_app_tcp \
129         sbin/lo_queue \
130         sbin/pci \
131         sbin/acpi \
132         sbin/kaluga \
133         sbin/placement_bench \
134         sbin/phases_bench \
135         sbin/phases_scale_bench \
136         sbin/phoenix_kmeans \
137         $(BIN_RCCE_BT) \
138         $(BIN_RCCE_LU) \
139         sbin/rcce_pingpong \
140         sbin/serial \
141         sbin/shared_mem_clock_bench \
142         sbin/sif \
143         sbin/slideshow \
144         sbin/spantest \
145         sbin/testconcurrent \
146         sbin/thc_v_flounder_empty \
147         sbin/thcidctest \
148         sbin/thcminitest \
149         sbin/thctest \
150         sbin/tsc_bench \
151         sbin/tweedtest \
152         sbin/udp_throughput \
153         sbin/ump_latency \
154         sbin/ump_exchange \
155         sbin/ump_latency_cache \
156         sbin/ump_throughput \
157         sbin/ump_send \
158         sbin/ump_receive \
159         sbin/vbe \
160         sbin/vmkitmon \
161         sbin/webserver \
162         sbin/tlstest \
163         sbin/timer_test \
164         sbin/net_openport_test \
165         sbin/perfmontest \
166         sbin/routing_setup \
167         sbin/multihoptest \
168         sbin/multihop_latency_bench \
169         sbin/cryptotest \
170         $(BIN_CONSENSUS) \
171         sbin/bcached \
172         sbin/testdesc \
173         sbin/testdesc-child \
174         sbin/angler \
175         sbin/sshd \
176         sbin/lshw \
177 #       sbin/block_server \
178 #       sbin/block_server_client \
179 #       sbin/bs_user \
180 #       sbin/bulk_shm \
181 #       sbin/bulk_transfer_passthrough \
182 #       sbin/bulkbench_micro_echo \
183 #       sbin/bulkbench_micro_throughput \
184 #       sbin/bulkbench_micro_rtt \
185
186
187 # the following are broken in the newidc system
188 MODULES_x86_64_broken= \
189         sbin/barriers \
190         sbin/driver_msd \
191         sbin/ehci \
192         sbin/ipi_bench \
193         sbin/ring_barriers \
194         sbin/usb_manager \
195         sbin/ssf_bcast \
196         sbin/lamport_bcast \
197
198 # x86-32-specific module to build by default
199 MODULES_x86_32=\
200         sbin/cpu \
201         sbin/skb \
202         sbin/lpc_kbd \
203         sbin/serial \
204         $(BIN_RCCE_BT) \
205         $(BIN_RCCE_LU) \
206         sbin/rcce_pingpong \
207         sbin/bench \
208         sbin/fbdemo \
209         sbin/fish \
210         sbin/fputest \
211         sbin/pci \
212         sbin/acpi \
213         sbin/kaluga \
214         sbin/slideshow \
215         sbin/thc_v_flounder_empty \
216         sbin/thcidctest \
217         sbin/thcminitest \
218         sbin/thctest \
219         sbin/vbe \
220         sbin/mem_serv_dist \
221         sbin/routing_setup \
222         sbin/multihoptest \
223         sbin/multihop_latency_bench \
224         sbin/angler \
225         sbin/sshd \
226
227 # SCC-specific module to build by default
228 MODULES_scc=\
229         sbin/cpu \
230         $(BIN_RCCE_BT) \
231         $(BIN_RCCE_LU) \
232         sbin/rcce_pingpong \
233         sbin/bench \
234         sbin/eMAC \
235         sbin/netd \
236         sbin/NGD_mng \
237         sbin/webserver \
238         sbin/ipirc_test \
239         sbin/thc_v_flounder_empty \
240         sbin/thcidctest \
241         sbin/thcminitest \
242         sbin/thctest \
243         sbin/mem_serv_dist \
244         sbin/net-test \
245         sbin/netthroughput \
246         sbin/udp_throughput \
247
248 # ARM-specific modules to build by default
249 MODULES_armv5=\
250         sbin/cpu \
251         sbin/cpu.bin
252
253 # XScale-specific modules to build by default
254 MODULES_xscale=\
255         sbin/cpu_ixp2800 \
256         sbin/cpu_ixp2800.bin
257
258 # ARMv7-specific modules to build by default
259 # XXX: figure out armv7 default
260 MODULES_armv7=\
261         sbin/cpu_omap44xx \
262         sbin/usb_manager \
263         sbin/usb_keyboard \
264         sbin/kaluga \
265         sbin/fish \
266         sbin/examples/xmpl-spawn
267
268 # ARM11MP-specific modules to build by default
269 MODULES_arm11mp=\
270         sbin/cpu \
271         sbin/cpu.bin
272         
273 # Intel Xeon Phi-specific modules
274 MODULES_k1om =\
275         sbin/cpu 
276
277 # construct list of all modules to be built (arch-specific and common for each arch)
278 MODULES=$(foreach a,$(HAKE_ARCHS),$(foreach m,$(MODULES_$(a)),$(a)/$(m)) \
279                                   $(foreach m,$(MODULES_COMMON),$(a)/$(m))) \
280         $(MODULES_GENERIC)
281
282 all: $(MODULES) menu.lst
283         @echo "You've just run the default ("all") target for Barrelfish"
284         @echo "using Hake.  The following modules have been built:"
285         @echo $(MODULES)
286         @echo "If you want to change this target, edit the file called"
287         @echo "'symbolic_targets.mk' in your build directory."
288 .PHONY: all
289
290 # XXX: this should be overridden in some local settings file?
291 INSTALL_PREFIX ?= /home/netos/tftpboot/$(USER)
292
293 # Only install a binary if it doesn't exist in INSTALL_PREFIX or the modification timestamp differs
294 install: $(MODULES)
295         for m in ${MODULES}; do \
296           if [ ! -f ${INSTALL_PREFIX}/$$m ] || \
297               [ $$(stat -c%Y $$m) -ne $$(stat -c%Y ${INSTALL_PREFIX}/$$m) ]; then \
298             echo Installing $$m; \
299             mkdir -p ${INSTALL_PREFIX}/$$(dirname $$m); \
300             install -p $$m ${INSTALL_PREFIX}/$$m; \
301           fi; \
302         done;
303 .PHONY : install
304
305 sim: simulate
306 .PHONY : sim
307
308 QEMU=unknown-arch-error
309 GDB=unknown-arch-error
310 CLEAN_HD=
311
312 DISK=hd.img
313 AHCI=-device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -drive id=disk,file=$(DISK),if=none
314
315 ifeq ($(ARCH),x86_64)
316         QEMU_CMD=qemu-system-x86_64 -no-kvm -smp 2 -m 1024 -net nic,model=ne2k_pci -net user $(AHCI) -fda $(SRCDIR)/tools/grub-qemu.img -tftp $(PWD) -nographic
317         GDB=x86_64-pc-linux-gdb
318         CLEAN_HD=qemu-img create $(DISK) 10M
319 else ifeq ($(ARCH),x86_32)
320         QEMU_CMD=qemu-system-i386 -no-kvm -smp 2 -m 1024 -net nic,model=ne2k_pci -net user -fda $(SRCDIR)/tools/grub-qemu.img -tftp $(PWD) -nographic
321         GDB=gdb
322 else ifeq ($(ARCH),scc)
323         QEMU_CMD=qemu-system-i386 -no-kvm -smp 2 -m 1024 -cpu pentium -net nic,model=ne2k_pci -net user -fda $(SRCDIR)/tools/grub-qemu.img -tftp $(PWD) -nographic
324         GDB=gdb
325 else ifeq ($(ARCH),armv5)
326         ARM_QEMU_CMD=qemu-system-arm -no-kvm -kernel armv5/sbin/cpu.bin -nographic -no-reboot -m 256 -initrd armv5/romfs.cpio
327         GDB=xterm -e arm-linux-gnueabi-gdb
328 simulate: $(MODULES) armv5/romfs.cpio
329         $(ARM_QEMU_CMD)
330 .PHONY: simulate
331
332 armv5/tools/debug.arm.gdb: $(SRCDIR)/tools/debug.arm.gdb
333         cp $< $@
334
335 debugsim: $(MODULES) armv5/romfs.cpio armv5/tools/debug.arm.gdb
336         $(SRCDIR)/tools/debug.sh "$(ARM_QEMU_CMD) -initrd armv5/romfs.cpio" "$(GDB)" "-s $(ARCH)/sbin/cpu -x armv5/tools/debug.arm.gdb $(GDB_ARGS)"
337 .PHONY : debugsim
338 else ifeq ($(ARCH),arm11mp)
339         QEMU_CMD=qemu-system-arm -no-kvm -cpu mpcore -M realview -kernel arm11mp/sbin/cpu.bin
340         GDB=arm-linux-gnueabi-gdb
341 else ifeq ($(ARCH), k1om)
342         # what is the emulation option for the xeon phi ?  
343         QEMU=unknown-arch-error
344         GDB=x86_64-k1om-barrelfish-gdb
345 endif
346
347
348 ifdef QEMU_CMD
349
350 simulate: $(MODULES)
351         $(CLEAN_HD)
352         $(QEMU_CMD)
353 .PHONY : simulate
354
355 debugsim: $(MODULES)
356         $(CLEAN_HD)
357         $(SRCDIR)/tools/debug.sh "$(QEMU_CMD)" "$(GDB)" "-x $(SRCDIR)/tools/debug.gdb $(GDB_ARGS)" "file:/dev/stdout"
358 .PHONY : debugsim
359
360 endif
361
362
363
364 $(ARCH)/menu.lst: $(SRCDIR)/hake/menu.lst.$(ARCH)
365         cp $< $@
366
367 $(ARCH)/romfs.cpio: $(SRCDIR)/tools/arm-mkbootcpio.sh $(MODULES) $(ARCH)/menu.lst
368         $(SRCDIR)/tools/arm-mkbootcpio.sh $(ARCH)/menu.lst $@
369
370 # Location of hardcoded size of romfs CPIO image
371 arm_romfs_cpio = "$(ARCH)/include/romfs_size.h"
372
373 # XXX: Horrid hack to hardcode size of romfs CPIO image into ARM kernel
374 # This works in several recursive make steps:
375 # 1. Create a dummy romfs_size.h header file
376 # 2. Compile everything
377 # 3. Create the romfs CPIO image
378 # 4. Determine its size and write to romfs_size.h
379 # 5. Re-compile kernel (but not the romfs) with correct size information
380 # 6. Install romfs to installation location
381 arm:
382         $(MAKE)
383         $(MAKE) $(ARCH)/romfs.cpio
384         echo "//Autogenerated size of romfs.cpio because the bootloader cannot calculate it" > $(arm_romfs_cpio)
385         echo "size_t romfs_cpio_archive_size = `ls -asl $(ARCH)/romfs.cpio | sed -e 's/ /\n/g' | head -6 | tail -1`;" >> $(arm_romfs_cpio)
386         $(MAKE)
387 .PHONY: arm
388
389 # Builds a dummy romfs_size.h
390 $(ARCH)/include/romfs_size.h:
391         mkdir -p $(shell dirname $@)
392         echo "size_t romfs_cpio_archive_size = 0; //should not see this" > $@
393
394 arminstall:
395         $(MAKE) arm
396         $(MAKE) install
397         install -p $(ARCH)/romfs.cpio ${INSTALL_PREFIX}/$(ARCH)/romfs.cpio
398 .PHONY: arminstall
399
400 # Copy the scc-specific menu.lst from the source directory to the build directory
401 menu.lst.scc: $(SRCDIR)/hake/menu.lst.scc
402         cp $< $@
403
404 scc: all tools/bin/dite menu.lst.scc
405         $(shell find scc/sbin -type f -print0 | xargs -0 strip -d)
406         tools/bin/dite -32 -o bigimage.dat menu.lst.scc
407         cp $(SRCDIR)/tools/scc/bootvector.dat .
408         bin2obj -m $(SRCDIR)/tools/scc/bigimage.map -o barrelfish0.obj
409         bin2obj -m $(SRCDIR)/tools/scc/bootvector.map -o barrelfish1.obj
410         @echo Taking the barrelfish.obj files to SCC host
411         scp barrelfish[01].obj user@tomme1.in.barrelfish.org:
412
413 # Source indexing targets
414 cscope.files:
415         find $(abspath .) $(abspath $(SRCDIR)) -name '*.[ch]' -type f -print | sort | uniq > $@
416 .PHONY: cscope.files
417
418 cscope.out: cscope.files
419         cscope -k -b -i$<
420
421 TAGS: cscope.files
422         etags - < $< # for emacs
423         cat $< | xargs ctags -o TAGS_VI # for vim
424
425 # force rebuild of the Makefile
426 rehake: ./hake/hake
427         ./hake/hake --source-dir $(SRCDIR)
428 .PHONY: rehake
429
430 clean::
431         $(RM) -r tools $(HAKE_ARCHS)
432 .PHONY: clean
433
434 realclean:: clean
435         $(RM) hake/*.o hake/*.hi hake/hake Hakefiles.hs cscope.*
436 .PHONY: realclean
437
438 # Documentation
439 DOCS= \
440         ./docs/TN-000-Overview.pdf \
441         ./docs/TN-001-Glossary.pdf \
442         ./docs/TN-002-Mackerel.pdf \
443         ./docs/TN-003-Hake.pdf \
444         ./docs/TN-004-VirtualMemory.pdf \
445         ./docs/TN-005-SCC.pdf \
446         ./docs/TN-006-Routing.pdf \
447         ./docs/TN-008-Tracing.pdf \
448         ./docs/TN-009-Notifications.pdf \
449         ./docs/TN-010-Spec.pdf \
450         ./docs/TN-011-IDC.pdf \
451         ./docs/TN-012-Services.pdf \
452         ./docs/TN-013-CapabilityManagement.pdf \
453         ./docs/TN-014-bulk-transfer.pdf \
454         ./docs/TN-015-DiskDriverArchitecture.pdf \
455         ./docs/TN-016-Serial.pdf \
456         ./docs/TN-017-ARM.pdf \
457         ./docs/TN-018-PracticalGuide.pdf \
458         ./docs/TN-019-DeviceDriver.pdf
459
460 docs doc: $(DOCS)
461 .PHONY: docs doc
462
463 clean::
464         $(RM) $(DOCS)
465 .PHONY: clean
466
467 doxygen: Doxyfile
468         doxygen $<
469 .PHONY: doxygen
470
471 # pretend to be CMake's CONFIGURE_FILE command
472 # TODO: clean this up
473 Doxyfile: $(SRCDIR)/doc/Doxyfile.cmake
474         sed -r 's#@CMAKE_SOURCE_DIR@#$(SRCDIR)#g' $< > $@
475
476 # Scheduler simulator test cases
477 RUNTIME = 1000
478 TESTS = $(addsuffix .txt,$(basename $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)))
479
480 schedsim-regen: $(TESTS)
481
482 $(TESTS): %.txt: %.cfg tools/bin/simulator
483         tools/bin/simulator $< $(RUNTIME) > $@
484
485 schedsim-check: $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)
486         for f in $^; do tools/bin/simulator $$f $(RUNTIME) | diff -q - `dirname $$f`/`basename $$f .cfg`.txt || exit 1; done
487
488
489 ######################################################################
490 #
491 # Intel Xeon Phi Builds
492 #
493 ######################################################################
494
495 # Intel Xeon Phi-specific modules
496 XEON_PHI_MODULES =\
497         k1om/sbin/cpu 
498
499 menu.lst.k1om: $(SRCDIR)/hake/menu.lst.k1om
500         cp $< $@
501
502 k1om: $(XEON_PHI_MODULES) 
503         @echo "OK. Co Processor OS Built."
504         scp "k1om/sbin/cpu" emmentaler.ethz.ch:
505         ssh emmentaler.ethz.ch "scp cpu babybel.in.barrelfish.org:/root/cpu"
506
507
508 #######################################################################
509 #
510 # Pandaboard builds
511 #
512 #######################################################################
513
514 PANDABOARD_MODULES=\
515         armv7/sbin/cpu_omap44xx \
516         armv7/sbin/init \
517         armv7/sbin/mem_serv \
518         armv7/sbin/monitor \
519         armv7/sbin/ramfsd \
520         armv7/sbin/spawnd \
521         armv7/sbin/startd \
522         armv7/sbin/skb \
523         armv7/sbin/memtest \
524         armv7/sbin/kaluga \
525         armv7/sbin/fish \
526         armv7/sbin/usb_manager \
527         armv7/sbin/usb_keyboard \
528
529 menu.lst.pandaboard: $(SRCDIR)/hake/menu.lst.pandaboard
530         cp $< $@
531
532 pandaboard_image: $(PANDABOARD_MODULES) \
533                 tools/bin/arm_molly \
534                 menu.lst.pandaboard
535         # Translate each of the binary files we need
536         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.pandaboard molly_panda
537         # Generate appropriate linker script
538         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
539                 molly_panda/molly_ld_script
540         # Build a C file to link into a single image for the 2nd-stage
541         # bootloader
542         tools/bin/arm_molly menu.lst.pandaboard panda_mbi.c
543         # Compile the complete boot image into a single executable
544         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
545                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
546                 -Tmolly_panda/molly_ld_script \
547                 -I$(SRCDIR)/include \
548                 -I$(SRCDIR)/include/arch/arm \
549                 -I./armv7/include \
550                 -I$(SRCDIR)/include/oldc \
551                 -I$(SRCDIR)/include/c \
552                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
553                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
554                 $(SRCDIR)/tools/arm_molly/molly_init.c \
555                 $(SRCDIR)/tools/arm_molly/lib.c \
556                 ./panda_mbi.c \
557                 $(SRCDIR)/lib/elf/elf32.c \
558                 ./molly_panda/* \
559                 -o pandaboard_image
560         @echo "OK - pandaboard boot image is built."
561         @echo "If your boot environment is correctly set up, you can now:"
562         @echo "$ usbboot ./pandaboard_image"
563
564 ########################################################################
565 #
566 # GEM5 build
567 #
568 ########################################################################
569
570 menu.lst.arm_gem5: $(SRCDIR)/hake/menu.lst.arm_gem5
571         cp $< $@
572
573 menu.lst.arm_gem5_mc: $(SRCDIR)/hake/menu.lst.arm_gem5_mc
574         cp $< $@
575
576 GEM5_MODULES=\
577         armv7/sbin/cpu_arm_gem5 \
578         armv7/sbin/init \
579         armv7/sbin/mem_serv \
580         armv7/sbin/monitor \
581         armv7/sbin/ramfsd \
582         armv7/sbin/spawnd \
583         armv7/sbin/startd \
584         armv7/sbin/skb \
585         armv7/sbin/memtest
586
587
588 arm_gem5_image: $(GEM5_MODULES) \
589                 tools/bin/arm_molly \
590                 menu.lst.arm_gem5_mc
591         # Translate each of the binary files we need
592         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.arm_gem5_mc molly_gem5
593         # Generate appropriate linker script
594         cpp -P -DBASE_ADDR=0x00100000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
595                 molly_gem5/molly_ld_script
596         # Build a C file to link into a single image for the 2nd-stage
597         # bootloader
598         tools/bin/arm_molly menu.lst.arm_gem5_mc arm_mbi.c
599         # Compile the complete boot image into a single executable
600         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
601                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
602                 -Tmolly_gem5/molly_ld_script \
603                 -I$(SRCDIR)/include \
604                 -I$(SRCDIR)/include/arch/arm \
605                 -I./armv7/include \
606                 -I$(SRCDIR)/include/oldc \
607                 -I$(SRCDIR)/include/c \
608                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
609                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
610                 $(SRCDIR)/tools/arm_molly/molly_init.c \
611                 $(SRCDIR)/tools/arm_molly/lib.c \
612                 ./arm_mbi.c \
613                 $(SRCDIR)/lib/elf/elf32.c \
614                 ./molly_gem5/* \
615                 -o arm_gem5_image
616
617 # ARM GEM5 Simulation Targets
618 ARM_FLAGS=$(SRCDIR)/tools/arm_gem5/gem5script.py --caches --l2cache --n=2 --kernel=arm_gem5_image
619
620 arm_gem5: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
621         gem5.fast $(ARM_FLAGS)
622
623 arm_gem5_detailed: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
624         gem5.fast $(ARM_FLAGS) --cpu-type=arm_detailed
625
626 .PHONY: arm_gem5 arm_gem5_detailed
627
628 #######################################################################
629 #
630 # Pandaboard build for the armv7-M slave image (to be used in conjunction with a master image)
631 # (basically a normal pandaboard_image, but compiled for the cortex-m3)
632 #
633 #######################################################################
634
635 HETEROPANDA_SLAVE_MODULES=\
636         armv7-m/sbin/cpu_omap44xx \
637         armv7-m/sbin/init \
638         armv7-m/sbin/mem_serv \
639         armv7-m/sbin/monitor \
640         armv7-m/sbin/ramfsd \
641         armv7-m/sbin/spawnd \
642         armv7-m/sbin/startd \
643         armv7-m/sbin/skb \
644         armv7-m/sbin/memtest
645
646 menu.lst.armv7-m: $(SRCDIR)/hake/menu.lst.armv7-m
647         cp $< $@
648
649 heteropanda_slave: $(HETEROPANDA_SLAVE_MODULES) \
650                 tools/bin/arm_molly \
651                 menu.lst.armv7-m
652         # Translate each of the binary files we need
653         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.armv7-m molly_panda_slave
654         # Generate appropriate linker script
655         cpp -P -DBASE_ADDR=0x0 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
656                 molly_panda_slave/molly_ld_script
657         # Build a C file to link into a single image for the 2nd-stage
658         # bootloader
659         tools/bin/arm_molly menu.lst.armv7-m panda_mbi_slave.c
660         # Compile the complete boot image into a single executable
661         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
662                 -nostdlib -march=armv7-m -mcpu=cortex-m3 -mthumb -mapcs -fno-unwind-tables \
663                 -Tmolly_panda_slave/molly_ld_script \
664                 -I$(SRCDIR)/include \
665                 -I$(SRCDIR)/include/arch/arm \
666                 -I./armv7-m/include \
667                 -I$(SRCDIR)/include/oldc \
668                 -I$(SRCDIR)/include/c \
669                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
670                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
671                 $(SRCDIR)/tools/arm_molly/molly_init.c \
672                 $(SRCDIR)/tools/arm_molly/lib.c \
673                 ./panda_mbi_slave.c \
674                 $(SRCDIR)/lib/elf/elf32.c \
675                 ./molly_panda_slave/* \
676                 -o heteropanda_slave
677         @echo "OK - heteropanda slave image is built."
678         @echo "you can now use this image to link into a regular pandaboard image"
679
680
681
682
683 #######################################################################
684 #
685 # Pandaboard build for the heteropanda_master:
686 # basically a regular pandaboard_image, except that it contains
687 # a heteropanda_slave image, and arm_molly is called with -DHETEROPANDA
688 #
689 #######################################################################
690
691 menu.lst.heteropanda_master: $(SRCDIR)/hake/menu.lst.heteropanda_master
692         cp $< $@
693
694 heteropanda_master_image: $(PANDABOARD_MODULES) \
695                 tools/bin/arm_molly \
696                 menu.lst.heteropanda_master \
697                 heteropanda_slave \
698                 $(SRCDIR)/tools/arm_molly/molly_ld_script.in
699         # Translate each of the binary files we need
700         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.heteropanda_master molly_panda
701         # Generate appropriate linker script
702         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
703                 molly_panda/molly_ld_script
704
705         # HETEROPANDA: convert slave image into a form we can insert in our image
706         $(ARM_OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section \
707             .data=.rodata_thumb,alloc,load,readonly,data,contents heteropanda_slave \
708             molly_panda/heteropanda_slave
709
710         # Build a C file to link into a single image for the 2nd-stage
711         # bootloader
712         tools/bin/arm_molly menu.lst.heteropanda_master panda_mbi.c
713         # Compile the complete boot image into a single executable
714         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
715                 -nostdlib -march=armv7-a -mcpu=cortex-a9 -mapcs -fno-unwind-tables \
716                 -Tmolly_panda/molly_ld_script \
717                 -I$(SRCDIR)/include \
718                 -I$(SRCDIR)/include/arch/arm \
719                 -I./armv7/include \
720                 -I$(SRCDIR)/include/oldc \
721                 -I$(SRCDIR)/include/c \
722                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
723                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
724                 $(SRCDIR)/tools/arm_molly/molly_init.c \
725                 $(SRCDIR)/tools/arm_molly/lib.c \
726                 ./panda_mbi.c \
727                 $(SRCDIR)/lib/elf/elf32.c \
728                 ./molly_panda/* \
729                 -DHETEROPANDA \
730                 -o heteropanda_master_image
731         @echo "OK - heteropanda_master_image is built."
732         @echo "If your boot environment is correctly set up, you can now:"
733         @echo "$ usbboot ./heteropanda_master_image"