This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7a62d860d4e213f856e872a84d7177c61e1cae7d Author: raiden00pl <[email protected]> AuthorDate: Thu Aug 13 13:39:10 2026 +0200 arch/arm/stm32u5: Move reusable core support to common Move the STM32U5 startup, interrupt, GPIO, EXTI, serial, heap, idle, and timer interrupt implementations into arch/arm/src/common/stm32. This prepares the Cortex-M33 support for reuse by compatible STM32 families. Assisted-by: OpenAI Codex:gpt-5 Signed-off-by: raiden00pl <[email protected]> --- arch/arm/src/common/stm32/CMakeLists.txt | 18 ++++++++++++++++++ arch/arm/src/common/stm32/Make.defs | 14 ++++++++++++++ arch/arm/src/common/stm32/hardware/stm32_exti.h | 11 +++++++---- .../stm32/hardware/stm32_exti_m33_u5.h} | 8 ++++---- arch/arm/src/common/stm32/hardware/stm32_gpio.h | 4 +++- .../stm32/hardware/stm32_gpio_m33_u5.h} | 10 +++++----- arch/arm/src/common/stm32/hardware/stm32_syscfg.h | 4 +++- .../stm32/hardware/stm32_syscfg_m33_u5.h} | 8 ++++---- .../stm32/hardware/stm32_uart_m33_u5.h} | 8 ++++---- .../stm32/stm32_allocateheap_m33_u5.c} | 2 +- .../stm32/stm32_exti_gpio_m33_u5.c} | 2 +- arch/arm/src/common/stm32/stm32_gpio.h | 4 +++- .../stm32_gpio.c => common/stm32/stm32_gpio_m33_u5.c} | 4 ++-- .../stm32_gpio.h => common/stm32/stm32_gpio_m33_u5.h} | 12 ++++++------ .../stm32_idle.c => common/stm32/stm32_idle_m33_u5.c} | 2 +- .../stm32_irq.c => common/stm32/stm32_irq_m33_u5.c} | 2 +- .../stm32/stm32_lowputc_m33_u5.c} | 2 +- arch/arm/src/common/stm32/stm32_rcc.h | 7 +++++++ .../stm32_rcc.h => common/stm32/stm32_rcc_m33_u5.h} | 8 ++++---- .../stm32/stm32_serial_m33_u5.c} | 2 +- .../stm32/stm32_start_m33_u5.c} | 2 +- .../stm32/stm32_timerisr_m33_u5.c} | 2 +- arch/arm/src/common/stm32/stm32_uart.h | 4 +++- .../stm32_uart.h => common/stm32/stm32_uart_m33_u5.h} | 10 +++++----- arch/arm/src/stm32u5/CMakeLists.txt | 14 +------------- arch/arm/src/stm32u5/Make.defs | 10 ++-------- 26 files changed, 103 insertions(+), 71 deletions(-) diff --git a/arch/arm/src/common/stm32/CMakeLists.txt b/arch/arm/src/common/stm32/CMakeLists.txt index c2299ee530a..b6a12caab28 100644 --- a/arch/arm/src/common/stm32/CMakeLists.txt +++ b/arch/arm/src/common/stm32/CMakeLists.txt @@ -34,6 +34,24 @@ set(SRCS) list(APPEND SRCS stm32_waste.c) list(APPEND SRCS stm32_uid.c) +if(CONFIG_ARCH_CHIP_STM32U5) + list( + APPEND + SRCS + stm32_allocateheap_m33_u5.c + stm32_exti_gpio_m33_u5.c + stm32_gpio_m33_u5.c + stm32_irq_m33_u5.c + stm32_lowputc_m33_u5.c + stm32_serial_m33_u5.c + stm32_start_m33_u5.c + stm32_timerisr_m33_u5.c) + + if(NOT CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS stm32_idle_m33_u5.c) + endif() +endif() + if(CONFIG_STM32_PULSECOUNT) list(APPEND SRCS stm32_pulsecount.c) endif() diff --git a/arch/arm/src/common/stm32/Make.defs b/arch/arm/src/common/stm32/Make.defs index 686a84e4d73..ff5e1955864 100644 --- a/arch/arm/src/common/stm32/Make.defs +++ b/arch/arm/src/common/stm32/Make.defs @@ -42,6 +42,20 @@ ARCHXXINCLUDES += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR) CHIP_CSRCS += stm32_waste.c CHIP_CSRCS += stm32_uid.c +ifeq ($(CONFIG_ARCH_CHIP_STM32U5),y) +CHIP_CSRCS += stm32_allocateheap_m33_u5.c +CHIP_CSRCS += stm32_exti_gpio_m33_u5.c +CHIP_CSRCS += stm32_gpio_m33_u5.c +CHIP_CSRCS += stm32_irq_m33_u5.c +CHIP_CSRCS += stm32_lowputc_m33_u5.c +CHIP_CSRCS += stm32_serial_m33_u5.c +CHIP_CSRCS += stm32_start_m33_u5.c +CHIP_CSRCS += stm32_timerisr_m33_u5.c +ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y) +CHIP_CSRCS += stm32_idle_m33_u5.c +endif +endif + ifeq ($(CONFIG_STM32_PULSECOUNT),y) CHIP_CSRCS += stm32_pulsecount.c endif diff --git a/arch/arm/src/common/stm32/hardware/stm32_exti.h b/arch/arm/src/common/stm32/hardware/stm32_exti.h index 8b22f1abf70..1de2e6fad17 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_exti.h +++ b/arch/arm/src/common/stm32/hardware/stm32_exti.h @@ -33,12 +33,15 @@ * version is core-agnostic. */ -#if (defined(CONFIG_STM32_HAVE_IP_EXTI_V1) + \ +#if defined(CONFIG_ARCH_CHIP_STM32U5) + +# include "hardware/stm32_exti_m33_u5.h" + +#elif (defined(CONFIG_STM32_HAVE_IP_EXTI_V1) + \ defined(CONFIG_STM32_HAVE_IP_EXTI_V2)) > 1 # error Only one STM32 EXTI IP version must be selected -#endif - -#if !(defined(CONFIG_STM32_HAVE_IP_EXTI_V1) || defined(CONFIG_STM32_HAVE_IP_EXTI_V2)) +#elif !(defined(CONFIG_STM32_HAVE_IP_EXTI_V1) || \ + defined(CONFIG_STM32_HAVE_IP_EXTI_V2)) # error "Unsupported STM32 EXTI" #elif defined(CONFIG_ARCH_CORTEXM0) # include "hardware/stm32_exti_v1v2_m0.h" diff --git a/arch/arm/src/stm32u5/hardware/stm32_exti.h b/arch/arm/src/common/stm32/hardware/stm32_exti_m33_u5.h similarity index 96% rename from arch/arm/src/stm32u5/hardware/stm32_exti.h rename to arch/arm/src/common/stm32/hardware/stm32_exti_m33_u5.h index 14d231b8599..c40072c64f4 100644 --- a/arch/arm/src/stm32u5/hardware/stm32_exti.h +++ b/arch/arm/src/common/stm32/hardware/stm32_exti_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/hardware/stm32_exti.h + * arch/arm/src/common/stm32/hardware/stm32_exti_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_EXTI_H -#define __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_EXTI_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U5_H /**************************************************************************** * Included Files @@ -118,4 +118,4 @@ #define EXTI2_UCPD1 (1 << 9) /* EXTI line 41: UCPD1 wakeup */ #define EXTI2_LPTIM3 (1 << 10) /* EXTI line 42: LPTIM3 wakeup */ -#endif /* __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_EXTI_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U5_H */ diff --git a/arch/arm/src/common/stm32/hardware/stm32_gpio.h b/arch/arm/src/common/stm32/hardware/stm32_gpio.h index ea028b5b223..8b99ef329d7 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_gpio.h +++ b/arch/arm/src/common/stm32/hardware/stm32_gpio.h @@ -27,7 +27,9 @@ * Included Files ****************************************************************************/ -#if defined(CONFIG_STM32_HAVE_IP_GPIO_M0_V1) +#if defined(CONFIG_ARCH_CHIP_STM32U5) +# include "hardware/stm32_gpio_m33_u5.h" +#elif defined(CONFIG_STM32_HAVE_IP_GPIO_M0_V1) # include "hardware/stm32_gpio_v2_m0.h" #elif defined(CONFIG_STM32_STM32L15XX) # include "hardware/stm32l15xxx_gpio.h" diff --git a/arch/arm/src/stm32u5/hardware/stm32_gpio.h b/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u5.h similarity index 98% rename from arch/arm/src/stm32u5/hardware/stm32_gpio.h rename to arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u5.h index fa36d63cbad..d060d38c174 100644 --- a/arch/arm/src/stm32u5/hardware/stm32_gpio.h +++ b/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/hardware/stm32_gpio.h + * arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,15 +20,15 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_GPIO_H -#define __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_GPIO_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U5_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> -#include <arch/stm32u5/chip.h> +#include <arch/chip/chip.h> /**************************************************************************** * Pre-processor Definitions @@ -386,4 +386,4 @@ #define GPIO_SECCFGR_SET(n) (1 << (n)) -#endif /* __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_GPIO_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U5_H */ diff --git a/arch/arm/src/common/stm32/hardware/stm32_syscfg.h b/arch/arm/src/common/stm32/hardware/stm32_syscfg.h index 5e308fe37f3..d629f5e980c 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_syscfg.h +++ b/arch/arm/src/common/stm32/hardware/stm32_syscfg.h @@ -30,7 +30,9 @@ #include <nuttx/config.h> #include "chip.h" -#if defined(CONFIG_ARCH_CHIP_STM32F0) +#if defined(CONFIG_ARCH_CHIP_STM32U5) +# include "hardware/stm32_syscfg_m33_u5.h" +#elif defined(CONFIG_ARCH_CHIP_STM32F0) # include "hardware/stm32f0_syscfg.h" #elif defined(CONFIG_ARCH_CHIP_STM32L0) # include "hardware/stm32l0_syscfg.h" diff --git a/arch/arm/src/stm32u5/hardware/stm32_syscfg.h b/arch/arm/src/common/stm32/hardware/stm32_syscfg_m33_u5.h similarity index 83% rename from arch/arm/src/stm32u5/hardware/stm32_syscfg.h rename to arch/arm/src/common/stm32/hardware/stm32_syscfg_m33_u5.h index e79236a1fce..fa7f038b7e3 100644 --- a/arch/arm/src/stm32u5/hardware/stm32_syscfg.h +++ b/arch/arm/src/common/stm32/hardware/stm32_syscfg_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/hardware/stm32_syscfg.h + * arch/arm/src/common/stm32/hardware/stm32_syscfg_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_SYSCFG_H -#define __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_SYSCFG_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_SYSCFG_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_SYSCFG_M33_U5_H /**************************************************************************** * Included Files @@ -36,4 +36,4 @@ # error "Unsupported STM32U5 chip" #endif -#endif /* __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_SYSCFG_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_SYSCFG_M33_U5_H */ diff --git a/arch/arm/src/stm32u5/hardware/stm32_uart.h b/arch/arm/src/common/stm32/hardware/stm32_uart_m33_u5.h similarity index 98% rename from arch/arm/src/stm32u5/hardware/stm32_uart.h rename to arch/arm/src/common/stm32/hardware/stm32_uart_m33_u5.h index 3f05eea45d4..5c5c82d44f3 100644 --- a/arch/arm/src/stm32u5/hardware/stm32_uart.h +++ b/arch/arm/src/common/stm32/hardware/stm32_uart_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/hardware/stm32_uart.h + * arch/arm/src/common/stm32/hardware/stm32_uart_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_UART_H -#define __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_UART_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_UART_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_UART_M33_U5_H /**************************************************************************** * Included Files @@ -307,4 +307,4 @@ * Public Data ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_STM32U5_HARDWARE_STM32_UART_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_UART_M33_U5_H */ diff --git a/arch/arm/src/stm32u5/stm32_allocateheap.c b/arch/arm/src/common/stm32/stm32_allocateheap_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_allocateheap.c rename to arch/arm/src/common/stm32/stm32_allocateheap_m33_u5.c index 96785ea2182..6494ccb5828 100644 --- a/arch/arm/src/stm32u5/stm32_allocateheap.c +++ b/arch/arm/src/common/stm32/stm32_allocateheap_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_allocateheap.c + * arch/arm/src/common/stm32/stm32_allocateheap_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/stm32u5/stm32_exti_gpio.c b/arch/arm/src/common/stm32/stm32_exti_gpio_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_exti_gpio.c rename to arch/arm/src/common/stm32/stm32_exti_gpio_m33_u5.c index d9bc149f552..277fcb70949 100644 --- a/arch/arm/src/stm32u5/stm32_exti_gpio.c +++ b/arch/arm/src/common/stm32/stm32_exti_gpio_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_exti_gpio.c + * arch/arm/src/common/stm32/stm32_exti_gpio_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/common/stm32/stm32_gpio.h b/arch/arm/src/common/stm32/stm32_gpio.h index f4910cabef1..3134b4429a0 100644 --- a/arch/arm/src/common/stm32/stm32_gpio.h +++ b/arch/arm/src/common/stm32/stm32_gpio.h @@ -29,7 +29,9 @@ #include <nuttx/config.h> -#if defined(CONFIG_STM32_HAVE_IP_GPIO_M0_V1) +#if defined(CONFIG_ARCH_CHIP_STM32U5) +# include "stm32_gpio_m33_u5.h" +#elif defined(CONFIG_STM32_HAVE_IP_GPIO_M0_V1) # include "stm32_gpio_m0_v1.h" #elif defined(CONFIG_STM32_HAVE_IP_GPIO_M3M4_V1) # include "stm32_gpio_m3m4_v1v2.h" diff --git a/arch/arm/src/stm32u5/stm32_gpio.c b/arch/arm/src/common/stm32/stm32_gpio_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_gpio.c rename to arch/arm/src/common/stm32/stm32_gpio_m33_u5.c index 8a5832de016..fde6b09703f 100644 --- a/arch/arm/src/stm32u5/stm32_gpio.c +++ b/arch/arm/src/common/stm32/stm32_gpio_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_gpio.c + * arch/arm/src/common/stm32/stm32_gpio_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * @@ -33,7 +33,7 @@ #include <nuttx/debug.h> #include <arch/irq.h> -#include <arch/stm32u5/chip.h> +#include <arch/chip/chip.h> #include <nuttx/spinlock.h> #include "arm_internal.h" diff --git a/arch/arm/src/stm32u5/stm32_gpio.h b/arch/arm/src/common/stm32/stm32_gpio_m33_u5.h similarity index 97% rename from arch/arm/src/stm32u5/stm32_gpio.h rename to arch/arm/src/common/stm32/stm32_gpio_m33_u5.h index 5f37922b482..b891dfd98e8 100644 --- a/arch/arm/src/stm32u5/stm32_gpio.h +++ b/arch/arm/src/common/stm32/stm32_gpio_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_gpio.h + * arch/arm/src/common/stm32/stm32_gpio_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_STM32_GPIO_H -#define __ARCH_ARM_SRC_STM32U5_STM32_GPIO_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U5_H /**************************************************************************** * Included Files @@ -35,12 +35,12 @@ #endif #include <nuttx/irq.h> -#include <arch/stm32u5/chip.h> +#include <arch/chip/chip.h> #include "chip.h" #if defined(CONFIG_STM32_STM32U585XX) || defined(CONFIG_STM32_STM32U5A5XX) -# include "hardware/stm32_gpio.h" +# include "hardware/stm32_gpio_m33_u5.h" #else # error "Unsupported STM32U5 chip" #endif @@ -362,4 +362,4 @@ void stm32_gpioinit(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_STM32U5_STM32_GPIO_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U5_H */ diff --git a/arch/arm/src/stm32u5/stm32_idle.c b/arch/arm/src/common/stm32/stm32_idle_m33_u5.c similarity index 98% rename from arch/arm/src/stm32u5/stm32_idle.c rename to arch/arm/src/common/stm32/stm32_idle_m33_u5.c index f84145eca71..0b34b757ceb 100644 --- a/arch/arm/src/stm32u5/stm32_idle.c +++ b/arch/arm/src/common/stm32/stm32_idle_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_idle.c + * arch/arm/src/common/stm32/stm32_idle_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/stm32u5/stm32_irq.c b/arch/arm/src/common/stm32/stm32_irq_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_irq.c rename to arch/arm/src/common/stm32/stm32_irq_m33_u5.c index 967d1f4718a..8ae3f8c32f0 100644 --- a/arch/arm/src/stm32u5/stm32_irq.c +++ b/arch/arm/src/common/stm32/stm32_irq_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_irq.c + * arch/arm/src/common/stm32/stm32_irq_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/stm32u5/stm32_lowputc.c b/arch/arm/src/common/stm32/stm32_lowputc_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_lowputc.c rename to arch/arm/src/common/stm32/stm32_lowputc_m33_u5.c index 8d7aa402767..cc6aff991dc 100644 --- a/arch/arm/src/stm32u5/stm32_lowputc.c +++ b/arch/arm/src/common/stm32/stm32_lowputc_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_lowputc.c + * arch/arm/src/common/stm32/stm32_lowputc_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/common/stm32/stm32_rcc.h b/arch/arm/src/common/stm32/stm32_rcc.h index c2c57a6a0b6..2009138eb51 100644 --- a/arch/arm/src/common/stm32/stm32_rcc.h +++ b/arch/arm/src/common/stm32/stm32_rcc.h @@ -27,6 +27,12 @@ * Included Files ****************************************************************************/ +#if defined(CONFIG_ARCH_CHIP_STM32U5) + +# include "stm32_rcc_m33_u5.h" + +#else + #include <nuttx/config.h> #include "arm_internal.h" @@ -224,4 +230,5 @@ void stm32_rcc_disablelsi(void); #endif #endif /* __ASSEMBLY__ */ +#endif /* CONFIG_ARCH_CHIP_STM32U5 */ #endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_RCC_H */ diff --git a/arch/arm/src/stm32u5/stm32_rcc.h b/arch/arm/src/common/stm32/stm32_rcc_m33_u5.h similarity index 96% rename from arch/arm/src/stm32u5/stm32_rcc.h rename to arch/arm/src/common/stm32/stm32_rcc_m33_u5.h index ae75e4a2356..2aa5d51d382 100644 --- a/arch/arm/src/stm32u5/stm32_rcc.h +++ b/arch/arm/src/common/stm32/stm32_rcc_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_rcc.h + * arch/arm/src/common/stm32/stm32_rcc_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32U5_STM32_RCC_H -#define __ARCH_ARM_SRC_STM32U5_STM32_RCC_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_RCC_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_STM32_RCC_M33_U5_H /**************************************************************************** * Included Files @@ -221,4 +221,4 @@ void stm32_rcc_enableperipherals(void); } #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_STM32U5_STM32_RCC_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_RCC_M33_U5_H */ diff --git a/arch/arm/src/stm32u5/stm32_serial.c b/arch/arm/src/common/stm32/stm32_serial_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_serial.c rename to arch/arm/src/common/stm32/stm32_serial_m33_u5.c index 6abd9eb27d4..f9ce3984926 100644 --- a/arch/arm/src/stm32u5/stm32_serial.c +++ b/arch/arm/src/common/stm32/stm32_serial_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_serial.c + * arch/arm/src/common/stm32/stm32_serial_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/stm32u5/stm32_start.c b/arch/arm/src/common/stm32/stm32_start_m33_u5.c similarity index 99% rename from arch/arm/src/stm32u5/stm32_start.c rename to arch/arm/src/common/stm32/stm32_start_m33_u5.c index 87609e5c881..1919577720d 100644 --- a/arch/arm/src/stm32u5/stm32_start.c +++ b/arch/arm/src/common/stm32/stm32_start_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_start.c + * arch/arm/src/common/stm32/stm32_start_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/stm32u5/stm32_timerisr.c b/arch/arm/src/common/stm32/stm32_timerisr_m33_u5.c similarity index 98% rename from arch/arm/src/stm32u5/stm32_timerisr.c rename to arch/arm/src/common/stm32/stm32_timerisr_m33_u5.c index 3c6aee94222..e36e0656032 100644 --- a/arch/arm/src/stm32u5/stm32_timerisr.c +++ b/arch/arm/src/common/stm32/stm32_timerisr_m33_u5.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_timerisr.c + * arch/arm/src/common/stm32/stm32_timerisr_m33_u5.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/common/stm32/stm32_uart.h b/arch/arm/src/common/stm32/stm32_uart.h index 29de62701fe..360875e45cb 100644 --- a/arch/arm/src/common/stm32/stm32_uart.h +++ b/arch/arm/src/common/stm32/stm32_uart.h @@ -27,7 +27,9 @@ * Included Files ****************************************************************************/ -#if defined(CONFIG_ARCH_ARMV6M) +#if defined(CONFIG_ARCH_CHIP_STM32U5) +# include "stm32_uart_m33_u5.h" +#elif defined(CONFIG_ARCH_ARMV6M) # if defined(CONFIG_STM32_HAVE_IP_USART_V3) || \ defined(CONFIG_STM32_HAVE_IP_USART_V4) # include "stm32_uart_m0_v1.h" diff --git a/arch/arm/src/stm32u5/stm32_uart.h b/arch/arm/src/common/stm32/stm32_uart_m33_u5.h similarity index 97% rename from arch/arm/src/stm32u5/stm32_uart.h rename to arch/arm/src/common/stm32/stm32_uart_m33_u5.h index 032d3609033..1ae5a334c01 100644 --- a/arch/arm/src/stm32u5/stm32_uart.h +++ b/arch/arm/src/common/stm32/stm32_uart_m33_u5.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32u5/stm32_uart.h + * arch/arm/src/common/stm32/stm32_uart_m33_u5.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_STC_STM32U5_STM32_UART_H -#define __ARCH_ARM_STC_STM32U5_STM32_UART_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_UART_M33_U5_H +#define __ARCH_ARM_SRC_COMMON_STM32_STM32_UART_M33_U5_H /**************************************************************************** * Included Files @@ -33,7 +33,7 @@ #include "chip.h" #if defined(CONFIG_STM32_STM32U585XX) || defined(CONFIG_STM32_STM32U5A5XX) -# include "hardware/stm32_uart.h" +# include "hardware/stm32_uart_m33_u5.h" #else # error "Unsupported STM32U5 chip" #endif @@ -297,4 +297,4 @@ void stm32_serial_dma_poll(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_STC_STM32U5_STM32_UART_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_UART_M33_U5_H */ diff --git a/arch/arm/src/stm32u5/CMakeLists.txt b/arch/arm/src/stm32u5/CMakeLists.txt index 70f5a875c13..8fa2143ae19 100644 --- a/arch/arm/src/stm32u5/CMakeLists.txt +++ b/arch/arm/src/stm32u5/CMakeLists.txt @@ -21,27 +21,15 @@ # ############################################################################## set(SRCS - stm32_allocateheap.c - stm32_exti_gpio.c - stm32_gpio.c - stm32_irq.c - stm32_lowputc.c stm32_rcc.c stm32_i2c.c - stm32_serial.c - stm32_start.c stm32_spi.c stm32_lse.c stm32_lsi.c stm32u5xx_rcc.c stm32_pwr.c stm32_tim.c - stm32_flash.c - stm32_timerisr.c) - -if(NOT CONFIG_ARCH_IDLE_CUSTOM) - list(APPEND SRCS stm32_idle.c) -endif() + stm32_flash.c) if(CONFIG_TIMER) list(APPEND SRCS stm32_tim_lowerhalf.c) diff --git a/arch/arm/src/stm32u5/Make.defs b/arch/arm/src/stm32u5/Make.defs index a884bf0cbf3..e651d34759c 100644 --- a/arch/arm/src/stm32u5/Make.defs +++ b/arch/arm/src/stm32u5/Make.defs @@ -33,15 +33,9 @@ include common/stm32/Make.defs # Required STM32U5 files CHIP_ASRCS = -CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c -CHIP_CSRCS += stm32_irq.c stm32_lowputc.c stm32_rcc.c stm32_i2c.c -CHIP_CSRCS += stm32_serial.c stm32_start.c +CHIP_CSRCS += stm32_rcc.c stm32_i2c.c CHIP_CSRCS += stm32_spi.c stm32_lse.c stm32_lsi.c stm32u5xx_rcc.c -CHIP_CSRCS += stm32_pwr.c stm32_tim.c stm32_flash.c stm32_timerisr.c - -ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y) -CHIP_CSRCS += stm32_idle.c -endif +CHIP_CSRCS += stm32_pwr.c stm32_tim.c stm32_flash.c ifeq ($(CONFIG_TIMER),y) CHIP_CSRCS += stm32_tim_lowerhalf.c
