aboutsummaryrefslogtreecommitdiff
path: root/fw/Makefile
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2017-09-01 20:52:34 +0200
committerjaseg <git@jaseg.net>2017-09-01 20:52:34 +0200
commit446dbe6412be94324b3acac7afb7a730bdbd3ca6 (patch)
tree5bde5d501c020cb7634ac4eed9ab83778d9b604a /fw/Makefile
parent5a19ab0e848a5a6974772a9918ca4a873675cade (diff)
download7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.tar.gz
7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.tar.bz2
7seg-446dbe6412be94324b3acac7afb7a730bdbd3ca6.zip
Now with working source extraction from firmware
Diffstat (limited to 'fw/Makefile')
-rw-r--r--fw/Makefile22
1 files changed, 14 insertions, 8 deletions
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)