This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to execute the code from RAM ??

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.

Parents
  • 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 ???

    Thanks and Regards,

    Harshan

Reply
  • 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 ???

    Thanks and Regards,

    Harshan

Children
  • 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,

    Joseph

  • Thanks for Reply Sir,

    i got reply from infineon forum, here the link is XMC4500 Running Code from PSRAM??

    Thanks and Regards,

    Harshan.