summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-04-17 15:15:07 +0700
committerhathach <[email protected]>2025-04-17 15:15:07 +0700
commit9eb0ae7636d816545696575837c3bcb4a93029d4 (patch)
tree0e5f9d81f820d771e431a4b3b837e912f46a3869 /hw
parentb1eedf4d1d95d6e8c7de425080a107a33cbf0e5d (diff)
fix iar make build with stm32 l0, f2, f3, u5, wb
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk7
-rw-r--r--hw/bsp/stm32f2/family.mk13
-rw-r--r--hw/bsp/stm32f3/boards/stm32f303disco/board.mk4
-rw-r--r--hw/bsp/stm32f3/family.mk18
-rw-r--r--hw/bsp/stm32l0/boards/stm32l052dap52/board.mk3
-rw-r--r--hw/bsp/stm32l0/boards/stm32l0538disco/board.mk4
-rw-r--r--hw/bsp/stm32l0/family.mk19
7 files changed, 33 insertions, 35 deletions
diff --git a/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk b/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk
index ba185d199..6e681ef57 100644
--- a/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk
+++ b/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk
@@ -1,12 +1,9 @@
-CFLAGS += \
- -DSTM32F207xx \
+MCU_VARIANT = stm32f207xx
+CFLAGS += -DSTM32F207xx
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32F207ZGTx_FLASH.ld
-SRC_S += \
- $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f207xx.s
-
# For flash-jlink target
JLINK_DEVICE = stm32f207zg
diff --git a/hw/bsp/stm32f2/family.mk b/hw/bsp/stm32f2/family.mk
index 7af9a76a0..e8f02548d 100644
--- a/hw/bsp/stm32f2/family.mk
+++ b/hw/bsp/stm32f2/family.mk
@@ -1,5 +1,4 @@
ST_FAMILY = f2
-
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
@@ -14,11 +13,10 @@ CPU_CORE ?= cortex-m3
CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_STM32F2
+# mcu driver cause following warnings
CFLAGS_GCC += \
-flto \
-
-# mcu driver cause following warnings
-CFLAGS_GCC += -Wno-error=sign-compare
+ -Wno-error=sign-compare
LDFLAGS_GCC += \
-nostdlib -nostartfiles \
@@ -40,3 +38,10 @@ INC += \
$(TOP)/$(ST_CMSIS)/Include \
$(TOP)/$(ST_HAL_DRIVER)/Inc \
$(TOP)/$(BOARD_PATH)
+
+# Startup
+SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s
+SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s
+
+# Linker
+LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf
diff --git a/hw/bsp/stm32f3/boards/stm32f303disco/board.mk b/hw/bsp/stm32f3/boards/stm32f303disco/board.mk
index e387f2d54..6b9a3e283 100644
--- a/hw/bsp/stm32f3/boards/stm32f303disco/board.mk
+++ b/hw/bsp/stm32f3/boards/stm32f303disco/board.mk
@@ -1,12 +1,10 @@
+MCU_VARIANT = stm32f303xc
CFLAGS += \
-DSTM32F303xC \
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32F303VCTx_FLASH.ld
-SRC_S += \
- $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f303xc.s
-
# For flash-jlink target
JLINK_DEVICE = stm32f303vc
diff --git a/hw/bsp/stm32f3/family.mk b/hw/bsp/stm32f3/family.mk
index 4fe3aa99d..13734583a 100644
--- a/hw/bsp/stm32f3/family.mk
+++ b/hw/bsp/stm32f3/family.mk
@@ -1,22 +1,17 @@
ST_FAMILY = f3
-
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
-DEPS_SUBMODULES += \
- lib/CMSIS_5 \
- $(ST_CMSIS) \
- $(ST_HAL_DRIVER)
-
include $(TOP)/$(BOARD_PATH)/board.mk
CPU_CORE ?= cortex-m4
CFLAGS += \
- -flto \
-DCFG_TUSB_MCU=OPT_MCU_STM32F3
# mcu driver cause following warnings
-CFLAGS += -Wno-error=unused-parameter
+CFLAGS_GCC += \
+ -flto \
+ -Wno-error=unused-parameter
LDFLAGS_GCC += \
-nostdlib -nostartfiles \
@@ -36,3 +31,10 @@ INC += \
$(TOP)/$(ST_CMSIS)/Include \
$(TOP)/$(ST_HAL_DRIVER)/Inc \
$(TOP)/$(BOARD_PATH)
+
+# Startup
+SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s
+SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s
+
+# Linker
+LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf
diff --git a/hw/bsp/stm32l0/boards/stm32l052dap52/board.mk b/hw/bsp/stm32l0/boards/stm32l052dap52/board.mk
index 0b1348474..e63b41f12 100644
--- a/hw/bsp/stm32l0/boards/stm32l052dap52/board.mk
+++ b/hw/bsp/stm32l0/boards/stm32l052dap52/board.mk
@@ -1,10 +1,9 @@
+MCU_VARIANT = stm32l052xx
CFLAGS += \
-DSTM32L052xx
LD_FILE = $(BOARD_PATH)/STM32L052K8Ux_FLASH.ld
-SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l052xx.s
-
# For flash-jlink target
JLINK_DEVICE = stm32l052k8
diff --git a/hw/bsp/stm32l0/boards/stm32l0538disco/board.mk b/hw/bsp/stm32l0/boards/stm32l0538disco/board.mk
index deed519ba..f3e6978b0 100644
--- a/hw/bsp/stm32l0/boards/stm32l0538disco/board.mk
+++ b/hw/bsp/stm32l0/boards/stm32l0538disco/board.mk
@@ -1,12 +1,10 @@
+MCU_VARIANT = stm32l053xx
CFLAGS += \
-DSTM32L053xx
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32L053C8Tx_FLASH.ld
-SRC_S += \
- $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l053xx.s
-
# For flash-jlink target
JLINK_DEVICE = STM32L053R8
diff --git a/hw/bsp/stm32l0/family.mk b/hw/bsp/stm32l0/family.mk
index fe7561fc2..921b1b413 100644
--- a/hw/bsp/stm32l0/family.mk
+++ b/hw/bsp/stm32l0/family.mk
@@ -1,9 +1,4 @@
ST_FAMILY = l0
-DEPS_SUBMODULES += \
- lib/CMSIS_5 \
- hw/mcu/st/cmsis_device_$(ST_FAMILY) \
- hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
-
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
@@ -11,20 +6,17 @@ include $(TOP)/$(BOARD_PATH)/board.mk
CPU_CORE ?= cortex-m0plus
CFLAGS += \
- -flto \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_EXAMPLE_VIDEO_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32L0
# mcu driver cause following warnings
CFLAGS_GCC += \
+ -flto \
-Wno-error=unused-parameter \
-Wno-error=redundant-decls \
-Wno-error=cast-align \
-
-ifeq ($(TOOLCHAIN),gcc)
-CFLAGS_GCC += -Wno-error=maybe-uninitialized
-endif
+ -Wno-error=maybe-uninitialized \
CFLAGS_CLANG += \
-Wno-error=parentheses-equality
@@ -48,3 +40,10 @@ INC += \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
$(TOP)/$(ST_CMSIS)/Include \
$(TOP)/$(ST_HAL_DRIVER)/Inc
+
+# Startup
+SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_${MCU_VARIANT}.s
+SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_${MCU_VARIANT}.s
+
+# Linker
+LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf