diff --git a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c index 830d1695bd..31e7e576aa 100644 --- a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c +++ b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c @@ -172,10 +172,12 @@ int board_boot_image(const char *path, uint32_t hdr_size) /* Set main and process stack pointers */ - __asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr)); - setcontrol(0x00); - ARM_ISB(); - ((void (*)(void))vt.reset)(); + __asm__ __volatile__("\tmsr msp, %0\n" + "\tmsr control, %1\n" + "\tisb\n" + "\tmov pc, %2\n" + : + : "r" (vt.spr), "r" (0), "r" (vt.reset)); return 0; } diff --git a/boards/arm/nrf52/common/src/nrf52_boot_image.c b/boards/arm/nrf52/common/src/nrf52_boot_image.c index c102ea1039..d5fd7668c0 100644 --- a/boards/arm/nrf52/common/src/nrf52_boot_image.c +++ b/boards/arm/nrf52/common/src/nrf52_boot_image.c @@ -161,10 +161,12 @@ int board_boot_image(const char *path, uint32_t hdr_size) /* Set main and process stack pointers */ - __asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr)); - setcontrol(0x00); - ARM_ISB(); - ((void (*)(void))vt.reset)(); + __asm__ __volatile__("\tmsr msp, %0\n" + "\tmsr control, %1\n" + "\tisb\n" + "\tmov pc, %2\n" + : + : "r" (vt.spr), "r" (0), "r" (vt.reset)); return 0; } diff --git a/boards/arm/nrf53/common/src/nrf53_boot_image.c b/boards/arm/nrf53/common/src/nrf53_boot_image.c index 0e9bdd30fa..6d96bc7a70 100644 --- a/boards/arm/nrf53/common/src/nrf53_boot_image.c +++ b/boards/arm/nrf53/common/src/nrf53_boot_image.c @@ -161,10 +161,12 @@ int board_boot_image(const char *path, uint32_t hdr_size) /* Set main and process stack pointers */ - __asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr)); - setcontrol(0x00); - ARM_ISB(); - ((void (*)(void))vt.reset)(); + __asm__ __volatile__("\tmsr msp, %0\n" + "\tmsr control, %1\n" + "\tisb\n" + "\tmov pc, %2\n" + : + : "r" (vt.spr), "r" (0), "r" (vt.reset)); return 0; } diff --git a/boards/arm/nrf91/common/src/nrf91_boot_image.c b/boards/arm/nrf91/common/src/nrf91_boot_image.c index 203332edaf..119fc64aa7 100644 --- a/boards/arm/nrf91/common/src/nrf91_boot_image.c +++ b/boards/arm/nrf91/common/src/nrf91_boot_image.c @@ -183,10 +183,12 @@ int board_boot_image(const char *path, uint32_t hdr_size) /* Set main and process stack pointers */ - __asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr)); - setcontrol(0x00); - ARM_ISB(); - ((void (*)(void))vt.reset)(); + __asm__ __volatile__("\tmsr msp, %0\n" + "\tmsr control, %1\n" + "\tisb\n" + "\tmov pc, %2\n" + : + : "r" (vt.spr), "r" (0), "r" (vt.reset)); #else /* Non-secure entry point */ diff --git a/boards/arm/samv7/common/src/sam_boot_image.c b/boards/arm/samv7/common/src/sam_boot_image.c index e6934a555c..8a3543d158 100644 --- a/boards/arm/samv7/common/src/sam_boot_image.c +++ b/boards/arm/samv7/common/src/sam_boot_image.c @@ -178,10 +178,12 @@ int board_boot_image(const char *path, uint32_t hdr_size) /* Set main and process stack pointers */ - __asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr)); - setcontrol(0x00); - ARM_ISB(); - ((void (*)(void))vt.reset)(); + __asm__ __volatile__("\tmsr msp, %0\n" + "\tmsr control, %1\n" + "\tisb\n" + "\tmov pc, %2\n" + : + : "r" (vt.spr), "r" (0), "r" (vt.reset)); return 0; }