вот так: #define MAGIC 0x28469173
#define FW_START 0x08010000
int volatile reboot_magic;
void
Reset_Handler(void)
{
if ((RCC->CSR & RCC_CSR_SFTRSTF) != 0 && reboot_magic == MAGIC)
{
RCC->CSR |= RCC_CSR_RMVF; // clear reset source flag
reboot_magic = 0;
static const uint16_t jump2fw[] = {
0xc806, // ldmia r0!, {r1, r2}
0x468d, // mov sp, r1
0x4710 // bx r2
};
// jump to main application
((void (*)(int))(1 + (int)jump2fw))(FW_START);
}
// continue executing bootloader
...
}
void
start_app(void)
{
reboot_magic = MAGIC;
NVIC_SystemReset();
}