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

Memory and Linker Scripts

Hi,

I would like to copy part of my code to a specific area in memory of the microcontroller. How would I do this? Do I have to develop my own linker script or is there an easier way to do this?
Thank you,
Michael

Parents
  • I'm using the GNU compiler and wanted to do the second; after compiling the program run a program on a MCU and copy part of the program to Flash. I'm not sure where to begin or if there are any examples of this.

    In such an endeavor, there are 2 ways that I've seen this done.

    1. Use the linker controls to locate all program code at the location where it is executed. Then, use a custom utility to build the HEX file or binary file with code located at its storage address. Then, in the program, use a memmove function call to copy the bits of code to the execution addresses before invoking them.

    2. The Keil linker for the C51 and C166 allow you to specify a storage address and an execution address for locating program segments. The linker takes care of locating things in their storage places and provides a few automatically-generated constants that assist in moving the code from storage to execution locations. However, I don't think we have implemented this for the ARM tools, yet.

    Your best bet is to search the web for such an example.

    Jon

Reply
  • I'm using the GNU compiler and wanted to do the second; after compiling the program run a program on a MCU and copy part of the program to Flash. I'm not sure where to begin or if there are any examples of this.

    In such an endeavor, there are 2 ways that I've seen this done.

    1. Use the linker controls to locate all program code at the location where it is executed. Then, use a custom utility to build the HEX file or binary file with code located at its storage address. Then, in the program, use a memmove function call to copy the bits of code to the execution addresses before invoking them.

    2. The Keil linker for the C51 and C166 allow you to specify a storage address and an execution address for locating program segments. The linker takes care of locating things in their storage places and provides a few automatically-generated constants that assist in moving the code from storage to execution locations. However, I don't think we have implemented this for the ARM tools, yet.

    Your best bet is to search the web for such an example.

    Jon

Children