diff --git a/arch/arm/src/common/stm32/CMakeLists.txt b/arch/arm/src/common/stm32/CMakeLists.txt index 1095822cfe5..1fa9e9b96e7 100644 --- a/arch/arm/src/common/stm32/CMakeLists.txt +++ b/arch/arm/src/common/stm32/CMakeLists.txt @@ -40,15 +40,16 @@ if(NOT CONFIG_ARCH_CUSTOM_PMINIT AND (CONFIG_STM32_COMMON_LEGACY endif() if(CONFIG_ARCH_CHIP_STM32U3 OR CONFIG_ARCH_CHIP_STM32U5) - list( - APPEND - SRCS - stm32_allocateheap_m33_u3u5.c - stm32_exti_gpio_m33_u3u5.c - stm32_gpio_m33_u3u5.c - stm32_lowputc_m33_u3u5.c - stm32_serial_m33_u3u5.c - stm32_start_m33_u3u5.c) + list(APPEND SRCS stm32_allocateheap_m33_u3u5.c stm32_lowputc_m33_u3u5.c + stm32_serial_m33_u3u5.c stm32_start_m33_u3u5.c) +endif() + +if(CONFIG_STM32_HAVE_IP_GPIO_M33_V1) + list(APPEND SRCS stm32_gpio_m33_v1.c) +endif() + +if(CONFIG_STM32_HAVE_IP_EXTI_M33_V1) + list(APPEND SRCS stm32_exti_gpio_m33_v1.c) endif() if(CONFIG_ARCH_CHIP_STM32U3 OR CONFIG_ARCH_CHIP_STM32U5) diff --git a/arch/arm/src/common/stm32/Kconfig.have b/arch/arm/src/common/stm32/Kconfig.have index 1fdb8890b6d..725ee706d27 100644 --- a/arch/arm/src/common/stm32/Kconfig.have +++ b/arch/arm/src/common/stm32/Kconfig.have @@ -33,6 +33,14 @@ # ADC capabilities +# Cortex-M33 GPIO and EXTI capabilities + +config STM32_HAVE_IP_GPIO_M33_V1 + bool + +config STM32_HAVE_IP_EXTI_M33_V1 + bool + config STM32_HAVE_ADC_TIMTRIG_TRGO2 bool default y if (STM32_HAVE_IP_ADC_M3M4_V1 || STM32_HAVE_IP_ADC_M3M4_V2) || STM32_HAVE_IP_ADC_M0_V1 || ARCH_CHIP_STM32F7 || ARCH_CHIP_STM32H5 diff --git a/arch/arm/src/common/stm32/Make.defs b/arch/arm/src/common/stm32/Make.defs index c9a0feaaa12..8f6296957dc 100644 --- a/arch/arm/src/common/stm32/Make.defs +++ b/arch/arm/src/common/stm32/Make.defs @@ -52,13 +52,19 @@ endif ifneq ($(filter y,$(CONFIG_ARCH_CHIP_STM32U3) \ $(CONFIG_ARCH_CHIP_STM32U5)),) CHIP_CSRCS += stm32_allocateheap_m33_u3u5.c -CHIP_CSRCS += stm32_exti_gpio_m33_u3u5.c -CHIP_CSRCS += stm32_gpio_m33_u3u5.c CHIP_CSRCS += stm32_lowputc_m33_u3u5.c CHIP_CSRCS += stm32_serial_m33_u3u5.c CHIP_CSRCS += stm32_start_m33_u3u5.c endif +ifeq ($(CONFIG_STM32_HAVE_IP_GPIO_M33_V1),y) +CHIP_CSRCS += stm32_gpio_m33_v1.c +endif + +ifeq ($(CONFIG_STM32_HAVE_IP_EXTI_M33_V1),y) +CHIP_CSRCS += stm32_exti_gpio_m33_v1.c +endif + ifneq ($(filter y,$(CONFIG_ARCH_CHIP_STM32U3) \ $(CONFIG_ARCH_CHIP_STM32U5)),) CHIP_CSRCS += stm32_irq_m33_v1.c diff --git a/arch/arm/src/common/stm32/hardware/stm32_exti.h b/arch/arm/src/common/stm32/hardware/stm32_exti.h index 7c31d139cb0..8598d8d4d8f 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_exti.h +++ b/arch/arm/src/common/stm32/hardware/stm32_exti.h @@ -33,10 +33,9 @@ * version is core-agnostic. */ -#if defined(CONFIG_ARCH_CHIP_STM32U3) || \ - defined(CONFIG_ARCH_CHIP_STM32U5) +#if defined(CONFIG_STM32_HAVE_IP_EXTI_M33_V1) -# include "hardware/stm32_exti_m33_u3u5.h" +# include "hardware/stm32_exti_m33_v1.h" #elif (defined(CONFIG_STM32_HAVE_IP_EXTI_V1) + \ defined(CONFIG_STM32_HAVE_IP_EXTI_V2)) > 1 diff --git a/arch/arm/src/common/stm32/hardware/stm32_exti_m33_u3u5.h b/arch/arm/src/common/stm32/hardware/stm32_exti_m33_v1.h similarity index 98% rename from arch/arm/src/common/stm32/hardware/stm32_exti_m33_u3u5.h rename to arch/arm/src/common/stm32/hardware/stm32_exti_m33_v1.h index 8b3cba3bc77..18bbebbe23e 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_exti_m33_u3u5.h +++ b/arch/arm/src/common/stm32/hardware/stm32_exti_m33_v1.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/stm32/hardware/stm32_exti_m33_u3u5.h + * arch/arm/src/common/stm32/hardware/stm32_exti_m33_v1.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U3U5_H -#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U3U5_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_V1_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_V1_H /**************************************************************************** * Included Files @@ -463,6 +463,6 @@ /* GPIO port selection occupies four bits in each EXTICR field. */ -#define STM32_EXTI_EXTICR_PORT_MASK 0x0f +#define STM32_EXTI_EXTICR_PORT_MASK 0xff -#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_U3U5_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_EXTI_M33_V1_H */ diff --git a/arch/arm/src/common/stm32/hardware/stm32_gpio.h b/arch/arm/src/common/stm32/hardware/stm32_gpio.h index 468bb38a8b2..456acb8b074 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_gpio.h +++ b/arch/arm/src/common/stm32/hardware/stm32_gpio.h @@ -27,9 +27,8 @@ * Included Files ****************************************************************************/ -#if defined(CONFIG_ARCH_CHIP_STM32U3) || \ - defined(CONFIG_ARCH_CHIP_STM32U5) -# include "hardware/stm32_gpio_m33_u3u5.h" +#if defined(CONFIG_STM32_HAVE_IP_GPIO_M33_V1) +# include "hardware/stm32_gpio_m33_v1.h" #elif defined(CONFIG_STM32_HAVE_IP_GPIO_M0_V1) # include "hardware/stm32_gpio_v2_m0.h" #elif defined(CONFIG_STM32_STM32L15XX) diff --git a/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u3u5.h b/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_v1.h similarity index 99% rename from arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u3u5.h rename to arch/arm/src/common/stm32/hardware/stm32_gpio_m33_v1.h index fca8dccc5a4..db8c98d01aa 100644 --- a/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u3u5.h +++ b/arch/arm/src/common/stm32/hardware/stm32_gpio_m33_v1.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/stm32/hardware/stm32_gpio_m33_u3u5.h + * arch/arm/src/common/stm32/hardware/stm32_gpio_m33_v1.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U3U5_H -#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U3U5_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_V1_H +#define __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_V1_H /**************************************************************************** * Included Files @@ -767,4 +767,4 @@ #define GPIO_SECCFGR_SET(n) (1 << (n)) -#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_U3U5_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_HARDWARE_STM32_GPIO_M33_V1_H */ diff --git a/arch/arm/src/common/stm32/stm32_exti_gpio_m33_u3u5.c b/arch/arm/src/common/stm32/stm32_exti_gpio_m33_v1.c similarity index 98% rename from arch/arm/src/common/stm32/stm32_exti_gpio_m33_u3u5.c rename to arch/arm/src/common/stm32/stm32_exti_gpio_m33_v1.c index 4a5796a78f1..060159ea8d3 100644 --- a/arch/arm/src/common/stm32/stm32_exti_gpio_m33_u3u5.c +++ b/arch/arm/src/common/stm32/stm32_exti_gpio_m33_v1.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/stm32/stm32_exti_gpio_m33_u3u5.c + * arch/arm/src/common/stm32/stm32_exti_gpio_m33_v1.c * * SPDX-License-Identifier: Apache-2.0 * @@ -38,8 +38,8 @@ #include "arm_internal.h" #include "chip.h" +#include "hardware/stm32_exti_m33_v1.h" #include "stm32_gpio.h" -#include "stm32_exti.h" /**************************************************************************** * Private Types diff --git a/arch/arm/src/common/stm32/stm32_gpio.h b/arch/arm/src/common/stm32/stm32_gpio.h index 68362f99829..d02ea64b356 100644 --- a/arch/arm/src/common/stm32/stm32_gpio.h +++ b/arch/arm/src/common/stm32/stm32_gpio.h @@ -29,9 +29,8 @@ #include -#if defined(CONFIG_ARCH_CHIP_STM32U3) || \ - defined(CONFIG_ARCH_CHIP_STM32U5) -# include "stm32_gpio_m33_u3u5.h" +#if defined(CONFIG_STM32_HAVE_IP_GPIO_M33_V1) +# include "stm32_gpio_m33_v1.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) diff --git a/arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.c b/arch/arm/src/common/stm32/stm32_gpio_m33_v1.c similarity index 99% rename from arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.c rename to arch/arm/src/common/stm32/stm32_gpio_m33_v1.c index 283d1fddb70..36d4fa6cb12 100644 --- a/arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.c +++ b/arch/arm/src/common/stm32/stm32_gpio_m33_v1.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.c + * arch/arm/src/common/stm32/stm32_gpio_m33_v1.c * * SPDX-License-Identifier: Apache-2.0 * diff --git a/arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.h b/arch/arm/src/common/stm32/stm32_gpio_m33_v1.h similarity index 96% rename from arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.h rename to arch/arm/src/common/stm32/stm32_gpio_m33_v1.h index 5f2028b784b..e6300bc141e 100644 --- a/arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.h +++ b/arch/arm/src/common/stm32/stm32_gpio_m33_v1.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/stm32/stm32_gpio_m33_u3u5.h + * arch/arm/src/common/stm32/stm32_gpio_m33_v1.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,8 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U3U5_H -#define __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U3U5_H +#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_V1_H +#define __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_V1_H /**************************************************************************** * Included Files @@ -38,14 +38,7 @@ #include #include "chip.h" - -#if defined(CONFIG_STM32_STM32U3C5XX) || \ - defined(CONFIG_STM32_STM32U585XX) || \ - defined(CONFIG_STM32_STM32U5A5XX) -# include "hardware/stm32_gpio_m33_u3u5.h" -#else -# error "Unsupported STM32U3/U5 chip" -#endif +#include "hardware/stm32_gpio_m33_v1.h" /**************************************************************************** * Pre-Processor Declarations @@ -364,4 +357,4 @@ void stm32_gpioinit(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_U3U5_H */ +#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_GPIO_M33_V1_H */ diff --git a/arch/arm/src/stm32u3/Kconfig b/arch/arm/src/stm32u3/Kconfig index 3e0016017b0..824f50e0c46 100644 --- a/arch/arm/src/stm32u3/Kconfig +++ b/arch/arm/src/stm32u3/Kconfig @@ -10,6 +10,8 @@ comment "STM32U3 Configuration Options" config STM32_U3_PERIPHERALS bool default y + select STM32_HAVE_IP_EXTI_M33_V1 + select STM32_HAVE_IP_GPIO_M33_V1 select STM32_HAVE_SYSCFG select STM32_HAVE_USART1 select STM32_HAVE_USART2 diff --git a/arch/arm/src/stm32u5/Kconfig b/arch/arm/src/stm32u5/Kconfig index 95e927f8b46..005ea2162f6 100644 --- a/arch/arm/src/stm32u5/Kconfig +++ b/arch/arm/src/stm32u5/Kconfig @@ -10,6 +10,8 @@ comment "STM32U5 Configuration Options" config STM32_U5_PERIPHERALS bool default y + select STM32_HAVE_IP_EXTI_M33_V1 + select STM32_HAVE_IP_GPIO_M33_V1 select STM32_HAVE_COMP select STM32_HAVE_CRS select STM32_HAVE_DAC1