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