2016-02-24 12:17 AM
2016-02-24 01:02 AM
Check if MSP (stack pointer) of aplication is in range of SRAM.
2016-02-24 04:04 AM
Yes, the MSP is within the range of RAM. There is no problem in jumping to my application code. The application runs fine after the jump.
What I am unclear is why 0x2FFE0000 is used to AND with the value of APPLICATION_ADDRESS.2016-02-24 04:31 AM
It is not testing the address, it is testing what is AT the address, which should be an initial stack pointer, that needs to be in RAM.
I've gone over this several times in the last few weeks[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/CSTACK%20issue%20with%20IAP&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=38]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FCSTACK%20issue%20with%20IAP&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=382019-03-11 06:04 AM
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
JumpToApplication = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
JumpToApplication();
}
Can any one please explain the logic of the code and how to check whether MSP(stack pointer) is in the range of SRAM. Also Please explain why APPLICATION_ADDRESS is added with 4.
2019-03-11 06:12 AM
Perhaps review some basic documentation on the Cortex-Mx cores to understand the concept and form the vector table takes.
The RAM test checks to see a value in range of 0x20000000..0x2001FFFF, this may not be adequate depending on specific part in question.