We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
Hi Jon, 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. Thank you for your help and time.
"run a program on a MCU and copy part of the program to Flash" I understand that it's quite common practice for ARM-based systems to store their code in Flash, but copy it to RAM for execution (cos it's faster) - so there should be planty of examples about for doing that. Have you tried the support section of ARM's website? Or are you trying to create your own firmware update routine, to reprogram your Flash? In this case, it's a matter of reading the data sheet(s) for the particular flash device(s) you have in mind - they will tell you the necessary erase & programming algorithms. You will probably also find example code on the manufacurer's website...
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
The next DK-ARM version will come with a Keil CARM Compiler that fully supports the 'ram' function attribute. In this way you can copy functions to RAM memory. Also there will be examples provided for complex memory layouts. We expect that this release comes in about 1 week.