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