Skip to content

Commit

Permalink
Preparing for multi-board support
Browse files Browse the repository at this point in the history
  • Loading branch information
lains committed Jan 28, 2024
1 parent bd59b73 commit 5c0f382
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ INC_DIR = $(TOPDIR)/inc
TEST_SUBDIR = test
TEST_DIR = $(TOPDIR)/$(TEST_SUBDIR)

TARGET_BOARD?=STM32F469I_DISCO

# Path to the STM32 codebase, make sure to fetch submodules to populate this directory
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
VENDOR_ROOT = $(TOPDIR)/bsp/STM32CubeF4
HAL_DRIVER_DIR=$(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver
HAL_DRIVER_PREFIX=stm32f4xx
endif

# Path to the ticdecodecpp library, make sure to fetch submodules to populate this directory
TICDECODECPP = $(TOPDIR)/ticdecodecpp
Expand All @@ -49,7 +55,9 @@ SRC_BUILD_PREFIX = build
# Own project sources
PROJECT_SRC_FILES = $(shell find $(SRC_DIR)/ -name '*.c' -o -name '*.cpp')
PROJECT_ASM_FILES = $(shell find $(SRC_DIR)/ -name '*.s')
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
LDSCRIPT = $(SRC_DIR)/device/STM32F469NIHx_FLASH.ld
endif

# Project includes
PROJECT_INCLUDE_DIRS = $(INC_DIR)
Expand All @@ -61,29 +69,31 @@ PROJECT_INCLUDE_DIRS += $(TICDECODECPP)/include
# but we direclty use provided source files whenever possible.
BSP_ASM_FILES += $(VENDOR_ROOT)/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f469xx.s
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c
#BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c
#BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dsi.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc_ex.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_ll_fmc.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_i2c.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_cortex.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_dma.c
#BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_exti.c
#BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_flash.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_gpio.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_pwr.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_pwr_ex.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_rcc.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_rcc_ex.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_uart.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_dsi.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_dma2d.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_ltdc.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_ltdc_ex.c
BSP_SRC_FILES += $(HAL_DRIVER_DIR)/Src/$(HAL_DRIVER_PREFIX)_hal_sdram.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/Components/nt35510/nt35510.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/Components/otm8009a/otm8009a.c
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery_sdram.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery_lcd.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery_qspi.c
endif

#libticdecodecpp related source files
PROJECT_SRC_FILES += $(TICDECODECPP)/src/TIC/Unframer.cpp
Expand All @@ -92,9 +102,13 @@ PROJECT_SRC_FILES += $(TICDECODECPP)/src/TIC/DatasetView.cpp

# Vendor includes
BSP_INCLUDE_DIRS += $(VENDOR_ROOT)/Drivers/CMSIS/Core/Include
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
BSP_INCLUDE_DIRS += $(VENDOR_ROOT)/Drivers/CMSIS/Device/ST/STM32F4xx/Include
BSP_INCLUDE_DIRS += $(VENDOR_ROOT)/Drivers/STM32F4xx_HAL_Driver/Inc
endif
BSP_INCLUDE_DIRS += $(HAL_DRIVER_DIR)/Inc
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
BSP_INCLUDE_DIRS += $(VENDOR_ROOT)/Drivers/BSP/STM32469I-Discovery
endif
INCLUDE_DIRS_TO_SIMPLIFY = $(PROJECT_INCLUDE_DIRS) $(BSP_INCLUDE_DIRS)
INCLUDE_DIRS_SIMPLIFIED = $(shell realpath --relative-to $(TOPDIR) $(INCLUDE_DIRS_TO_SIMPLIFY))
INCLUDES += $(INCLUDE_DIRS_SIMPLIFIED:%=-I%)
Expand All @@ -103,7 +117,9 @@ INCLUDES += $(INCLUDE_DIRS_SIMPLIFIED:%=-I%)
CXXFLAGS = -g -O0 -Wall -Wextra -Warray-bounds -Wno-unused-parameter -fno-exceptions
CXXFLAGS += -mcpu=cortex-m7 -mthumb -mlittle-endian -mthumb-interwork
CXXFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ifeq ($(TARGET_BOARD),STM32F469I_DISCO)
CXXFLAGS += -DSTM32F469xx -DUSE_STM32469I_DISCOVERY -DUSE_STM32469I_DISCO_REVB -DUSE_HAL_DRIVER # Board specific defines
endif
CXXFLAGS += $(INCLUDES)

# Linker Flags
Expand Down

0 comments on commit 5c0f382

Please sign in to comment.