Code reorganization

This commit is contained in:
Thomas Klaehn
2022-12-15 10:18:35 +01:00
parent 1eee0af374
commit f94eeb5ffe
47 changed files with 11 additions and 9657 deletions

View File

@@ -3,19 +3,12 @@ TARGET = firmware
DEBUG = 1
OPT = -O0
BUILD_DIR = _build
BUILD_DIR = build
CC_SOURCES = \
Core/main.cc \
platform/stm32g0xx/Gpio.cc \
platform/stm32g0xx/Uart.cc \
platform/stm32g0xx/IndependentWatchdog.cc \
platform/stm32g0xx/low_level_interrupt.cc
C_SOURCES = \
platform/stm32g0xx/system_stm32g0xx.c \
platform/stm32g0xx/syscalls.c \
platform/stm32g0xx/sysmem.c \
SRC_DIRS := $(shell find src -type d)
CC_SOURCES = $(foreach folder, $(SRC_DIRS), $(wildcard $(folder)/*.cc))
C_SOURCES = $(foreach folder, $(SRC_DIRS), $(wildcard $(folder)/*.c))
ASM_SOURCES = $(foreach folder, $(SRC_DIRS), $(wildcard $(folder)/*.s))
PREFIX = arm-none-eabi-
CC = $(PREFIX)gcc
@@ -30,31 +23,11 @@ BIN = $(CP) -O binary -S
CPU = -mcpu=cortex-m0plus
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
ifeq "$(SOC)" "stm32g071"
C_DEFS = -DSTM32G071xx
LDSCRIPT = platform/stm32g0xx/STM32G071RBTX_FLASH.ld
ASM_SOURCES = platform/stm32g0xx/startup_stm32g071rbtx.s
else
ifeq "$(SOC)" "stm32g031"
C_DEFS = -DSTM32G031xx
LDSCRIPT = platform/stm32g0xx/STM32G031Y8YX_FLASH.ld
ASM_SOURCES = platform/stm32g0xx/startup_stm32g031y8yx.s
endif
endif
C_INCLUDES = \
-I. \
-ICore \
-Iarch/CMSIS/Device/ST/STM32G0xx/Include \
-Iarch/CMSIS/Include \
-Iplatform/stm32g0xx
LDSCRIPT = src/platform/stm32g0xx/STM32G031Y8YX_FLASH.ld
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(addprefix -I,$(SRC_DIRS)) $(OPT) -Wall -fdata-sections -ffunction-sections
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3