On Sun, Aug 26, 2001 at 05:39:22PM +0200, Bernhard Held wrote:
> XDATA space is intended to be RAM, which is normally volatile. And it
> doesn't make sense to write IHX-data to volatile memory. This is the simple
> reason, why SDCC (and IAR) have no mechanism to initialize data in
> XDATA-space.
Hm.
The normal way as I know it is to have a copy of the data segment in ROM,
which is then copied to RAM during startup by the startup code - which is a
lot more efficient than initializing every single variable with a separate
instruction.
All you need is a copy loop, and a way for the startup code to know where
the real data segment in RAM is and where the initial copy is in ROM.
Using GNU tools, this can be easily done using a linker script which puts
the data section in RAM, but relocates it to be places in ROM after the text
section, and then defines variables for the start and end location, which
can be referenced by the startup code.
> >The problem I have is that the 8051 based system I am involved with has
> >RAM, EEPROM and ROM in the xdata space.
> Seems to be a weird design ...
Why not?
Since the 8051 has separate data and code memories, it makes sense to put
large data in a ROM or Flash in data space, and have the whole 64k code
memory for code.
cu
Michael
--
Failure ist not an option. It comes bundled with your Microsoft Product.
|