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

Relocating entire object or library to SRAM

My project uses NXP LPC54S018J4M built with Keil MDK v5.29. I have found https://www.keil.com/support/man/docs/armlink/armlink_chunk1880490665.htm that describes how to relocate a specific function to SRAM. I would like to know if there is any way to relocate entire objects or libraries to SRAM without specifying directives in front of every function.

Context: I have an application image that resides in internal SPIFI flash, in some higher memory address. A project requirement prevents the application image from being a plain image. I need to execute a large portion of code from SRAM to ensure good performance. The same code does not run fast enough in XIP (execute in place) mode. Some of the code that needs to be relocated to SRAM includes SDK files. I prefer to not update SDK files with directives in front of each function. It would be best if there is a way to specify relocating entire *.o to SRAM.

Any suggestion would be greatly appreciated.

Rex

Parents
  • Hi Rex,

    It is easy to locate entire objects. You just need to edit the scatter description file to implement this. See the below documentation which contains an example of precisely this:

    https://www.keil.com/support/man/docs/armlink/armlink_pge1362065974588.htm

    At a high level, the outer braces define the load region, ie. the address in Flash where it resides, the inner braces define execution region(s), the address in SRAM where they will execute from (I sometimes describe this as the address of the function once you get to main).

    The C library init code will automatically copy any and all code (and data) from load address to execution address, based on the definition in the scatter file.

Reply
  • Hi Rex,

    It is easy to locate entire objects. You just need to edit the scatter description file to implement this. See the below documentation which contains an example of precisely this:

    https://www.keil.com/support/man/docs/armlink/armlink_pge1362065974588.htm

    At a high level, the outer braces define the load region, ie. the address in Flash where it resides, the inner braces define execution region(s), the address in SRAM where they will execute from (I sometimes describe this as the address of the function once you get to main).

    The C library init code will automatically copy any and all code (and data) from load address to execution address, based on the definition in the scatter file.

Children