设备 -
STM32H7B3I-DK
项目- STM32H7B3I-DKApplica
tions2_Images_ExtFlash
将控制权从 BL 转移到 APP 时出现 HardFault
1)最后的代码痕迹
- launch_application:
- /******************************************************
- * return from exception to application launch function
- * R0: application vector address
- * R1: exit function address
- * push interrupt context R0 R1 R2 R3 R12 LR PC xPSR
- *******************************************************/
- MOV R2, #0x01000000 /* xPSR activate Thumb bit */
- PUSH {R2}
- MOV R2, #1
- BIC R1, R1, R2 /* clear least significant bit of exit function */
- PUSH {R1} /* return address = application entry point */
- MOV R1, #0 /* clear other context registers */
- PUSH {R1}
- PUSH {R1}
- PUSH {R1}
- PUSH {R1}
- PUSH {R1}
- PUSH {R0} /* R0 = application entry point */
- MOV LR, #0xFFFFFFF9 /* set LR to return to thread mode with main stack */
- BX LR /* return from interrupt */
- .end
LR,SP 的值
堆栈指针的内存:
2) LR:0xFFFF.FFF9 从处理程序模式返回,因此 NVIC 确实取消堆栈 PC、R0-R3、R12、LR、xPSR
PC : 0x8020400 看起来适合 APP 启动
3) 0x8020400 处的应用程序内存
这看起来也是正确的。
任何调试此 HardFault 的帮助将不胜感激。