]> rtime.felk.cvut.cz Git - arc.git/blob - scripts/bootloader_image.mk
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / scripts / bootloader_image.mk
1 \r
2 \r
3 MKIMAGE?=/c/Users/mahi/git/bootloader/bin/mkimage\r
4 SRECORD_PATH?=/c/devtools/srecord\r
5 SREC_CAT=$(Q)$(SRECORD_PATH)/srec_cat.exe\r
6 SREC_INFO=$(Q)$(SRECORD_PATH)/srec_info.exe\r
7 \r
8 # "downloader" need an srecord file \r
9 build-srec-image-y = $(PROJECTNAME)_srec_image.srec\r
10 build-srec-y = $(PROJECTNAME).srec\r
11 build-bin-image-y = $(PROJECTNAME)_bin_image.bin\r
12 \r
13 # To add a header with mkimage we need a binary file\r
14 build-bin-y = $(PROJECTNAME).bin\r
15 \r
16 all-mod += $(build-srec-image-y)\r
17 all-mod += $(build-srec-y)\r
18 all-mod += $(build-bin-image-y)\r
19 \r
20 # To srecord again to load in tool\r
21 $(build-srec-image-y): $(build-bin-image-y)\r
22         @echo ">> Binary to SREC to load with tool"\r
23         $(SREC_CAT) $< -binary -offset ${BOOT_IMAGE_ADDR} -o $@\r
24         $(SREC_INFO) $@\r
25 \r
26 $(build-srec-y) : $(build-exe-y)\r
27         @echo\r
28         @echo "  >> OBJCOPY $@"   \r
29         $(Q)$(CROSS_COMPILE)objcopy -O srec $< $@\r
30         $(SREC_INFO) $@\r
31 \r
32 # Binary image down to 0\r
33 $(build-bin-y) : $(build-srec-y)\r
34         @echo ">> srec to binary with offset 0"\r
35         $(SREC_INFO) $< \r
36         $(SREC_CAT) $< -offset - -minimum-addr $< -o $@ -binary\r
37 \r
38 # Add image header              \r
39 # Should extract the start address with "objdump -f"\r
40 $(build-bin-image-y): $(build-bin-y)\r
41         @echo ">> Adding header" \r
42         $(MKIMAGE) -o $@ -l $(BOOT_BLOB_LOAD_ADDR) -s $(BOOT_BLOB_START_ADDR) -m "APP" -v $<\r