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/makefile | 79 +++++++++++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 49 deletions(-) (limited to 'stm32f091/makefile') 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