Kevin Thacker - 2013-06-24

Hi,
I want to control precisely the order of areas.

I want to set the location of 2 areas, and then using ordering, define where the other areas are.
So I would define "_CODE" and "_DATA", and others will be ordered according to these.

e.g.

Here _DATA is 0x0100, _INITIALIZED, BSEG, BSS, HEAP all come after it.
_CODE is 0x08000, _INITIALIZER, _GSINIT and _GSFINAL follow this.

.area   _DATA 
.area   _INITIALIZED 
.area   _BSEG
.area   _BSS        
.area   _HEAP

.area   _HOME

.area _CODE
.area _INITIALIZER
.area   _GSINIT 
.area   _GSFINAL

In the examples I have seen, the area order is set in the crt0.s. I have my own one of these.

I also use linker scripts.

e.g.

-j
-m
-u
-i game.ihx
-w
-x
-b _CODE=0x8000
-b _DATA=0x100
-k c:\program files (x86)\sdcc\lib\z80
rom_new_crt0.rel
game.rel
-l z80.lib
-e

I assemble the crt0.s seperately then each of the libraries and the final code.

I then link it seperately with this script.

But, the linker refuses to give me the exact order I want. It insists on setting some areas in a different place.

How can I control exactly the order of the areas?

Thanks.