/* Test if user code is programmed starting from address "APPLICATION_ADDRESS" */
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
/* Jump to application */
Jump_To_Application();
}
}
上面是iap跳转到app的代码,经过验证APPLICATION_ADDRES 是iap或app的首地址的话 比如(iap 程序首地址是0x8000000,app首地址是0x8003000),都可以相互跳转到复位地址执行,但是我改成JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS );APPLICATION_ADDRESS 是我固定的一个函数的地址,这样执行总是失败,失败就进入中断的错误函数里void HardFault_Handler(void),
请问大侠们 怎么能跳转到函数的地址呀,实现直接绝对跳转到函数地址执行函数, 是不是我的堆栈的设置有问题? |