both firmware and test are build and run using Makefile

This commit is contained in:
Attila Body 2019-12-13 14:43:40 +01:00
parent 6b628e9412
commit fd24d10fb7
346 changed files with 141567 additions and 28 deletions

View file

@ -22,7 +22,8 @@ TARGET = f407ve_packetusart_c
DEBUG = 1
# optimization
OPT = -Og
# c++ standard
CXXSTD = -std=c++0x
#######################################
# paths
@ -31,6 +32,7 @@ OPT = -Og
BUILD_DIR = build
COMPONENTS = components
PLATFORMS = platforms
PLATFORM = firmware
CONFIG_OVERRIDES = config-overrides
######################################
@ -77,14 +79,6 @@ CXX_SOURCES = \
ASM_SOURCES = \
startup_stm32f407xx.s
#######################################
# components
#######################################
include $(sort $(wildcard $(COMPONENTS)/*/component.mk))
#######################################
# binaries
#######################################
@ -129,39 +123,62 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_FULL_LL_DRIVER \
-DUSE_HAL_DRIVER \
-DSTM32F407xx
COMMON_DEFS = \
-DUSE_FULL_LL_DRIVER \
-DUSE_HAL_DRIVER \
-DSTM32F407xx \
-DSTM32F407xx \
-DHAVE_CONFIG \
-D_ENABLE_DIAG
C_DEFS =
CXX_DEFS =
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
COMMON_INCLUDES = \
-IInc \
-IDrivers/STM32F4xx_HAL_Driver/Inc \
-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \
-IDrivers/CMSIS/Include \
-I$(COMPONENTS) \
-I$(PLATFORMS)/stm32f40x_mx \
-Iapplication \
-Iapplication
C_INCLUDES =
CC_INCLUDES =
LIBS =
LIBDIR =
# compile gcc flags
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) $(COMMON_DEFS) $(C_DEFS) $(COMMON_INCLUDES) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CXXFLAGS = $(MCU) $(COMMON_DEFS) $(CXX_DEFS) $(COMMON_INCLUDES) $(CXX_INCLUDES) $(OPT) $(CXXSTD) -Wall -fdata-sections -ffunction-sections
#######################################
# components
#######################################
include $(sort $(wildcard $(COMPONENTS)/*/component.mk))
include $(sort $(wildcard $(PLATFORMS)/$(PLATFORM)/component.mk))
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
CXXFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
CXXFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
#######################################
@ -171,22 +188,35 @@ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
LDSCRIPT = STM32F407VETx_FLASH.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
#LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
LDFLAGS = $(MCU) -TSTM32F407VETX_FLASH.ld --specs=nosys.specs -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -static --specs=nano.specs \
-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group $(LIBDIR) $(LIBS)
ifeq ($(MKDBG), 1)
$(info >>--------------------------------------------)
$(info $$C_SOURCES is [${C_SOURCES}])
$(info .)
$(info )
$(info $$CXX_SOURCES is [${CXX_SOURCES}])
$(info .)
$(info )
$(info $$COMMON_DEFS is [${COMMON_DEFS}])
$(info )
$(info $$C_DEFS is [${C_DEFS}])
$(info .)
$(info )
$(info $$CXX_DEFS is [${CXX_DEFS}])
$(info )
$(info $$COMMON_INCLUDES is [${COMMON_INCLUDES}])
$(info )
$(info $$C_INCLUDES is [${C_INCLUDES}])
$(info )
$(info $$CXX_INCLUDES is [${CXX_INCLUDES}])
$(info )
$(info $$CFLAGS is [${CFLAGS}])
$(info )
$(info $$CXXFLAGS is [${CXXFLAGS}])
$(info )
$(info $$LIBDIR is [${LIBDIR}])
$(info )
$(info $$LIBS is [${LIBS}])
$(info <<--------------------------------------------)
endif