I'm running sdcc V2.9.2 on Windows XP from build sdcc-20090817-5492-setup.exe.
When I define a bit variable in a function, compile functions separately, then link together I get a linker warning that the global variable referenced by the module is undefined.
?ASlink-Warning-Undefined Global '_FOO_VARIABLENAME_1_1' referenced by module 'FOO'
I have a main application. mainApp.c, along with a subordinate application myFoo.c compiled in DOS using;
sdcc -mmcs51 --model-small --iram-size 256 -I C:\SDCC\Include -c mainApp.c
sdcc -mmcs51 --model-small --iram-size 256 -I C:\SDCC\Include -c myFoo.c
then link using:
sdcc -mmcs51 --model-small --iram-size 256 ^
--code-loc 0x0500 --stack-loc 0x0080 --xram-loc 0x3000 ^
-L C:\SDCC\MyCode\EZ-USB_Lib -l EZUSB -I C:\SDCC\Include ^
myFoo.rel will contain a function such as:
bit myFunction( void)
myFlag = TRUE;
unfortunately the above code worked and didn't exhibit the same issue. The main failed though.
// Function prototype.
bit myFunction( void);
unsigned char tempByte;
myFlag = myFunction();
gives me a linker error ?ASlink-Warning-Undefined Global '_main_myFlag_1_1' referenced by module 'fw' Here my main is in fw.c.
I suppose I could stop using bit variables as flags in functions. Or make them all globals. But the sdccman appears to support local bit functions too.
I also question if its a bseg size issue? I'm using the Cypress CY7C68013 with 16 8-bit bit addressable registers. Will the linker support that or think that I've only got 16 bits available? That might explain why some of the time it may work depending upon when it assigns the bit address.
New info. I don't think its BSEG size related. I had 10 flags defined when the error occurred, now I'm up to 17 and if I create flag variables as global they all work. I think its more related to not assigning local bit variables within functions. Though I did have one show up. Maybe just the first one works and the rest are supposed to overlay it but don't.
Log in to post a comment.