Linker Script Initialized Data

Ian Caddy ianc at microsol.iinet.net.au
Wed Jan 7 08:46:55 UTC 2004


Hi Leon,

In the axample that I provided we copy the following variables.

I just looked at my linkcmds and realised that I forgot an important 
line which shows where the ROM image (even though it is RAM) of the data 
region is: (in our file it is down at the end)


start_data_rom = LOADADDR(.data) ;


Then following the example you will need to copy the data region from 
start_data_rom to start_data and the length is (end_data - start_data)

Each of these three variables is available to you in your C or assembler 
code but don't forget to define them as externs:

extern UCHAR start_data;
extern UCHAR end_data;
extern UCHAR start_data_rom;

in your code, the linker will resolve them as they are defined in the 
linkcmds.

If you need any more help or if you would like the whole linker file 
jsut ask.  We use two different linkcmds, one for RAM loads and one for 
flash loads.  The flash loads are then copied into RAM on startup, 
whereas the RAM loads are just used for debugging with the BDM.

Talk to you soon,

Ian Caddy.


Leon Pollak wrote:

> Thank you for the example, Ian.
> 
> {...}
> 
>>Our startup code in our bootloader will copy the data section into the
>>right place on startup.
> 
> 
> Just to fill the picture - where is the right place to copy to?
> 




More information about the users mailing list