diff options
author | jaseg <git@jaseg.net> | 2017-09-01 20:52:34 +0200 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2017-09-01 20:52:34 +0200 |
commit | 446dbe6412be94324b3acac7afb7a730bdbd3ca6 (patch) | |
tree | 5bde5d501c020cb7634ac4eed9ab83778d9b604a | |
parent | 5a19ab0e848a5a6974772a9918ca4a873675cade (diff) | |
download | 7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.tar.gz 7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.tar.bz2 7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.zip |
Now with working source extraction from firmware
-rw-r--r-- | fw/.gitignore | 1 | ||||
-rw-r--r-- | fw/Makefile | 22 | ||||
-rw-r--r-- | fw/bus_addr.c | 2 | ||||
-rw-r--r-- | fw/stm32_flash.ld | 3 |
4 files changed, 18 insertions, 10 deletions
diff --git a/fw/.gitignore b/fw/.gitignore index c5278ea..5bbe03a 100644 --- a/fw/.gitignore +++ b/fw/.gitignore @@ -13,6 +13,5 @@ transpose.elf cmsis_exports.c sources.c sources.tar.xz -bus_addr.c __pycache__ .ipynb_checkpoints diff --git a/fw/Makefile b/fw/Makefile index b6f64d0..7990e80 100644 --- a/fw/Makefile +++ b/fw/Makefile @@ -3,19 +3,21 @@ CMSIS_PATH ?= STM32Cube/Drivers/CMSIS CMSIS_DEV_PATH ?= $(CMSIS_PATH)/Device/ST/STM32F0xx HAL_PATH ?= STM32Cube/Drivers/STM32F0xx_HAL_Driver +BUS_ADDR ?= 0 + CC := arm-none-eabi-gcc LD := arm-none-eabi-ld OBJCOPY := arm-none-eabi-objcopy OBJDUMP := arm-none-eabi-objdump SIZE := arm-none-eabi-size -CFLAGS = -g -Wall -std=gnu11 -O2 -fdump-rtl-expand +CFLAGS = -g -Wall -std=gnu11 -O2 -fdump-rtl-expand -DBUS_ADDR=$(BUS_ADDR) CFLAGS += -mlittle-endian -mcpu=cortex-m0 -march=armv6-m -mthumb #CFLAGS += -ffunction-sections -fdata-sections LDFLAGS = -nostartfiles #LDFLAGS += -specs=rdimon.specs -DSEMIHOSTING LDFLAGS += -Wl,-Map=main.map -nostdlib -#LDFLAGS += -Wl,--gc-sections +LDFLAGS += -Wl,--gc-sections LIBS = -lgcc #LIBS += -lrdimon @@ -30,7 +32,7 @@ LDFLAGS += -L$(CMSIS_PATH)/Lib/GCC -larm_cortexM0l_math ################################################### -.PHONY: program clean +.PHONY: program clean bus_addr.c all: main.elf @@ -39,20 +41,24 @@ cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f030x6.h $(CMSIS_PATH)/Include/c %.o: %.c $(CC) -c $(CFLAGS) -o $@ $^ - $(CC) -E $(CFLAGS) -o $(@:.o=.pp) $^ +# $(CC) -E $(CFLAGS) -o $(@:.o=.pp) $^ %.o: %.s $(CC) -c $(CFLAGS) -o $@ $^ - $(CC) -E $(CFLAGS) -o $(@:.o=.pp) $^ +# $(CC) -E $(CFLAGS) -o $(@:.o=.pp) $^ %.dot: %.elf r2 -a arm -qc 'aa;agC' $< 2>/dev/null >$@ -sources.tar.xz: main.c transpose.c transpose.h +sources.tar.xz: main.c transpose.c transpose.h Makefile tar -caf $@ $^ -sources.c: sources.tar.xz - xxd -i $< | sed 's/=/__attribute__((section(".text")))=/' > $@ +# 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.o startup_stm32f030x6.o system_stm32f0xx.o $(HAL_PATH)/Src/stm32f0xx_ll_utils.o base.o cmsis_exports.o transpose.o bus_addr.o sources.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) diff --git a/fw/bus_addr.c b/fw/bus_addr.c index 7f765ec..5e1fa2a 100644 --- a/fw/bus_addr.c +++ b/fw/bus_addr.c @@ -1,3 +1,3 @@ #include <stdint.h> -uint8_t bus_addr = 0; +uint8_t bus_addr = BUS_ADDR; diff --git a/fw/stm32_flash.ld b/fw/stm32_flash.ld index b763d8f..cba7577 100644 --- a/fw/stm32_flash.ld +++ b/fw/stm32_flash.ld @@ -29,9 +29,12 @@ SECTIONS { *(.glue_7) /* TBD - needed ? */
*(.glue_7t) /* TBD - needed ? */
+ *(.source_tarball)
+
/* Necessary KEEP sections (see http://sourceware.org/ml/newlib/2005/msg00255.html) */
KEEP (*(.init))
KEEP (*(.fini))
+ KEEP (*(.source_tarball))
. = ALIGN(4);
_etext = .;
|