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
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
13 # To add a header with mkimage we need a binary file
\r
14 build-bin-y = $(PROJECTNAME).bin
\r
16 all-mod += $(build-srec-image-y)
\r
17 all-mod += $(build-srec-y)
\r
18 all-mod += $(build-bin-image-y)
\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
26 $(build-srec-y) : $(build-exe-y)
\r
28 @echo " >> OBJCOPY $@"
\r
29 $(Q)$(CROSS_COMPILE)objcopy -O srec $< $@
\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
36 $(SREC_CAT) $< -offset - -minimum-addr $< -o $@ -binary
\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