From d48b92b93507f46ba2623284d8a0841e22e9a09b Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 4 Mar 2019 23:16:42 +0900 Subject: driver/fw: Beginnings of a firmware This code starts up and blinks a led. This means RCC, GPIO and SPI1 are working. --- driver_fw/Makefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'driver_fw/Makefile') diff --git a/driver_fw/Makefile b/driver_fw/Makefile index 5ad3b23..b38bcd3 100644 --- a/driver_fw/Makefile +++ b/driver_fw/Makefile @@ -1,7 +1,7 @@ -CUBE_PATH ?= $(wildcard ~)/resource/STM32CubeF1 +CUBE_PATH ?= $(wildcard ~)/resource/STM32Cube_FW_F0_V1.9.0 CMSIS_PATH ?= $(CUBE_PATH)/Drivers/CMSIS -CMSIS_DEV_PATH ?= $(CMSIS_PATH)/Device/ST/STM32F1xx -HAL_PATH ?= $(CUBE_PATH)/Drivers/STM32F1xx_HAL_Driver +CMSIS_DEV_PATH ?= $(CMSIS_PATH)/Device/ST/STM32F0xx +HAL_PATH ?= $(CUBE_PATH)/Drivers/STM32F0xx_HAL_Driver CC := arm-none-eabi-gcc LD := arm-none-eabi-ld @@ -10,7 +10,7 @@ OBJDUMP := arm-none-eabi-objdump SIZE := arm-none-eabi-size CFLAGS = -g -Wall -std=gnu11 -O0 -fdump-rtl-expand -Wno-discarded-qualifiers -CFLAGS += -mlittle-endian -mcpu=cortex-m3 -mthumb +CFLAGS += -mlittle-endian -mcpu=cortex-m0 -mthumb #CFLAGS += -ffunction-sections -fdata-sections LDFLAGS = -nostartfiles #LDFLAGS += -specs=rdimon.specs -DSEMIHOSTING @@ -19,7 +19,10 @@ LDFLAGS += -Wl,-Map=main.map -nostdlib LIBS = -lgcc #LIBS += -lrdimon -CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000 +# Technically we're using an STM32F030F4, but apart from the TSSOP20 package that one is largely identical to the +# STM32F030*6 and there is no separate device header provided for it, so we're faking a *6 device here. This is +# even documented in stm32f0xx.h. Thanks ST! +CFLAGS += -DSTM32F030x6 -DHSE_VALUE=8000000 LDFLAGS += -Tstm32_flash.ld CFLAGS += -I$(CMSIS_DEV_PATH)/Include -I$(CMSIS_PATH)/Include -I$(HAL_PATH)/Inc -Iconfig -I../common @@ -31,7 +34,7 @@ CFLAGS += -I$(CMSIS_DEV_PATH)/Include -I$(CMSIS_PATH)/Include -I$(HAL_PATH)/Inc all: main.elf main.pdf -cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f103xb.h $(CMSIS_PATH)/Include/core_cm3.h +cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f030x6.h $(CMSIS_PATH)/Include/core_cm0.h python3 gen_cmsis_exports.py $^ > $@ %.o: %.c @@ -45,7 +48,7 @@ cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f103xb.h $(CMSIS_PATH)/Include/c %.dot: %.elf r2 -a arm -qc 'aa;agC' $< 2>/dev/null >$@ -main.elf: main.o startup_stm32f103xb.o system_stm32f1xx.o $(HAL_PATH)/Src/stm32f1xx_ll_utils.o cmsis_exports.o ../common/8b10b.o +main.elf: main.o startup_stm32f030x6.o system_stm32f0xx.o $(HAL_PATH)/Src/stm32f0xx_ll_utils.o cmsis_exports.o ../common/8b10b.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(OBJCOPY) -O ihex $@ $(@:.elf=.hex) $(OBJCOPY) -O binary $@ $(@:.elf=.bin) -- cgit