arch: arm: cortex_m: Convert cpu_idle from ASM to C

Asm is notoriously harder to maintain than C and requires core specific
adaptation which impairs even more the readability of the code.

This change reduces the need for core specific conditional compilation and
unifies irq locking code.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>

# Conflicts:
#	soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h
This commit is contained in:
Wilfried Chauveau 2024-01-24 12:07:20 +00:00 committed by Carles Cufí
commit 4760aad353
4 changed files with 143 additions and 213 deletions

View file

@ -8,19 +8,22 @@
* @file SoC extensions of cpu_idle.S for the Nordic Semiconductor nRF53 processors family.
*/
#if defined(_ASMLANGUAGE)
#define SOC_ON_EXIT_CPU_IDLE_4 \
__NOP(); \
__NOP(); \
__NOP(); \
__NOP();
#define SOC_ON_EXIT_CPU_IDLE_8 \
SOC_ON_EXIT_CPU_IDLE_4 \
SOC_ON_EXIT_CPU_IDLE_4
#if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM)
#define SOC_ON_EXIT_CPU_IDLE \
.rept 26; \
nop; \
.endr
SOC_ON_EXIT_CPU_IDLE_8; \
SOC_ON_EXIT_CPU_IDLE_8; \
SOC_ON_EXIT_CPU_IDLE_8; \
__NOP(); \
__NOP();
#elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND)
#define SOC_ON_EXIT_CPU_IDLE \
.rept 8; \
nop; \
.endr
#define SOC_ON_EXIT_CPU_IDLE SOC_ON_EXIT_CPU_IDLE_8
#endif
#endif /* _ASMLANGUAGE */