Linker Script Initialized Data
Brett Swimley
brett.swimley at aedbozeman.com
Wed Jan 7 15:33:13 UTC 2004
Thanks Ian for responding. I was able to get similar functionality by
modifying the examples from the web link that I posted. I think I'll
try your implementation however, as I like the fact that it is
completely contained within the linker script file.
Regards,
Brett
Ian Caddy wrote:
> 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?
>>
--
Brett Swimley
Advanced Electronic Designs
brett.swimley at aedbozeman.com
ph: 406-585-8892 fax: 406-585-8893
More information about the users
mailing list