On Sun, 20 Feb 2022 15:15:40 +0300
Tony Pavlov via Sdcc-user <sdcc-user@lists.sourceforge.net> wrote:

> Hi,
> 
> i have a question about SDLD. On systems where programs are 
> loaded inro RAM, say, MSX or ZX Spectrum or whatever else 
> computer, there is some sense in saving RAM by making
> _INITIALIZED and _INITIALIZER section have the same base address.
> Unfortunately, that is not very easy task, because you can not 
> put sections one after the other efficiently because of the unknown 
> sizes of sections which land before. for example:

Short answer - use Z88DK instead. Z88DK has a main compiler which is a
modified SDCC but it also has everything for developing on RAM based
systems as well as support libraries for things like ZX Spectrum, and
tools to compile into things like .tap files.

> 
> .area _CODE
> .area _INITIALIZER
> .area _WHATEVER
> 
> and then
> 
> -b _CODE=0x100 -b_INITIALIZED=l__CODE+0x100 
> 
> is not working because l__CODE is only known after that linking 
> phase.
> 
> another solution adding a sommandline option into SDCC itself, 
> that force emission of initialized variables together with labels 
> into one single section.
> 
> what do you think about this? any suggestions?

It would be helpful I think.

SDCC is a bit tied to ROM based systems. You can't tell it to produce
only initialized sections, you can't force a specific segment to 0 (the
linker instead treats 0 as 'wherever'), it can't do relocations, it can't
do automatic banking and you can't even reliably force link order without
using the linker separately and a .lnk file.

I gave up trying to fix SDCC and instead just wrote some tools that take
the SDCC binary output and rearrange them to taste.

If you look in the Fuzix repository (github.com/EtchedPixels) there are a
bunch of tools that parse the SDCC map file and then use it to do various
things like move the initializer data to initialized, generate relocatable
binaries etc, plus some simple patches and a modified linker that can
generate banked binaries, as I use on things like Fuzix on the ZX
Spectrum 128K and the Russian clones.

For most things however I think you'll find Z88DK can do it out of the
box.

Alan


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to