From b46632ba07d5e3827029413f69618f41f987f452 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 19 Mar 2023 13:11:41 +0700 Subject: [PATCH] bsp for f2 f3 --- .github/workflows/build_arm.yml | 7 ++- .../stm32f207nucleo/STM32F207ZGTx_FLASH.ld | 0 .../stm32f2/boards/stm32f207nucleo/board.mk | 14 ++++++ .../boards}/stm32f207nucleo/stm32f207nucleo.c | 2 +- .../board.mk => stm32f2/family.mk} | 23 +++------ .../stm32f2xx_hal_conf.h | 0 .../stm32f303disco/STM32F303VCTx_FLASH.ld | 0 hw/bsp/stm32f3/boards/stm32f303disco/board.mk | 14 ++++++ .../boards}/stm32f303disco/stm32f303disco.c | 0 .../stm32f303disco/stm32f3xx_hal_conf.h | 0 hw/bsp/stm32f303disco/board.mk | 49 ------------------- 11 files changed, 40 insertions(+), 69 deletions(-) rename hw/bsp/{ => stm32f2/boards}/stm32f207nucleo/STM32F207ZGTx_FLASH.ld (100%) create mode 100644 hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk rename hw/bsp/{ => stm32f2/boards}/stm32f207nucleo/stm32f207nucleo.c (99%) rename hw/bsp/{stm32f207nucleo/board.mk => stm32f2/family.mk} (68%) rename hw/bsp/{stm32f207nucleo => stm32f2}/stm32f2xx_hal_conf.h (100%) rename hw/bsp/{ => stm32f3/boards}/stm32f303disco/STM32F303VCTx_FLASH.ld (100%) create mode 100644 hw/bsp/stm32f3/boards/stm32f303disco/board.mk rename hw/bsp/{ => stm32f3/boards}/stm32f303disco/stm32f303disco.c (100%) rename hw/bsp/{ => stm32f3/boards}/stm32f303disco/stm32f3xx_hal_conf.h (100%) delete mode 100644 hw/bsp/stm32f303disco/board.mk diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml index 8a3181440..2f72e758a 100644 --- a/.github/workflows/build_arm.yml +++ b/.github/workflows/build_arm.yml @@ -41,11 +41,10 @@ jobs: - 'nrf' - 'ra' - 'rp2040' - - 'samd11 same5x' - - 'samd21' - - 'samd51' + - 'samd11 samd21' + - 'samd51 same5x' - 'saml2x' - - 'stm32f0 stm32f1' + - 'stm32f0 stm32f1 stm32f2 stm32f3' - 'stm32f4' - 'stm32f7' - 'stm32g4 stm32h7' diff --git a/hw/bsp/stm32f207nucleo/STM32F207ZGTx_FLASH.ld b/hw/bsp/stm32f2/boards/stm32f207nucleo/STM32F207ZGTx_FLASH.ld similarity index 100% rename from hw/bsp/stm32f207nucleo/STM32F207ZGTx_FLASH.ld rename to hw/bsp/stm32f2/boards/stm32f207nucleo/STM32F207ZGTx_FLASH.ld diff --git a/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk b/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk new file mode 100644 index 000000000..ba185d199 --- /dev/null +++ b/hw/bsp/stm32f2/boards/stm32f207nucleo/board.mk @@ -0,0 +1,14 @@ +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 + +# flash target using on-board stlink +flash: flash-stlink diff --git a/hw/bsp/stm32f207nucleo/stm32f207nucleo.c b/hw/bsp/stm32f2/boards/stm32f207nucleo/stm32f207nucleo.c similarity index 99% rename from hw/bsp/stm32f207nucleo/stm32f207nucleo.c rename to hw/bsp/stm32f2/boards/stm32f207nucleo/stm32f207nucleo.c index 80f762c93..48203b787 100644 --- a/hw/bsp/stm32f207nucleo/stm32f207nucleo.c +++ b/hw/bsp/stm32f2/boards/stm32f207nucleo/stm32f207nucleo.c @@ -24,7 +24,7 @@ * This file is part of the TinyUSB stack. */ -#include "../board.h" +#include "bsp/board.h" #include "stm32f2xx_hal.h" diff --git a/hw/bsp/stm32f207nucleo/board.mk b/hw/bsp/stm32f2/family.mk similarity index 68% rename from hw/bsp/stm32f207nucleo/board.mk rename to hw/bsp/stm32f2/family.mk index 55581e1ec..7ca378548 100644 --- a/hw/bsp/stm32f207nucleo/board.mk +++ b/hw/bsp/stm32f2/family.mk @@ -1,9 +1,15 @@ ST_FAMILY = f2 -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 +DEPS_SUBMODULES += \ + lib/CMSIS_5 \ + $(ST_CMSIS) \ + $(ST_HAL_DRIVER) + +include $(TOP)/$(BOARD_PATH)/board.mk + CFLAGS += \ -flto \ -mthumb \ @@ -11,15 +17,11 @@ CFLAGS += \ -mcpu=cortex-m3 \ -mfloat-abi=soft \ -nostdlib -nostartfiles \ - -DSTM32F207xx \ -DCFG_TUSB_MCU=OPT_MCU_STM32F2 # mcu driver cause following warnings CFLAGS += -Wno-error=sign-compare -# All source paths should be relative to the top level. -LD_FILE = hw/bsp/$(BOARD)/STM32F207ZGTx_FLASH.ld - SRC_C += \ src/portable/synopsys/dwc2/dcd_dwc2.c \ $(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \ @@ -29,20 +31,11 @@ SRC_C += \ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c -SRC_S += \ - $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f207xx.s - INC += \ $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ $(TOP)/$(ST_CMSIS)/Include \ $(TOP)/$(ST_HAL_DRIVER)/Inc \ - $(TOP)/hw/bsp/$(BOARD) + $(TOP)/$(BOARD_PATH) # For freeRTOS port source FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM3 - -# For flash-jlink target -JLINK_DEVICE = stm32f207zg - -# flash target using on-board stlink -flash: flash-stlink diff --git a/hw/bsp/stm32f207nucleo/stm32f2xx_hal_conf.h b/hw/bsp/stm32f2/stm32f2xx_hal_conf.h similarity index 100% rename from hw/bsp/stm32f207nucleo/stm32f2xx_hal_conf.h rename to hw/bsp/stm32f2/stm32f2xx_hal_conf.h diff --git a/hw/bsp/stm32f303disco/STM32F303VCTx_FLASH.ld b/hw/bsp/stm32f3/boards/stm32f303disco/STM32F303VCTx_FLASH.ld similarity index 100% rename from hw/bsp/stm32f303disco/STM32F303VCTx_FLASH.ld rename to hw/bsp/stm32f3/boards/stm32f303disco/STM32F303VCTx_FLASH.ld diff --git a/hw/bsp/stm32f3/boards/stm32f303disco/board.mk b/hw/bsp/stm32f3/boards/stm32f303disco/board.mk new file mode 100644 index 000000000..e387f2d54 --- /dev/null +++ b/hw/bsp/stm32f3/boards/stm32f303disco/board.mk @@ -0,0 +1,14 @@ +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 + +# flash target using on-board stlink +flash: flash-stlink diff --git a/hw/bsp/stm32f303disco/stm32f303disco.c b/hw/bsp/stm32f3/boards/stm32f303disco/stm32f303disco.c similarity index 100% rename from hw/bsp/stm32f303disco/stm32f303disco.c rename to hw/bsp/stm32f3/boards/stm32f303disco/stm32f303disco.c diff --git a/hw/bsp/stm32f303disco/stm32f3xx_hal_conf.h b/hw/bsp/stm32f3/boards/stm32f303disco/stm32f3xx_hal_conf.h similarity index 100% rename from hw/bsp/stm32f303disco/stm32f3xx_hal_conf.h rename to hw/bsp/stm32f3/boards/stm32f303disco/stm32f3xx_hal_conf.h diff --git a/hw/bsp/stm32f303disco/board.mk b/hw/bsp/stm32f303disco/board.mk deleted file mode 100644 index b81de4ee4..000000000 --- a/hw/bsp/stm32f303disco/board.mk +++ /dev/null @@ -1,49 +0,0 @@ -ST_FAMILY = f3 -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 - -CFLAGS += \ - -flto \ - -mthumb \ - -mabi=aapcs \ - -mcpu=cortex-m4 \ - -mfloat-abi=hard \ - -mfpu=fpv4-sp-d16 \ - -nostdlib -nostartfiles \ - -DSTM32F303xC \ - -DCFG_TUSB_MCU=OPT_MCU_STM32F3 - -# mcu driver cause following warnings -CFLAGS += -Wno-error=unused-parameter - -# All source paths should be relative to the top level. -LD_FILE = hw/bsp/$(BOARD)/STM32F303VCTx_FLASH.ld - -SRC_C += \ - src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \ - $(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \ - $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \ - $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \ - $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \ - $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \ - $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c - -SRC_S += \ - $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f303xc.s - -INC += \ - $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ - $(TOP)/$(ST_CMSIS)/Include \ - $(TOP)/$(ST_HAL_DRIVER)/Inc \ - $(TOP)/hw/bsp/$(BOARD) - -# For freeRTOS port source -FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM4F - -# For flash-jlink target -JLINK_DEVICE = stm32f303vc - -# flash target using on-board stlink -flash: flash-stlink