From ed105761fa1257f7a43d5e0094eaf7f2052dca6f Mon Sep 17 00:00:00 2001 From: Andriy Gelman Date: Thu, 8 Sep 2022 19:02:40 -0400 Subject: [PATCH] soc: arm: infineon_xmc: 4xxx: Disable unalign trap on reset The unaligned trap bit is set by default, contrary to the xmc reference manual. This PR unsets the bit in the initialization. It can still be set later via the CONFIG_TRAP_UNALIGNED_ACCESS option. Note that the same approach is used in xmc4500 reference software init code (see SystemCoreSetup() in infineon hal module). Signed-off-by: Andriy Gelman --- soc/arm/infineon_xmc/4xxx/soc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/soc/arm/infineon_xmc/4xxx/soc.c b/soc/arm/infineon_xmc/4xxx/soc.c index a1bac30807a..cb12dd9c069 100644 --- a/soc/arm/infineon_xmc/4xxx/soc.c +++ b/soc/arm/infineon_xmc/4xxx/soc.c @@ -17,6 +17,10 @@ void z_arm_platform_init(void) { uint32_t temp; + /* unaligned trap bit is enabled on reset. disable it here and set later via */ + /* CONFIG_TRAP_UNALIGNED_ACCESS if needed. */ + SCB->CCR &= ~SCB_CCR_UNALIGN_TRP_Msk; + /* setup flash wait state */ temp = FLASH0->FCON; temp &= ~FLASH_FCON_WSPFLASH_Msk;