Hi,
I'm trying to do something I thought was very simple, have the .data segment load address placed in ROM, but the execution address in RAM. I've done a slightly modified script from the examples.
I'm not using the all the __start, __init_hardware, etc things, instead I have adpated the script to the old way of doing things (for me anyway), ie code that copies from address __DATA_ROM to __DATA_RAM with size __DATA_RAM - __DATA_END.
The script is attempting to place the load address of .data in flash, and the execution address of .data in sram.
My problem is however that the linker seems to ignore the "LOAD(ADDR(__DATA_ROM))" part of the script. Loading the .elf will place data directly into the execution address. I had expected the __DATA_ROM to be loaded with the .data section.
So, to my questions
Cheers,
/M
Solved! Go to Solution.
Hello
Look at options -romaddr & -rambuffer.
But you will need to add a function which is actually initializing the global data to your application.
Implementation of this function is linker specific, so you cannot keep it generic.
CrasyCat
Hello
According to my understanding you want to get initialization value for global variable allocated in flash and copied over to RAM at start up.
Am I right?
If this is what you intend to do, make sure to generate a ROM Image for your application.
In this purpose you need to check Generate ROM Image in EPPC Linker panel.
If you have created your project using the wizard, the ROM Version build target has the appropriate settings.
Note that you will need to invoke the function __init_data implemented in __start.c to set the variables to their initialization value (i.e. copy values from ROM to RAM).
CrasyCat
Hi
According to my understanding you want to get initialization value for global variable allocated in flash and copied over to RAM at start up.
Am I right?
Yes
If this is what you intend to do, make sure to generate a ROM Image for your application.
In this purpose you need to check Generate ROM Image in EPPC Linker panel.
I was not clear in my previous post. I do not use the ColdWarrior IDE at all, just the command line tools. The reason for not using __start is that I support mulitple compilers in my environment and I want to keep linkfiles and startup code as common as possible. Does the "Generate ROM Image in EPPC Linker panel" set any options to the linker?
Cheers,
/M
Hello
Look at options -romaddr & -rambuffer.
But you will need to add a function which is actually initializing the global data to your application.
Implementation of this function is linker specific, so you cannot keep it generic.
CrasyCat
Thanks, the options did the trick.