From dc98c23aa2b2bd781b8a8c245465d615039b6f5f Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 8 Sep 2022 12:18:48 +0200 Subject: stm32 code compiling --- stm32f091/lib/STM32-base-STM32Cube | 1 + stm32f091/lib/STM32CubeF0 | 1 - stm32f091/makefile | 79 +++++++++++++++----------------------- 3 files changed, 31 insertions(+), 50 deletions(-) create mode 160000 stm32f091/lib/STM32-base-STM32Cube delete mode 160000 stm32f091/lib/STM32CubeF0 (limited to 'stm32f091') diff --git a/stm32f091/lib/STM32-base-STM32Cube b/stm32f091/lib/STM32-base-STM32Cube new file mode 160000 index 0000000..71bcfb7 --- /dev/null +++ b/stm32f091/lib/STM32-base-STM32Cube @@ -0,0 +1 @@ +Subproject commit 71bcfb75e9b3aadbfcb05b57148d995a7f340b4f diff --git a/stm32f091/lib/STM32CubeF0 b/stm32f091/lib/STM32CubeF0 deleted file mode 160000 index 830a0e9..0000000 --- a/stm32f091/lib/STM32CubeF0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 830a0e950d421c17abff57a2ea1e977870355519 diff --git a/stm32f091/makefile b/stm32f091/makefile index 63139cb..fa610fd 100644 --- a/stm32f091/makefile +++ b/stm32f091/makefile @@ -4,58 +4,39 @@ OC = arm-none-eabi-objcopy RM = rm -f TARGET = main -MCU_SPEC = cortex-m0 -CFLAGS += -g -CFLAGS += -Wall -CFLAGS += -Os -CFLAGS += -mcpu=$(MCU_SPEC) -CFLAGS += -mthumb -CFLAGS += --specs=nosys.specs -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/DSP/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/Core/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/Device/ST/STM32F0xx/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/RTOS2/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/Core_A/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/Include -CFLAGS += -I./lib/STM32CubeF0/Drivers/CMSIS/NN/Include -CFLAGS += -I./lib/STM32-base/startup -CFLAGS += -D STM32F091xC - -LFLAGS += -Wl,-u,vfprintf -LFLAGS += -lm -LFLAGS += -Wl,-relax -LFLAGS += -Wl,-gc-sections -LFLAGS += -mcpu=$(MCU_SPEC) -LFLAGS += -mthumb -LFLAGS += -Wall -LFLAGS += --specs=nosys.specs -LFLAGS += -nostartfiles -LFLAGS += -nostdlib -LFLAGS += -lgcc -LFLAGS += -Wl,-L./lib/STM32-base/linker,-T./lib/STM32-base/linker/STM32F0xx/STM32F091xC.ld - -LFLAGS += -Wa,--defsym,CALL_ARM_SYSTEM_INIT=1 -LFLAGS += -march=armv6-m -LFLAGS += -mlittle-endian -LFLAGS += -mthumb -LFLAGS += -masm-syntax-unified -LFLAGS += -fno-threadsafe-statics -LFLAGS += -fno-rtti -LFLAGS += -fno-exceptions -LFLAGS += -fno-unwind-tables - -# AFLAGS += -ffunction-sections -fdata-sections - -SRCS += $(wildcard *.cpp) -OBJS += $(patsubst %.cpp,%.o, $(SRCS)) - -# SRCS += ./lib/STM32-base/startup/STM32F0xx/STM32F091xC.s -SRCS += ./lib/STM32CubeF0/Drivers/CMSIS/Device/ST/STM32F0xx/Source/Templates/system_stm32f0xx.o +SHARED_FLAGS += -g +SHARED_FLAGS += -D STM32F091xC +SHARED_FLAGS += -Wall +SHARED_FLAGS += -Wextra +SHARED_FLAGS += -Wa,--defsym,CALL_ARM_SYSTEM_INIT=1 +SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/CMSIS/ARM/inc +SHARED_FLAGS += -I./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/inc +SHARED_FLAGS += -I./lib/STM32-base/startup +SHARED_FLAGS += -ffunction-sections +SHARED_FLAGS += -fdata-sections +SHARED_FLAGS += -mlittle-endian +SHARED_FLAGS += -mthumb +SHARED_FLAGS += -masm-syntax-unified +SHARED_FLAGS += -specs=nosys.specs +SHARED_FLAGS += -fno-threadsafe-statics +SHARED_FLAGS += -fno-rtti +SHARED_FLAGS += -fno-exceptions +SHARED_FLAGS += -fno-unwind-tables +SHARED_FLAGS += -Wl,-L./lib/STM32-base/linker,-T./lib/STM32-base/linker/STM32F0xx/STM32F091xC.ld +SHARED_FLAGS += -mcpu=cortex-m0 +SHARED_FLAGS += -march=armv6-m + +CFLAGS += $(SHARED_FLAGS) +LFLAGS += $(SHARED_FLAGS) +AFLAGS += $(SHARED_FLAGS) + +OBJS += $(patsubst %.cpp,%.o, $(wildcard *.cpp)) OBJS += ./lib/STM32-base/startup/STM32F0xx/STM32F091xC.o +OBJS += ./lib/STM32-base-STM32Cube/CMSIS/STM32F0xx/src/system_stm32f0xx.o %.o: %.s - $(CC) -x assembler-with-cpp -c $(CFLAGS) $(AFLAGS) $< -o $@ + $(CC) -c $(AFLAGS) $< -o $@ %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ @@ -64,7 +45,7 @@ OBJS += ./lib/STM32-base/startup/STM32F0xx/STM32F091xC.o $(CC) -c $(CFLAGS) $< -o $@ $(TARGET).elf: $(OBJS) - $(LD) $^ $(LFLAGS) -o $@ + $(LD) $(LFLAGS) $^ -o $@ $(TARGET).bin: $(TARGET).elf $(OC) -O binary $< $@ -- cgit v1.2.3