Skip to content

Commit 6d9f2b4

Browse files
arch: arm: cortex_m: scb: use SHPR name for all Cortex-M
CMSIS 5 had a different name for the SHP/SHPR registers depending on which Cortex-M was used. This inconsistency is fixed in CMSIS 6, which is the new default for Cortex-M in Zephyr. Remove the conditional and always use SHPR in the SCB backup/restore code. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 6413185 commit 6d9f2b4

File tree

1 file changed

+1
-15
lines changed
  • arch/arm/core/cortex_m

1 file changed

+1
-15
lines changed

arch/arm/core/cortex_m/scb.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@
2525
#include <zephyr/arch/cache.h>
2626
#include <zephyr/arch/arm/cortex_m/scb.h>
2727

28-
/* For historical reasons, in Cortex-M family, CMSIS code calls System Handler Priority
29-
* register SHP or SHPR. This code defines the name of the register
30-
* according to the specific Cortex-M variant.
31-
*/
32-
#if defined(CONFIG_CPU_CORTEX_M0) || \
33-
defined(CONFIG_CPU_CORTEX_M0PLUS) || \
34-
defined(CONFIG_CPU_CORTEX_M1) || \
35-
defined(CONFIG_CPU_CORTEX_M3) || \
36-
defined(CONFIG_CPU_CORTEX_M4)
37-
#define SHPR_FIELD_NAME SHP
38-
#else
39-
#define SHPR_FIELD_NAME SHPR
40-
#endif
41-
4228
#if defined(CONFIG_CPU_HAS_NXP_SYSMPU)
4329
#include <fsl_sysmpu.h>
4430
#endif
@@ -191,7 +177,7 @@ void z_arm_save_scb_context(struct scb_context *context)
191177
context->ccr = SCB->CCR;
192178

193179
/* Backup System Handler Priority Registers */
194-
volatile uint32_t *shpr = (volatile uint32_t *) SCB->SHPR_FIELD_NAME;
180+
volatile uint32_t *shpr = (volatile uint32_t *)SCB->SHPR;
195181

196182
for (int i = 0; i < SHPR_SIZE_W; i++) {
197183
context->shpr[i] = shpr[i];

0 commit comments

Comments
 (0)