stm32f4: Add Kconfig build rules for STM32F405/7

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-07-27 16:43:35 -04:00
parent 961d13ee1a
commit 16616662ed
7 changed files with 146 additions and 125 deletions

View File

@@ -6,9 +6,13 @@ CROSS_PREFIX=arm-none-eabi-
dirs-y += src/stm32f4 src/generic
dirs-y += lib/stm32f4 lib/stm32f4/gcc
MCU := $(shell echo $(CONFIG_MCU) | tr a-z A-Z)
CFLAGS += -D$(MCU)xx
CFLAGS += -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
CFLAGS += -Ilib/cmsis-core -Ilib/stm32f4/include
CFLAGS += -DSTM32F446xx
CFLAGS_klipper.elf += -T $(OUT)stm32f4.ld --specs=nano.specs --specs=nosys.specs
# Add source files
src-y += stm32f4/main.c stm32f4/clock.c stm32f4/watchdog.c stm32f4/gpio.c
@@ -24,17 +28,14 @@ $(OUT)%.o: %.s $(OUT)autoconf.h $(OUT)board-link
@echo " Assembling $@"
$(Q)$(AS) $< -o $@
asmsrc-y = ../lib/stm32f4/gcc/startup_stm32f446xx.s
asmsrc-y := ../lib/stm32f4/gcc/startup_$(shell echo $(CONFIG_MCU))xx.s
OBJS_klipper.elf += $(patsubst %.s, $(OUT)src/%.o,$(asmsrc-y))
# Build the linker script
$(OUT)stm32f4.ld: src/stm32f4/stm32f4.ld $(OUT)board-link
$(OUT)stm32f4.ld: src/stm32f4/stm32f4.lds.S $(OUT)board-link
@echo " Preprocessing $@"
$(Q)$(CPP) -P -MD -MT $@ -DFLASH_START=0 $< -o $@
CFLAGS_klipper.elf += -T $(OUT)stm32f4.ld
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
$(OUT)klipper.elf : $(OUT)stm32f4.ld
$(Q)$(CPP) -I$(OUT) -P -MD -MT $@ $< -o $@
$(OUT)klipper.elf: $(OUT)stm32f4.ld
# Binary output file rules
target-y += $(OUT)klipper.bin