From 2d96b69e385e22efc697d9523ed76b0cf610f7ef Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 5 Jul 2023 00:27:12 -0400 Subject: [PATCH] only:a bit more of AT32 --- firmware/config/boards/at_start_f435/board.mk | 2 ++ .../hw_layer/ports/stm32/stm32f4/hw_ports.mk | 26 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/firmware/config/boards/at_start_f435/board.mk b/firmware/config/boards/at_start_f435/board.mk index 6bc9297672..86a6b9b6ba 100644 --- a/firmware/config/boards/at_start_f435/board.mk +++ b/firmware/config/boards/at_start_f435/board.mk @@ -13,3 +13,5 @@ CONFDIR = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/cfg DDEFS += -DFIRMWARE_ID=\"at_start_f435\" DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS DDEFS += -DSHORT_BOARD_NAME=at_start_f435 + +DDEFS += -DEFI_BACKUP_SRAM=FALSE diff --git a/firmware/hw_layer/ports/stm32/stm32f4/hw_ports.mk b/firmware/hw_layer/ports/stm32/stm32f4/hw_ports.mk index 391fcc5ba2..6dbe12363d 100644 --- a/firmware/hw_layer/ports/stm32/stm32f4/hw_ports.mk +++ b/firmware/hw_layer/ports/stm32/stm32f4/hw_ports.mk @@ -1,6 +1,4 @@ -include $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_common.mk - -HW_LAYER_PORT += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/stm32f4xx_hal_flash.c \ +HW_LAYER_PORT = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/stm32f4xx_hal_flash.c \ $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/stm32f4xx_hal_flash_ex.c HW_LAYER_PORT_CPP += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/mpu_util.cpp \ @@ -9,17 +7,35 @@ HW_LAYER_PORT_CPP += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/mpu_util.cpp \ MCU = cortex-m4 LDSCRIPT = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/STM32F4.ld # kludge: while we the very generic ChibiOS board.c we use our custom board.h from current folder! -ALLCSRC += $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c -CONFDIR = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/cfg +ifeq ($(BOARD_C),) + BOARD_C = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c +endif +ALLCSRC += $(BOARD_C) + +ifeq ($(CONFDIR),) + CONFDIR = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/cfg +endif # STM32F42x has extra memory, so change some flags so we can use it. ifeq ($(IS_STM32F429),yes) USE_OPT += -Wl,--defsym=STM32F4_HAS_SRAM3=1 DDEFS += -DSTM32F429xx DDEFS += -DEFI_IS_F42x +else ifeq ($(IS_AT32F435),yes) + # STM32 flash driver is not compatible + DDEFS += -DAT32F4XX + HW_LAYER_PORT = + # TODO: Artery + HW_LAYER_PORT_CPP = $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/mpu_util.cpp \ + $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_adc_v2.cpp + # TODO: Arterys + LDSCRIPT = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/AT32F435ZMxx.ld else DDEFS += -DSTM32F407xx endif +# Now add common stm32 stuff +include $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_common.mk + # TODO: remove, for efifeatures.h ALLINC += $(PROJECT_DIR)/config/stm32f4ems