aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/stm32/Makefile')
-rw-r--r--src/stm32/Makefile13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/stm32/Makefile b/src/stm32/Makefile
index f7df2a4d..016c281e 100644
--- a/src/stm32/Makefile
+++ b/src/stm32/Makefile
@@ -13,9 +13,11 @@ MCU_UPPER := $(shell echo $(CONFIG_MCU) | tr a-z A-Z | tr X x)
CFLAGS-$(CONFIG_MACH_STM32F1) += -mcpu=cortex-m3 -Ilib/stm32f1/include
CFLAGS-$(CONFIG_MACH_STM32F4) += -mcpu=cortex-m4 -Ilib/stm32f4/include
CFLAGS-$(CONFIG_MACH_STM32F4) += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
-
CFLAGS += $(CFLAGS-y) -D$(MCU_UPPER) -mthumb -Ilib/cmsis-core
-CFLAGS_klipper.elf += -T $(OUT)stm32.ld --specs=nano.specs --specs=nosys.specs
+
+CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
+CFLAGS_klipper.elf += -T $(OUT)src/stm32/stm32.ld
+$(OUT)klipper.elf: $(OUT)src/stm32/stm32.ld
# Add source files
src-y += stm32/main.c stm32/watchdog.c stm32/gpio.c
@@ -41,12 +43,6 @@ asmsrc-$(CONFIG_MACH_STM32F1) := ../lib/stm32f1/gcc/startup_$(MCU).s
asmsrc-$(CONFIG_MACH_STM32F4) := ../lib/stm32f4/gcc/startup_$(MCU).s
OBJS_klipper.elf += $(patsubst %.s, $(OUT)src/%.o,$(asmsrc-y))
-# Build the linker script
-$(OUT)stm32.ld: src/stm32/stm32.lds.S $(OUT)board-link
- @echo " Preprocessing $@"
- $(Q)$(CPP) -I$(OUT) -P -MD -MT $@ $< -o $@
-$(OUT)klipper.elf: $(OUT)stm32.ld
-
# Binary output file rules
target-y += $(OUT)klipper.bin
@@ -54,6 +50,7 @@ $(OUT)klipper.bin: $(OUT)klipper.elf
@echo " Creating hex file $@"
$(Q)$(OBJCOPY) -O binary $< $@
+# Flash rules
FLASH_TYPE-$(CONFIG_MACH_STM32F1) := stm32f1
FLASH_TYPE-$(CONFIG_MACH_STM32F4) := stm32f4