I have OS running in the flash, but there is some case in which I will download a user application case to the SRAM with eSCI and run the user application in the SRAM. I want to know how to switch the PC to the code in SRAM for MPC5674F. Thanks!
Hi @Harry_Yao
You can use pointer to function to jump anywhere within the memory map.
Here is something similar:
I described there how to create RAM image which can be downloaded by BAM.
Regards,
Lukas
Hi Lukas,
Thanks for your reply.
I have already created a RAM image. My question is how to jump to the code in the SRAM. In other words, I have an OS running in the flash which is also used to receive the code for the SRAM. After the code receive done, I need to jump to the code in the SRAM from the flash. My understanding is that it is needed to change the value in the register PC. But I don't know how to udpate the value in the PC. Thanks!
Hi Lukas,
Sorry for my late response. Your solution works well. But another question comes. Will the interrupt that is setup in the flash code still take affect if the interrupt instance occur?
Sure, it will. It's highly recommended to disable all interrupts and de-initialize everything before the jump.