aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f1/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/stm32f1/Makefile')
-rw-r--r--src/stm32f1/Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/stm32f1/Makefile b/src/stm32f1/Makefile
index 1d33c470..169e71ee 100644
--- a/src/stm32f1/Makefile
+++ b/src/stm32f1/Makefile
@@ -13,8 +13,7 @@ CFLAGS += -Ilib/hal-stm32f1/include
CFLAGS += -DSTM32F103xB
CFLAGS += -O3
-CFLAGS_klipper.elf += -Llib/cmsis-stm32f1/source/
-CFLAGS_klipper.elf += -Tlib/cmsis-stm32f1/source/stm32f1.ld
+CFLAGS_klipper.elf += -T $(OUT)stm32f1.ld
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
# Add source files
@@ -33,6 +32,13 @@ $(OUT)%.o: %.s $(OUT)autoconf.h $(OUT)board-link
$(OUT)klipper.elf: $(patsubst %.s, $(OUT)src/%.o,$(asmsrc-y))
+# Build the linker script
+target-y := $(OUT)stm32f1.ld $(target-y)
+
+$(OUT)stm32f1.ld: src/stm32f1/stm32f1.ld $(OUT)board-link
+ @echo " Preprocessing $@"
+ $(Q)$(CPP) -P -MD -MT $@ -DFLASH_START=$(CONFIG_FLASH_START) $< -o $@
+
# Binary output file rules
target-y += $(OUT)klipper.bin