Hi,
i am working on XMC4500. i want to Implement Self Flashing i.e., the Controller Flash itself, Till now the code is Running from Flash. To Achive this one approach is if i Execute code from RAM Then flash Remains Free So that i Could Download the Code into Flash and Run it. Here my doubt is Can i Run the Code from RAM if so how could i achieve this ??
Thanks and Regards,
Harshan.
I noticed you have also ask the same question on the community
XMC4500 How Execute code from RAM
Please note the flash programming requirement can be device specific (some MCU has built in flash loader code), and I am not familiar with the XMC4500 myself, and the way to run code from SRAM can be tool chain dependent.
So I would say:
1) Add the information of what tool chain you are using in the post in the community
2) and try to see if Infinoen have any application note in this topic
3) Or you can also ask the question in Infineon forum : Microcontroller Forum
If you got your answer from Infineon forum please add a link to ARM community so that next time user has the same question they can find it easily.
Hope this helps.
regards,
Joseph
Thanks for Reply Sir,
i have already posted in their forum, i hope my post is not visible to them, till now i didn't got any reply for that, any way i will update the Solution whenever i got. i trying to do the following approach
copy the code into PSRAM and assigning the PSRAM base address to Program Counter, for confirmation i am just asking you whether my approach is correct or wrong ??? as well as on browsing regarding this issue in so many posts they are modifying the startup file( *.s) and linker script file(*.ld), i need more clarity on linker script. could u suggest any link or book so that it would be helpful for me to achive my goal ???
Harshan
Hi Harshan,
Simply assign the base address to program counter is incorrect as the LSB is 0 and this means trying to switch to ARM state (if you are using BX/BLX instruction to branch there).
I don’t know the base address for the PSRAM in your chip. Assume it is 0x20008000, you can use the instruction sequence:
LDR R0, =0x20008001 /* Note that LSB is 1 */
BX R0 /* Branch to the address, you can also use BLX if the code need to return */
In C you can try using function pointer to call a function in certain address.
But of course you need to make sure you have the image loaded correctly in the PSRAM in the first place.
I am sorry I don’t have example of linker script for this.
Also, the exact details depends on how you compile the code. If the code in PSRAM being compiled separately? (this is the typical arrangement).
The flash programming part might be already available in the pre-loaded firmware (in NXP they call it In-Application Programmable – IAP).
I don’t know if this is the same for Infineon.
Regards,
i got reply from infineon forum, here the link is XMC4500 Running Code from PSRAM??