Re: Initialise data
"jonh_bae" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
Most likely the data is not being moved to RAM because it is declared 'const' or it is never modified in your code so is implicitly declared const by the linker and hence not moved to RAM. If this is the case, and your code does not currently access the data you are interested in, then if you put a dummy function in modify the variables values (and use the modified value to avoid optimisation complications) at run time and rebuild. You should then find that the data you are concerned about is relocated to RAM at startup to allow the code to modify the values. Another possibility is that there is simply an error in your linker command file, specifying allocation of the various sections. If you are after locating this data in RAM because you want them to be accessed by another piece of code that is not statically linked against the code unit that declares the variables, i.e. effectively dynamically linked then you will either need to use some off the shelf RTOS library or invent something yourself which manually locates the data. (Pragmas to put the variables concerned in a new linker section located where you want may be sufficient, depending on your compiler) --- In [email protected], "Azkarate_Askasua Mikel" <mazkarateaskasua@i...> wrote: > > Hello, > > We want to declare some variables out of any function (on header) and just initialise them. > > They are put in some sections on RAM (as .data etc.) and obviously it can't be downloaded by the flasher. > > There is a function in __start.c called __init_data() that copies sections using a table (_rom_copy_info[]), but in this table the origins and target are of each section are the some, so no copy is made. > > I'm using MPC564 with Codewarrior v8.1. > > *What I want to ask is how we could put it in RAM and how we can then copy it to the proper RAM addresses. > *Must we change the origin of .data in the linker command file? How? > > Thanks. > > Regards, > Mikel A-A > ----------------------------------------------------------- To learn more about Freescale Microcontrollers, please visit http://www.freescale.com/mcu Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/MPC500/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/