aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-08 12:18:48 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-08 12:18:48 +0200
commitdc98c23aa2b2bd781b8a8c245465d615039b6f5f (patch)
tree4b7952c37df9988165e95a0ef02ef4b266e033cd
parentc3b4382302a7ac74ad12a4d315d1d2c15204ca54 (diff)
stm32 code compiling
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
m---------stm32f091/lib/STM32-base-STM32Cube0
m---------stm32f091/lib/STM32CubeF00
-rw-r--r--stm32f091/makefile79
5 files changed, 35 insertions, 49 deletions
diff --git a/.gitignore b/.gitignore
index 6069cfc..e02e261 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
copyright
**/*.o
+stm32f091/main.elf
+stm32f091/main.bin
diff --git a/.gitmodules b/.gitmodules
index 7217253..e2434d9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "stm32f091/lib/STM32CubeF0"]
path = stm32f091/lib/STM32CubeF0
url = https://github.com/STMicroelectronics/STM32CubeF0
+[submodule "stm32f091/lib/STM32-base-STM32Cube"]
+ path = stm32f091/lib/STM32-base-STM32Cube
+ url = https://github.com/STM32-base/STM32-base-STM32Cube
diff --git a/stm32f091/lib/STM32-base-STM32Cube b/stm32f091/lib/STM32-base-STM32Cube
new file mode 160000
+Subproject 71bcfb75e9b3aadbfcb05b57148d995a7f340b4
diff --git a/stm32f091/lib/STM32CubeF0 b/stm32f091/lib/STM32CubeF0
deleted file mode 160000
-Subproject 830a0e950d421c17abff57a2ea1e97787035551
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 $< $@