nucleo-h745zi: fix potential bl jump to app failed issue

After changing sp, following functions calling will result
in unpredictable behavior in case of jumping

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2024-08-04 19:11:38 +08:00 committed by Xiang Xiao
parent 7f99a15ccf
commit a4883d8fa6
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}