I defined a sdcc library module that pre-initialises some data and linked it with my program:
The data wasn't initialised.
The rel file shows the data is present, it seems when it goes to link it, the space is allocated for it, but there is no initialisation of the data.
I understand why, CODE section is generally meant to be read-only so it can go into ROM, and DATA is read-write in RAM and may be in a different memory location to the CODE. I also understand the GSINIT is emitted Z80 data probably generated by the sdcc compiler to initialise global variables, so this kind of issue is a linker one.
I expected it would be initialised by the GSINIT?
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/TININative/ds400/hc08/s08 3.2.1 #8221 (Nov 17 2012) (Linux)
If the section is changed to "CODE" the data appears initialised, for a ROM program then it can be modified.. So it's definitely a linker/section problem?
compiling for z80, but if it's a linker problem, it may exist for other cpus supported by sdcc.
Log in to post a comment.