From c99243c8cef17484911b4760c91c00667696b9be Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Mon, 28 Oct 2024 16:08:30 +0000 Subject: [PATCH] arch: arm: cleanup of soc flags in arch What is changed? Use CMSIS SystemCoreClock via a dedicated flag instead of using soc flags. Why do we need this change? This change is part of cleaning soc specific code out of arch folder. Signed-off-by: Sudan Landge --- arch/arm/core/cortex_m/timing.c | 3 +-- modules/cmsis/Kconfig | 5 +++++ soc/nordic/Kconfig | 1 + soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_m/timing.c b/arch/arm/core/cortex_m/timing.c index d56ef8780a4..6cb157552ac 100644 --- a/arch/arm/core/cortex_m/timing.c +++ b/arch/arm/core/cortex_m/timing.c @@ -28,8 +28,7 @@ */ static inline uint64_t z_arm_dwt_freq_get(void) { -#if defined(CONFIG_SOC_FAMILY_NORDIC_NRF) || \ - defined(CONFIG_SOC_SERIES_IMXRT6XX) +#if defined(CONFIG_CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK) /* * DWT frequency is taken directly from the * System Core clock (CPU) frequency, if the diff --git a/modules/cmsis/Kconfig b/modules/cmsis/Kconfig index eff0be6f40c..aba63d35e1a 100644 --- a/modules/cmsis/Kconfig +++ b/modules/cmsis/Kconfig @@ -28,4 +28,9 @@ config CMSIS_M_CHECK_DEVICE_DEFINES help This options enables the validation of CMSIS configuration flags. +config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK + bool + help + Enable this option if CMSIS SystemCoreClock symbols is available. + endif diff --git a/soc/nordic/Kconfig b/soc/nordic/Kconfig index e0063b858ed..a13642172aa 100644 --- a/soc/nordic/Kconfig +++ b/soc/nordic/Kconfig @@ -9,6 +9,7 @@ config SOC_FAMILY_NORDIC_NRF select SOC_COMPATIBLE_NRF select SOC_RESET_HOOK if ARM + select CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK if ARM if SOC_FAMILY_NORDIC_NRF diff --git a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig index cd2b03f8eb0..9fb1afff72d 100644 --- a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig @@ -5,6 +5,10 @@ if SOC_SERIES_IMXRT6XX +config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK + bool + default y + # alias for hal config SOC_SERIES_IMX_RT6XX bool