typedef void (*app_func) (void);
app_func application;
uint32_t app_address;
void jump_to_app(uint32_t addr)
{
uint32_t app_address;
void* (*application)(void); //
/* test if user code is programmed starting from address */
if (((*(__IO uint32_t*)addr) & 0x2FFE0000) == 0x20000000)
{
app_address = *(__IO uint32_t*) (addr + 4);
application = (void* (*)(void)) app_address;
/* initialize user application's stack pointer */
__set_MSP(*(__IO uint32_t*) addr);
rcu_deinit();
/* jump to user application */
application();
}
} |