summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-03-16 15:15:23 +0700
committerhathach <[email protected]>2026-03-16 15:15:23 +0700
commit3da88d755dd0438570f254a43eea18b84fc1bb83 (patch)
treec9afc8670ccfd8a5fae3a92a3bd315016917d3fe
parentc1cf1ecef232cdab103390b59c8d17e11bd36505 (diff)
add stm32u083nucleo board
-rw-r--r--hw/bsp/stm32u0/boards/stm32u083cdk/board.cmake3
-rw-r--r--hw/bsp/stm32u0/boards/stm32u083cdk/board.h9
-rw-r--r--hw/bsp/stm32u0/boards/stm32u083cdk/board.mk4
-rw-r--r--hw/bsp/stm32u0/boards/stm32u083nucleo/cubemx/cubemx.ioc185
-rw-r--r--hw/bsp/stm32u0/family.c5
-rw-r--r--hw/bsp/stm32u0/family.mk2
-rw-r--r--hw/bsp/stm32u0/linker/STM32U083xx_FLASH.ld (renamed from hw/bsp/stm32u0/boards/stm32u083cdk/STM32U083MCTx_FLASH.ld)2
-rw-r--r--hw/bsp/stm32u0/linker/stm32u083xx_flash.icf (renamed from hw/bsp/stm32u0/boards/stm32u083cdk/stm32u083xx_flash.icf)0
8 files changed, 196 insertions, 14 deletions
diff --git a/hw/bsp/stm32u0/boards/stm32u083cdk/board.cmake b/hw/bsp/stm32u0/boards/stm32u083cdk/board.cmake
index 945146810..e00e681d8 100644
--- a/hw/bsp/stm32u0/boards/stm32u083cdk/board.cmake
+++ b/hw/bsp/stm32u0/boards/stm32u083cdk/board.cmake
@@ -1,9 +1,6 @@
set(MCU_VARIANT stm32u083xx)
set(JLINK_DEVICE stm32u083mc)
-set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/STM32U083MCTx_FLASH.ld)
-set(LD_FILE_IAR ${CMAKE_CURRENT_LIST_DIR}/stm32u083xx_flash.icf)
-
function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
STM32U083xx
diff --git a/hw/bsp/stm32u0/boards/stm32u083cdk/board.h b/hw/bsp/stm32u0/boards/stm32u083cdk/board.h
index 3030b1a1d..278d9b695 100644
--- a/hw/bsp/stm32u0/boards/stm32u083cdk/board.h
+++ b/hw/bsp/stm32u0/boards/stm32u083cdk/board.h
@@ -57,8 +57,7 @@
//--------------------------------------------------------------------+
// RCC Clock
//--------------------------------------------------------------------+
-static inline void board_stm32u0_clock_init(void)
-{
+static inline void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_CRSInitTypeDef RCC_CRSInitStruct = {0};
@@ -78,10 +77,10 @@ static inline void board_stm32u0_clock_init(void)
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
- RCC_OscInitStruct.PLL.PLLN = 8;
+ RCC_OscInitStruct.PLL.PLLN = 7;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
- RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
- RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV4;
+ RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV4;
+ RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
/** Initializes the CPU, AHB and APB buses clocks
diff --git a/hw/bsp/stm32u0/boards/stm32u083cdk/board.mk b/hw/bsp/stm32u0/boards/stm32u083cdk/board.mk
index 892854f54..09216440b 100644
--- a/hw/bsp/stm32u0/boards/stm32u083cdk/board.mk
+++ b/hw/bsp/stm32u0/boards/stm32u083cdk/board.mk
@@ -2,10 +2,6 @@ MCU_VARIANT = stm32u083xx
CFLAGS += \
-DSTM32U083xx
-# All source paths should be relative to the top level.
-LD_FILE = $(BOARD_PATH)/STM32U083MCTx_FLASH.ld
-LD_FILE_IAR = $(BOARD_PATH)/stm32u083xx_flash.icf
-
# For flash-jlink target
JLINK_DEVICE = STM32U083MC
diff --git a/hw/bsp/stm32u0/boards/stm32u083nucleo/cubemx/cubemx.ioc b/hw/bsp/stm32u0/boards/stm32u083nucleo/cubemx/cubemx.ioc
new file mode 100644
index 000000000..5e40247b2
--- /dev/null
+++ b/hw/bsp/stm32u0/boards/stm32u083nucleo/cubemx/cubemx.ioc
@@ -0,0 +1,185 @@
+#MicroXplorer Configuration settings - do not modify
+BSP_IP_NAME=NUCLEO-U083RC
+CAD.formats=[]
+CAD.pinconfig=Dual
+CAD.provider=
+File.Version=6
+GPIO.groupedBy=
+KeepUserPlacement=false
+Mcu.CPN=STM32U083RCT6
+Mcu.Family=STM32U0
+Mcu.IP0=CORTEX_M0+
+Mcu.IP1=NVIC
+Mcu.IP2=PWR
+Mcu.IP3=RCC
+Mcu.IP4=SYS
+Mcu.IP5=USART2
+Mcu.IP6=USB
+Mcu.IP7=NUCLEO-U083RC
+Mcu.IPNb=8
+Mcu.Name=STM32U083RCTx
+Mcu.Package=LQFP64
+Mcu.Pin0=PC14-OSC32_IN
+Mcu.Pin1=PC15-OSC32_OUT
+Mcu.Pin10=VP_PWR_VS_SECSignals
+Mcu.Pin11=VP_SYS_VS_Systick
+Mcu.Pin2=PF0-OSC_IN
+Mcu.Pin3=PF1-OSC_OUT
+Mcu.Pin4=PA2
+Mcu.Pin5=PA3
+Mcu.Pin6=PA11 [PA9]
+Mcu.Pin7=PA12 [PA10]
+Mcu.Pin8=PA13 (SWDIO)
+Mcu.Pin9=PA14 (SWCLK)
+Mcu.PinsNb=12
+Mcu.ThirdPartyNb=0
+Mcu.UserConstants=
+Mcu.UserName=STM32U083RCTx
+MxCube.Version=6.17.0
+MxDb.Version=DB.6.0.170
+NVIC.ForceEnableDMAVector=true
+NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
+NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
+NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
+NVIC.PriorityGroup=NVIC_PRIORITYGROUP_2
+NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
+NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:true\:false\:true\:false
+PA11\ [PA9].Mode=Device
+PA11\ [PA9].Signal=USB_DM
+PA12\ [PA10].Mode=Device
+PA12\ [PA10].Signal=USB_DP
+PA13\ (SWDIO).GPIOParameters=GPIO_Label
+PA13\ (SWDIO).GPIO_Label=SWDIO
+PA13\ (SWDIO).Locked=true
+PA13\ (SWDIO).Signal=DEBUG_JTMS-SWDIO
+PA14\ (SWCLK).GPIOParameters=GPIO_Label
+PA14\ (SWCLK).GPIO_Label=SWCLK
+PA14\ (SWCLK).Locked=true
+PA14\ (SWCLK).Signal=DEBUG_JTCK-SWCLK
+PA2.GPIOParameters=GPIO_ModeDefaultPP,GPIO_Speed,GPIO_PuPd
+PA2.GPIO_ModeDefaultPP=GPIO_MODE_AF_PP
+PA2.GPIO_PuPd=GPIO_NOPULL
+PA2.GPIO_Speed=GPIO_SPEED_FREQ_LOW
+PA2.Locked=true
+PA2.Mode=Asynchronous
+PA2.Signal=USART2_TX
+PA3.GPIOParameters=GPIO_ModeDefaultPP,GPIO_Speed,GPIO_PuPd
+PA3.GPIO_ModeDefaultPP=GPIO_MODE_AF_PP
+PA3.GPIO_PuPd=GPIO_NOPULL
+PA3.GPIO_Speed=GPIO_SPEED_FREQ_LOW
+PA3.Locked=true
+PA3.Mode=Asynchronous
+PA3.Signal=USART2_RX
+PC14-OSC32_IN.GPIOParameters=GPIO_Label
+PC14-OSC32_IN.GPIO_Label=OSC32_IN
+PC14-OSC32_IN.Locked=true
+PC14-OSC32_IN.Mode=LSE-External-Oscillator-for-RTC
+PC14-OSC32_IN.Signal=RCC_OSC32_IN
+PC15-OSC32_OUT.GPIOParameters=GPIO_Label
+PC15-OSC32_OUT.GPIO_Label=OSC32_OUT
+PC15-OSC32_OUT.Locked=true
+PC15-OSC32_OUT.Mode=LSE-External-Oscillator-for-RTC
+PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
+PCC.Checker=false
+PCC.Display=Plot\: All Steps
+PCC.Line=STM32U0x3
+PCC.MCU=STM32U083RCTx
+PCC.PartNumber=STM32U083RCTx
+PCC.Series=STM32U0
+PCC.Temperature=25
+PCC.Vdd=3.0
+PF0-OSC_IN.GPIOParameters=GPIO_Label
+PF0-OSC_IN.GPIO_Label=OSC_IN
+PF0-OSC_IN.Locked=true
+PF0-OSC_IN.Signal=RCC_OSC_IN
+PF1-OSC_OUT.GPIOParameters=GPIO_Label
+PF1-OSC_OUT.GPIO_Label=OSC_OUT
+PF1-OSC_OUT.Locked=true
+PF1-OSC_OUT.Signal=RCC_OSC_OUT
+PinOutPanel.RotationAngle=0
+ProjectManager.AskForMigrate=true
+ProjectManager.BackupPrevious=false
+ProjectManager.CompilerLinker=GCC
+ProjectManager.CompilerOptimize=6
+ProjectManager.ComputerToolchain=false
+ProjectManager.CoupleFile=false
+ProjectManager.CustomerFirmwarePackage=
+ProjectManager.DefaultFWLocation=true
+ProjectManager.DeletePrevious=true
+ProjectManager.DeviceId=STM32U083RCTx
+ProjectManager.FirmwarePackage=STM32Cube FW_U0 V1.3.0
+ProjectManager.FreePins=false
+ProjectManager.FreePinsContext=
+ProjectManager.HalAssertFull=false
+ProjectManager.HeapSize=0x200
+ProjectManager.KeepUserCode=true
+ProjectManager.LastFirmware=true
+ProjectManager.LibraryCopy=2
+ProjectManager.MainLocation=Core/Src
+ProjectManager.NoMain=false
+ProjectManager.PreviousToolchain=
+ProjectManager.ProjectBuild=false
+ProjectManager.ProjectFileName=cubemx.ioc
+ProjectManager.ProjectName=cubemx
+ProjectManager.ProjectStructure=
+ProjectManager.RegisterCallBack=
+ProjectManager.StackSize=0x400
+ProjectManager.TargetToolchain=CMake
+ProjectManager.ToolChainLocation=
+ProjectManager.UAScriptAfterPath=
+ProjectManager.UAScriptBeforePath=
+ProjectManager.UnderRoot=false
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USB_PCD_Init-USB-false-HAL-true,0-MX_CORTEX_M0+_Init-CORTEX_M0+-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
+RCC.ADCFreq_Value=56000000
+RCC.AHBFreq_Value=56000000
+RCC.APBFreq_Value=56000000
+RCC.APBTimFreq_Value=56000000
+RCC.CortexFreq_Value=56000000
+RCC.FCLKCortexFreq_Value=56000000
+RCC.FamilyName=M
+RCC.HCLKFreq_Value=56000000
+RCC.HSE_VALUE=4000000
+RCC.HSI48_VALUE=48000000
+RCC.HSI_VALUE=16000000
+RCC.I2C1Freq_Value=56000000
+RCC.I2C3Freq_Value=56000000
+RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APBFreq_Value,APBTimFreq_Value,CortexFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C3Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM3Freq_Value,LPUART1Freq_Value,LPUART2Freq_Value,LPUART3Freq_Value,LSCOPinFreq_Value,LSI_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,MSIClockRangeVal,MSI_VALUE,PLLN,PLLPoutputFreq_Value,PLLQ,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PWRFreq_Value,RNGFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TIM15Freq_Value,TIM1Freq_Value,USART1Freq_Value,USART2Freq_Value,USBCLockSelection,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value
+RCC.LPTIM1Freq_Value=56000000
+RCC.LPTIM2Freq_Value=56000000
+RCC.LPTIM3Freq_Value=56000000
+RCC.LPUART1Freq_Value=56000000
+RCC.LPUART2Freq_Value=56000000
+RCC.LPUART3Freq_Value=56000000
+RCC.LSCOPinFreq_Value=32000
+RCC.LSI_VALUE=32000
+RCC.MCO1PinFreq_Value=56000000
+RCC.MCO2PinFreq_Value=56000000
+RCC.MSIClockRangeVal=RCC_MSIRANGE_11
+RCC.MSI_VALUE=48000000
+RCC.PLLN=7
+RCC.PLLPoutputFreq_Value=56000000
+RCC.PLLQ=RCC_PLLQ_DIV4
+RCC.PLLQoutputFreq_Value=28000000
+RCC.PLLRCLKFreq_Value=56000000
+RCC.PWRFreq_Value=56000000
+RCC.RNGFreq_Value=48000000
+RCC.SYSCLKFreq_VALUE=56000000
+RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
+RCC.TIM15Freq_Value=56000000
+RCC.TIM1Freq_Value=56000000
+RCC.USART1Freq_Value=56000000
+RCC.USART2Freq_Value=56000000
+RCC.USBCLockSelection=RCC_USBCLKSOURCE_HSI48
+RCC.USBFreq_Value=48000000
+RCC.VCOInputFreq_Value=16000000
+RCC.VCOOutputFreq_Value=112000000
+USART2.IPParameters=VirtualMode-Asynchronous
+USART2.VirtualMode-Asynchronous=VM_ASYNC
+USB.IPParameters=VirtualMode
+USB.VirtualMode=Device_Only
+VP_PWR_VS_SECSignals.Mode=Security/Privilege
+VP_PWR_VS_SECSignals.Signal=PWR_VS_SECSignals
+VP_SYS_VS_Systick.Mode=SysTick
+VP_SYS_VS_Systick.Signal=SYS_VS_Systick
+board=NUCLEO-U083RC
+boardIOC=true
diff --git a/hw/bsp/stm32u0/family.c b/hw/bsp/stm32u0/family.c
index 0f91d1f30..af39ae398 100644
--- a/hw/bsp/stm32u0/family.c
+++ b/hw/bsp/stm32u0/family.c
@@ -30,6 +30,9 @@
#include "stm32u0xx_hal.h"
#include "bsp/board_api.h"
+
+TU_ATTR_UNUSED static void Error_Handler(void) { }
+
#include "board.h"
//--------------------------------------------------------------------+
@@ -47,7 +50,7 @@ UART_HandleTypeDef UartHandle;
#endif
void board_init(void) {
- board_stm32u0_clock_init();
+ SystemClock_Config();
// Enable All GPIOs clocks
__HAL_RCC_GPIOA_CLK_ENABLE();
diff --git a/hw/bsp/stm32u0/family.mk b/hw/bsp/stm32u0/family.mk
index 5f25906d3..241323f62 100644
--- a/hw/bsp/stm32u0/family.mk
+++ b/hw/bsp/stm32u0/family.mk
@@ -48,4 +48,6 @@ 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
+MCU_VARIANT_UPPER = $(subst stm32u,STM32U,$(MCU_VARIANT))
+LD_FILE ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT_UPPER)_FLASH.ld
LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf
diff --git a/hw/bsp/stm32u0/boards/stm32u083cdk/STM32U083MCTx_FLASH.ld b/hw/bsp/stm32u0/linker/STM32U083xx_FLASH.ld
index c5ea72fb0..410d247a1 100644
--- a/hw/bsp/stm32u0/boards/stm32u083cdk/STM32U083MCTx_FLASH.ld
+++ b/hw/bsp/stm32u0/linker/STM32U083xx_FLASH.ld
@@ -2,7 +2,7 @@
******************************************************************************
* @file LinkerScript.ld
* @author Auto-generated by STM32CubeIDE
- * @brief Linker script for STM32U083MCTx Device from STM32U0 series
+ * @brief Linker script for STM32U083xx Device from STM32U0 series
* 256KBytes FLASH
* 40KBytes RAM
*
diff --git a/hw/bsp/stm32u0/boards/stm32u083cdk/stm32u083xx_flash.icf b/hw/bsp/stm32u0/linker/stm32u083xx_flash.icf
index cfaa305af..cfaa305af 100644
--- a/hw/bsp/stm32u0/boards/stm32u083cdk/stm32u083xx_flash.icf
+++ b/hw/bsp/stm32u0/linker/stm32u083xx_flash.icf