Merge branch 'arrakis'
[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         sbin/megaraid \
245         lib/libmegaraid.a
246
247 MODULES_k1om= \
248         sbin/weever \
249         sbin/cpu \
250         sbin/xeon_phi \
251         sbin/corectrl 
252
253 # the following are broken in the newidc system
254 MODULES_x86_64_broken= \
255         sbin/barriers \
256         sbin/ipi_bench \
257         sbin/ring_barriers \
258         sbin/ssf_bcast \
259         sbin/lamport_bcast
260
261 # x86-32-specific module to build by default
262 MODULES_x86_32=\
263         sbin/cpu \
264         sbin/lpc_kbd \
265         sbin/serial \
266         $(BIN_RCCE_BT) \
267         $(BIN_RCCE_LU) \
268         sbin/rcce_pingpong \
269         sbin/bench \
270         sbin/fbdemo \
271         sbin/fish \
272         sbin/fputest \
273         sbin/pci \
274         sbin/acpi \
275         sbin/kaluga \
276         sbin/slideshow \
277         sbin/thc_v_flounder_empty \
278         sbin/thcidctest \
279         sbin/thcminitest \
280         sbin/thctest \
281         sbin/vbe \
282         sbin/mem_serv_dist \
283         sbin/routing_setup \
284         sbin/multihoptest \
285         sbin/multihop_latency_bench \
286         sbin/angler \
287         sbin/sshd \
288         sbin/corectrl
289
290 # SCC-specific module to build by default
291 MODULES_scc=\
292         sbin/cpu \
293         $(BIN_RCCE_BT) \
294         $(BIN_RCCE_LU) \
295         sbin/rcce_pingpong \
296         sbin/bench \
297         sbin/eMAC \
298         sbin/netd \
299         sbin/NGD_mng \
300         sbin/webserver \
301         sbin/ipirc_test \
302         sbin/thc_v_flounder_empty \
303         sbin/thcidctest \
304         sbin/thcminitest \
305         sbin/thctest \
306         sbin/mem_serv_dist \
307         sbin/net-test \
308         sbin/netthroughput \
309         sbin/udp_throughput
310
311 # ARM-specific modules to build by default
312 MODULES_armv5=\
313         sbin/cpu \
314         sbin/cpu.bin
315
316 # XScale-specific modules to build by default
317 MODULES_xscale=\
318         sbin/cpu_ixp2800 \
319         sbin/cpu_ixp2800.bin
320
321 # ARMv7-specific modules to build by default
322 # XXX: figure out armv7 default
323 MODULES_armv7=\
324         sbin/cpu_omap44xx \
325         sbin/usb_manager \
326         sbin/usb_keyboard \
327         sbin/kaluga \
328         sbin/fish \
329         sbin/corectrl
330
331 # ARM11MP-specific modules to build by default
332 MODULES_arm11mp=\
333         sbin/cpu \
334         sbin/cpu.bin
335
336 # construct list of all modules to be built (arch-specific and common for each arch)
337 MODULES=$(foreach a,$(HAKE_ARCHS),$(foreach m,$(MODULES_$(a)),$(a)/$(m)) \
338                                   $(foreach m,$(MODULES_COMMON),$(a)/$(m))) \
339                 $(foreach a,$(HAKE_ARCHS),$(foreach m,$(TESTS_$(a)),$(a)/$(m)) \
340                                           $(foreach m,$(TESTS_COMMON),$(a)/$(m))) \
341                 $(foreach a,$(HAKE_ARCHS),$(foreach m,$(BENCH_$(a)),$(a)/$(m)) \
342                                   $(foreach m,$(BENCH_COMMON),$(a)/$(m))) \
343         $(MODULES_GENERIC)
344
345 all: $(MODULES) menu.lst
346         @echo "You've just run the default ("all") target for Barrelfish"
347         @echo "using Hake.  The following modules have been built:"
348         @echo $(MODULES)
349         @echo "If you want to change this target, edit the file called"
350         @echo "'symbolic_targets.mk' in your build directory."
351 .PHONY: all
352
353 # XXX: this should be overridden in some local settings file?
354 INSTALL_PREFIX ?= /home/netos/tftpboot/$(USER)
355
356 # Only install a binary if it doesn't exist in INSTALL_PREFIX or the modification timestamp differs
357 install: $(MODULES)
358         @echo ""; \
359         echo "Installing modules..." ; \
360         for m in ${MODULES}; do \
361           if [ ! -f ${INSTALL_PREFIX}/$$m ] || \
362               [ $$(stat -c%Y $$m) -ne $$(stat -c%Y ${INSTALL_PREFIX}/$$m) ]; then \
363                  do_update=1; \
364                  echo "  > Installing $$m" ; \
365                  mkdir -p ${INSTALL_PREFIX}/$$(dirname $$m); \
366                  install -p $$m ${INSTALL_PREFIX}/$$m; \
367           fi; \
368         done; \
369         if [ ! $$do_update ]; then \
370                 echo "  > All up to date" ; \
371         fi; \
372         echo ""; \
373         echo "done." ; \
374
375 .PHONY : install
376
377
378 install_headers:
379         echo "Installing header files..." ; \
380         for a in ${HAKE_ARCHS}; do \
381           mkdir -p "$$a" ; \
382           cp -rv "${SRCDIR}/include" "$$a/" ; \
383         done; \
384         echo "done." ; \
385
386 .PHONY : install_headers
387
388 sim: simulate
389 .PHONY : sim
390
391 QEMU=unknown-arch-error
392 GDB=unknown-arch-error
393 CLEAN_HD=
394
395 DISK=hd.img
396 AHCI=-device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -drive id=disk,file=$(DISK),if=none
397
398 MENU_LST=-kernel $(shell sed -rne 's,^kernel[ \t]*/([^ ]*).*,\1,p' menu.lst) \
399         -append '$(shell sed -rne 's,^kernel[ \t]*[^ ]*[ \t]*(.*),\1,p' menu.lst)' \
400         -initrd '$(shell sed -rne 's,^module(nounzip)?[ \t]*/(.*),\2,p' menu.lst | awk '{ if(NR == 1) printf($$0); else printf("," $$0) } END { printf("\n") }')'
401
402 ifeq ($(ARCH),x86_64)
403     QEMU_CMD=qemu-system-x86_64 -smp 2 -m 1024 -net nic,model=e1000 -net user $(AHCI) -nographic $(MENU_LST)
404         GDB=x86_64-pc-linux-gdb
405         CLEAN_HD=qemu-img create $(DISK) 10M
406 else ifeq ($(ARCH),x86_32)
407         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
408         GDB=gdb
409 else ifeq ($(ARCH),scc)
410         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
411         GDB=gdb
412 else ifeq ($(ARCH),armv5)
413         ARM_QEMU_CMD=qemu-system-arm -M integratorcp -kernel armv5/sbin/cpu.bin -nographic -no-reboot -m 256 -initrd armv5/romfs.cpio
414         GDB=xterm -e arm-linux-gnueabi-gdb
415 simulate: $(MODULES) armv5/romfs.cpio
416         $(ARM_QEMU_CMD)
417 .PHONY: simulate
418
419 armv5/tools/debug.arm.gdb: $(SRCDIR)/tools/debug.arm.gdb
420         cp $< $@
421
422 debugsim: $(MODULES) armv5/romfs.cpio armv5/tools/debug.arm.gdb
423         $(SRCDIR)/tools/debug.sh "$(ARM_QEMU_CMD) -initrd armv5/romfs.cpio" "$(GDB)" "-s $(ARCH)/sbin/cpu -x armv5/tools/debug.arm.gdb $(GDB_ARGS)"
424 .PHONY : debugsim
425 else ifeq ($(ARCH),arm11mp)
426         QEMU_CMD=qemu-system-arm -cpu mpcore -M realview -kernel arm11mp/sbin/cpu.bin
427         GDB=arm-linux-gnueabi-gdb
428 else ifeq ($(ARCH), k1om)
429         # what is the emulation option for the xeon phi ?
430         QEMU=unknown-arch-error
431         GDB=x86_64-k1om-barrelfish-gdb
432 endif
433
434
435 ifdef QEMU_CMD
436
437 simulate: $(MODULES)
438         $(CLEAN_HD)
439         $(QEMU_CMD)
440 .PHONY : simulate
441
442 debugsim: $(MODULES)
443         $(CLEAN_HD)
444         $(SRCDIR)/tools/debug.sh "$(QEMU_CMD)" "$(GDB)" "-x $(SRCDIR)/tools/debug.gdb $(GDB_ARGS)" "file:/dev/stdout"
445 .PHONY : debugsim
446
447 endif
448
449
450
451 $(ARCH)/menu.lst: $(SRCDIR)/hake/menu.lst.$(ARCH)
452         cp $< $@
453
454 $(ARCH)/romfs.cpio: $(SRCDIR)/tools/arm-mkbootcpio.sh $(MODULES) $(ARCH)/menu.lst
455         $(SRCDIR)/tools/arm-mkbootcpio.sh $(ARCH)/menu.lst $@
456
457 # Location of hardcoded size of romfs CPIO image
458 arm_romfs_cpio = "$(ARCH)/include/romfs_size.h"
459
460 # XXX: Horrid hack to hardcode size of romfs CPIO image into ARM kernel
461 # This works in several recursive make steps:
462 # 1. Create a dummy romfs_size.h header file
463 # 2. Compile everything
464 # 3. Create the romfs CPIO image
465 # 4. Determine its size and write to romfs_size.h
466 # 5. Re-compile kernel (but not the romfs) with correct size information
467 # 6. Install romfs to installation location
468 arm:
469         $(MAKE)
470         $(MAKE) $(ARCH)/romfs.cpio
471         echo "//Autogenerated size of romfs.cpio because the bootloader cannot calculate it" > $(arm_romfs_cpio)
472         echo "size_t romfs_cpio_archive_size = `ls -asl $(ARCH)/romfs.cpio | sed -e 's/ /\n/g' | head -6 | tail -1`;" >> $(arm_romfs_cpio)
473         $(MAKE)
474 .PHONY: arm
475
476 # Builds a dummy romfs_size.h
477 $(ARCH)/include/romfs_size.h:
478         mkdir -p $(shell dirname $@)
479         echo "size_t romfs_cpio_archive_size = 0; //should not see this" > $@
480
481 arminstall:
482         $(MAKE) arm
483         $(MAKE) install
484         install -p $(ARCH)/romfs.cpio ${INSTALL_PREFIX}/$(ARCH)/romfs.cpio
485 .PHONY: arminstall
486
487 # Copy the scc-specific menu.lst from the source directory to the build directory
488 menu.lst.scc: $(SRCDIR)/hake/menu.lst.scc
489         cp $< $@
490
491 scc: all tools/bin/dite menu.lst.scc
492         $(shell find scc/sbin -type f -print0 | xargs -0 strip -d)
493         tools/bin/dite -32 -o bigimage.dat menu.lst.scc
494         cp $(SRCDIR)/tools/scc/bootvector.dat .
495         bin2obj -m $(SRCDIR)/tools/scc/bigimage.map -o barrelfish0.obj
496         bin2obj -m $(SRCDIR)/tools/scc/bootvector.map -o barrelfish1.obj
497         @echo Taking the barrelfish.obj files to SCC host
498         scp barrelfish[01].obj user@tomme1.in.barrelfish.org:
499
500 # Source indexing targets
501 cscope.files:
502         find $(abspath .) $(abspath $(SRCDIR)) -name '*.[ch]' -type f -print | sort | uniq > $@
503 .PHONY: cscope.files
504
505 cscope.out: cscope.files
506         cscope -k -b -i$<
507
508 TAGS: cscope.files
509         etags - < $< # for emacs
510         cat $< | xargs ctags -o TAGS_VI # for vim
511
512 # force rebuild of the Makefile
513 rehake: ./hake/hake
514         ./hake/hake --source-dir $(SRCDIR)
515 .PHONY: rehake
516
517 clean::
518         $(RM) -r tools $(HAKE_ARCHS)
519 .PHONY: clean
520
521 realclean:: clean
522         $(RM) hake/*.o hake/*.hi hake/hake Hakefiles.hs cscope.*
523 .PHONY: realclean
524
525 # Documentation
526 DOCS= \
527         ./docs/TN-000-Overview.pdf \
528         ./docs/TN-001-Glossary.pdf \
529         ./docs/TN-002-Mackerel.pdf \
530         ./docs/TN-003-Hake.pdf \
531         ./docs/TN-004-VirtualMemory.pdf \
532         ./docs/TN-005-SCC.pdf \
533         ./docs/TN-006-Routing.pdf \
534         ./docs/TN-008-Tracing.pdf \
535         ./docs/TN-009-Notifications.pdf \
536         ./docs/TN-010-Spec.pdf \
537         ./docs/TN-011-IDC.pdf \
538         ./docs/TN-012-Services.pdf \
539         ./docs/TN-013-CapabilityManagement.pdf \
540         ./docs/TN-014-bulk-transfer.pdf \
541         ./docs/TN-015-DiskDriverArchitecture.pdf \
542         ./docs/TN-016-Serial.pdf \
543         ./docs/TN-017-ARM.pdf \
544         ./docs/TN-018-PracticalGuide.pdf \
545         ./docs/TN-019-DeviceDriver.pdf
546
547 docs doc: $(DOCS)
548 .PHONY: docs doc
549
550 clean::
551         $(RM) $(DOCS)
552 .PHONY: clean
553
554 doxygen: Doxyfile
555         doxygen $<
556 .PHONY: doxygen
557
558 # pretend to be CMake's CONFIGURE_FILE command
559 # TODO: clean this up
560 Doxyfile: $(SRCDIR)/doc/Doxyfile.cmake
561         sed -r 's#@CMAKE_SOURCE_DIR@#$(SRCDIR)#g' $< > $@
562
563 # Scheduler simulator test cases
564 RUNTIME = 1000
565 TESTS = $(addsuffix .txt,$(basename $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)))
566
567 schedsim-regen: $(TESTS)
568
569 $(TESTS): %.txt: %.cfg tools/bin/simulator
570         tools/bin/simulator $< $(RUNTIME) > $@
571
572 schedsim-check: $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)
573         for f in $^; do tools/bin/simulator $$f $(RUNTIME) | diff -q - `dirname $$f`/`basename $$f .cfg`.txt || exit 1; done
574
575 ######################################################################
576 #
577 # Intel Xeon Phi Builds
578 #
579 ######################################################################
580
581 k1om/sbin/weever: k1om/sbin/weever_elf
582         $(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever
583
584
585
586 #######################################################################
587 #
588 # Pandaboard builds
589 #
590 #######################################################################
591
592 PANDABOARD_MODULES=\
593         armv7/sbin/cpu_omap44xx \
594         armv7/sbin/init \
595         armv7/sbin/mem_serv \
596         armv7/sbin/monitor \
597         armv7/sbin/ramfsd \
598         armv7/sbin/spawnd \
599         armv7/sbin/startd \
600         armv7/sbin/skb \
601         armv7/sbin/memtest \
602         armv7/sbin/kaluga \
603         armv7/sbin/fish \
604         armv7/sbin/sdma \
605         armv7/sbin/sdmatest \
606         armv7/sbin/sdma_bench \
607         armv7/sbin/bulk_sdma \
608         armv7/sbin/usb_manager \
609         armv7/sbin/usb_keyboard \
610         armv7/sbin/serial \
611         armv7/sbin/angler \
612         armv7/sbin/corectrl \
613
614
615 menu.lst.pandaboard: $(SRCDIR)/hake/menu.lst.pandaboard
616         cp $< $@
617
618 pandaboard_image: $(PANDABOARD_MODULES) \
619                 tools/bin/arm_molly \
620                 menu.lst.pandaboard
621         # Translate each of the binary files we need
622         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.pandaboard molly_panda
623         # Generate appropriate linker script
624         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
625                 molly_panda/molly_ld_script
626         # Build a C file to link into a single image for the 2nd-stage
627         # bootloader
628         tools/bin/arm_molly menu.lst.pandaboard panda_mbi.c
629         # Compile the complete boot image into a single executable
630         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
631                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
632                 -Tmolly_panda/molly_ld_script \
633                 -I$(SRCDIR)/include \
634                 -I$(SRCDIR)/include/arch/arm \
635                 -I./armv7/include \
636                 -I$(SRCDIR)/include/oldc \
637                 -I$(SRCDIR)/include/c \
638                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
639                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
640                 $(SRCDIR)/tools/arm_molly/molly_init.c \
641                 $(SRCDIR)/tools/arm_molly/lib.c \
642                 ./panda_mbi.c \
643                 $(SRCDIR)/lib/elf/elf32.c \
644                 ./molly_panda/* \
645                 -o pandaboard_image
646         @echo "OK - pandaboard boot image is built."
647         @echo "If your boot environment is correctly set up, you can now:"
648         @echo "$ usbboot ./pandaboard_image"
649
650 ########################################################################
651 #
652 # GEM5 build
653 #
654 ########################################################################
655
656 menu.lst.arm_gem5: $(SRCDIR)/hake/menu.lst.arm_gem5
657         cp $< $@
658
659 menu.lst.arm_gem5_mc: $(SRCDIR)/hake/menu.lst.arm_gem5_mc
660         cp $< $@
661
662 GEM5_MODULES=\
663         armv7/sbin/cpu_arm_gem5 \
664         armv7/sbin/init \
665         armv7/sbin/mem_serv \
666         armv7/sbin/monitor \
667         armv7/sbin/ramfsd \
668         armv7/sbin/spawnd \
669         armv7/sbin/startd \
670         armv7/sbin/corectrl \
671         armv7/sbin/skb \
672         armv7/sbin/memtest
673
674
675 arm_gem5_image: $(GEM5_MODULES) \
676                 tools/bin/arm_molly \
677                 menu.lst.arm_gem5_mc
678         # Translate each of the binary files we need
679         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.arm_gem5_mc molly_gem5
680         # Generate appropriate linker script
681         cpp -P -DBASE_ADDR=0x00100000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
682                 molly_gem5/molly_ld_script
683         # Build a C file to link into a single image for the 2nd-stage
684         # bootloader
685         tools/bin/arm_molly menu.lst.arm_gem5_mc arm_mbi.c
686         # Compile the complete boot image into a single executable
687         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
688                 -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
689                 -Tmolly_gem5/molly_ld_script \
690                 -I$(SRCDIR)/include \
691                 -I$(SRCDIR)/include/arch/arm \
692                 -I./armv7/include \
693                 -I$(SRCDIR)/include/oldc \
694                 -I$(SRCDIR)/include/c \
695                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
696                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
697                 $(SRCDIR)/tools/arm_molly/molly_init.c \
698                 $(SRCDIR)/tools/arm_molly/lib.c \
699                 ./arm_mbi.c \
700                 $(SRCDIR)/lib/elf/elf32.c \
701                 ./molly_gem5/* \
702                 -o arm_gem5_image
703
704 # ARM GEM5 Simulation Targets
705 ARM_FLAGS=$(SRCDIR)/tools/arm_gem5/gem5script.py --caches --l2cache --n=2 --kernel=arm_gem5_image
706
707 arm_gem5: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
708         gem5.fast $(ARM_FLAGS)
709
710 arm_gem5_detailed: arm_gem5_image $(SRCDIR)/tools/arm_gem5/gem5script.py
711         gem5.fast $(ARM_FLAGS) --cpu-type=arm_detailed
712
713 .PHONY: arm_gem5 arm_gem5_detailed
714
715 #######################################################################
716 #
717 # Pandaboard build for the armv7-M slave image (to be used in conjunction with a master image)
718 # (basically a normal pandaboard_image, but compiled for the cortex-m3)
719 #
720 #######################################################################
721
722 HETEROPANDA_SLAVE_MODULES=\
723         armv7-m/sbin/cpu_omap44xx \
724         armv7-m/sbin/init \
725         armv7-m/sbin/mem_serv \
726         armv7-m/sbin/monitor \
727         armv7-m/sbin/ramfsd \
728         armv7-m/sbin/spawnd \
729         armv7-m/sbin/startd \
730         armv7-m/sbin/skb \
731         armv7-m/sbin/memtest
732
733 menu.lst.armv7-m: $(SRCDIR)/hake/menu.lst.armv7-m
734         cp $< $@
735
736 heteropanda_slave: $(HETEROPANDA_SLAVE_MODULES) \
737                 tools/bin/arm_molly \
738                 menu.lst.armv7-m
739         # Translate each of the binary files we need
740         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.armv7-m molly_panda_slave
741         # Generate appropriate linker script
742         cpp -P -DBASE_ADDR=0x0 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
743                 molly_panda_slave/molly_ld_script
744         # Build a C file to link into a single image for the 2nd-stage
745         # bootloader
746         tools/bin/arm_molly menu.lst.armv7-m panda_mbi_slave.c
747         # Compile the complete boot image into a single executable
748         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
749                 -nostdlib -march=armv7-m -mcpu=cortex-m3 -mthumb -mapcs -fno-unwind-tables \
750                 -Tmolly_panda_slave/molly_ld_script \
751                 -I$(SRCDIR)/include \
752                 -I$(SRCDIR)/include/arch/arm \
753                 -I./armv7-m/include \
754                 -I$(SRCDIR)/include/oldc \
755                 -I$(SRCDIR)/include/c \
756                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
757                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
758                 $(SRCDIR)/tools/arm_molly/molly_init.c \
759                 $(SRCDIR)/tools/arm_molly/lib.c \
760                 ./panda_mbi_slave.c \
761                 $(SRCDIR)/lib/elf/elf32.c \
762                 ./molly_panda_slave/* \
763                 -o heteropanda_slave
764         @echo "OK - heteropanda slave image is built."
765         @echo "you can now use this image to link into a regular pandaboard image"
766
767
768
769
770 #######################################################################
771 #
772 # Pandaboard build for the heteropanda_master:
773 # basically a regular pandaboard_image, except that it contains
774 # a heteropanda_slave image, and arm_molly is called with -DHETEROPANDA
775 #
776 #######################################################################
777
778 menu.lst.heteropanda_master: $(SRCDIR)/hake/menu.lst.heteropanda_master
779         cp $< $@
780
781 heteropanda_master_image: $(PANDABOARD_MODULES) \
782                 tools/bin/arm_molly \
783                 menu.lst.heteropanda_master \
784                 heteropanda_slave \
785                 $(SRCDIR)/tools/arm_molly/molly_ld_script.in
786         # Translate each of the binary files we need
787         $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.heteropanda_master molly_panda
788         # Generate appropriate linker script
789         cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
790                 molly_panda/molly_ld_script
791
792         # HETEROPANDA: convert slave image into a form we can insert in our image
793         $(ARM_OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section \
794             .data=.rodata_thumb,alloc,load,readonly,data,contents heteropanda_slave \
795             molly_panda/heteropanda_slave
796
797         # Build a C file to link into a single image for the 2nd-stage
798         # bootloader
799         tools/bin/arm_molly menu.lst.heteropanda_master panda_mbi.c
800         # Compile the complete boot image into a single executable
801         $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
802                 -nostdlib -march=armv7-a -mcpu=cortex-a9 -mapcs -fno-unwind-tables \
803                 -Tmolly_panda/molly_ld_script \
804                 -I$(SRCDIR)/include \
805                 -I$(SRCDIR)/include/arch/arm \
806                 -I./armv7/include \
807                 -I$(SRCDIR)/include/oldc \
808                 -I$(SRCDIR)/include/c \
809                 -imacros $(SRCDIR)/include/deputy/nodeputy.h \
810                 $(SRCDIR)/tools/arm_molly/molly_boot.S \
811                 $(SRCDIR)/tools/arm_molly/molly_init.c \
812                 $(SRCDIR)/tools/arm_molly/lib.c \
813                 ./panda_mbi.c \
814                 $(SRCDIR)/lib/elf/elf32.c \
815                 ./molly_panda/* \
816                 -DHETEROPANDA \
817                 -o heteropanda_master_image
818         @echo "OK - heteropanda_master_image is built."
819         @echo "If your boot environment is correctly set up, you can now:"
820         @echo "$ usbboot ./heteropanda_master_image"