From 9383ced7fb57ebabb2ca509ca64a4ca49bca5875 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 5 Oct 2017 13:05:22 +0200 Subject: Add source-in-firmware trick --- olsndot/firmware/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'olsndot/firmware/Makefile') diff --git a/olsndot/firmware/Makefile b/olsndot/firmware/Makefile index 33c1139..ce1d221 100644 --- a/olsndot/firmware/Makefile +++ b/olsndot/firmware/Makefile @@ -31,7 +31,17 @@ all: main.elf cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f030x6.h $(CMSIS_PATH)/Include/core_cm0.h python3 gen_cmsis_exports.py $^ > $@ -main.elf: main.c startup_stm32f030x6.s system_stm32f0xx.c $(HAL_PATH)/Src/stm32f0xx_ll_utils.c cmsis_exports.c +sources.tar.xz: main.c Makefile + tar -caf $@ $^ + +# don't ask... +sources.tar.xz.zip: sources.tar.xz + zip $@ $^ + +sources.c: sources.tar.xz.zip + xxd -i $< | head -n -1 | sed 's/=/__attribute__((section(".source_tarball"))) =/' > $@ + +main.elf: main.c startup_stm32f030x6.s system_stm32f0xx.c $(HAL_PATH)/Src/stm32f0xx_ll_utils.c cmsis_exports.c sources.o $(CC) $(CFLAGS) -o $@ $^ $(OBJCOPY) -O ihex $@ $(@:.elf=.hex) $(OBJCOPY) -O binary $@ $(@:.elf=.bin) @@ -44,4 +54,5 @@ program: main.elf openocd.cfg clean: rm -f *.o rm -f main.elf main.hex main.bin main.map main.lst + rm -f sources.tar.xz sources.tar.xz.zip -- cgit