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

Scatter-load question: How to move my r/w data from flash

I've got a project that I'm trying to move to the latest MDK-ARM from older tools. I've created a scatter-loading file that describes my memory layout, but I can;'t figure out how to move my read-write data from flash into RAM. Everything I've tried points only to the "execute" address, I can't seem to determine the "load" address.

Any help?
Thanks
Dan

Parents
  • The scatter files you find as examples on this web site, and the scatter files the IDE can create automatically based on your form information will automagically place the initial value of RW data into flash in such a way that it gets copied to RAM by the startup code.

Reply
  • The scatter files you find as examples on this web site, and the scatter files the IDE can create automatically based on your form information will automagically place the initial value of RW data into flash in such a way that it gets copied to RAM by the startup code.

Children
  • Thanks but I didn't find the examples helpful. They are too elementary to be of any use, but even still the S-g files themselves are the least of the problem. The real problem is that MY start up code can't find the address of the data in flash. While I'm sure there is some start up code that can find it, I haven't found that in any of the examples I've seen (and I've been tru all of them on the media the tools come with!).

    Maybe you could point me to a specific example?

    Thanks
    Dan

  • I don't have any examples available since I'm sitting at home (almost midnight now).

    But before main() is called, the runtime library will decompress any initialized data and copy to RAM and any non-initialized data will be zero-filled.

    You can't see it in the startup file. Much of the magic happens in the call __main.

    In the scatter file, you normally have a RW_IRAMx block inside a LR_IROMx block which will tell the linker the start address of the RAM, and that the compressed data for the rw variables should be stored in that flash. The startup code will then look at the +RW segments to figure out how to data to initialize, and the +ZI segments to figure out how much RAM to clear.