----- Alistair Buxton wrote:
> When I use my custom crt0, in the final binary, gsinit: is pointing to
> GSFINAL instead of GSINIT.
crt0 needs to be the first module in the list of modules you link.
If it is not first, then the gsinit label will not be ahead of the stuff
the compiler puts in the GSINIT area. This is not documented
very well. I think that when you let sdcc magically add crt0, it
places it ahead of everything else you link. But when you use
the "--no-std-crto", it is up to you to put it first.
> Therefore, global variables do not get
> initialised. Also, GSINIT is placed into DATA which seems to be wrong.
This is also a symptom of crt0 not being linked first. I think
the linker puts the areas in the order it first encounters them.
That is why all the areas are mentioned in the default crt0.s,
even if crt0 does not put anything in that area.
> Finally, since my device only has RAM and not ROM, I don't think I
> need separate CODE and DATA areas - all variables can be stored in
> CODE like consts are. Is there some way to tell the compiler to do
> that?
I think if you omit the "--data-loc" from the linker options it
will put your data area right after the code.
Randy
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user