Hi,
I'm having some trouble with using static and non-static global variables.
I've cut down the source to the smallest amount that I can whilst
still having the error. I have two C files:
*** time.c ***
unsigned long int the_time = 0;
unsigned long int time_get( void )
{
return the_time;
}
*** main.c ***
static unsigned char count = 0;
int main( void )
{
}
***
If I compile them with the command:
% msp430-gcc -o main main.c time.c -mmcu=msp430x169
I get the following output:
/tmp/ccAOuihe.o(.text+0x6): In function `time_get':
: internal error: unsupported relocation error
/tmp/ccAOuihe.o(.text+0xa): In function `time_get':
: internal error: unsupported relocation error
I have noted two more things that may be relevant:
1) If I compile the two files as separate object files then link them,
then there is no error. However, I think this is undesirable because it
will affect the optimisation that I get.
2) If I remove "static" from main.c, then it works with no errors. I've
actually moved that variable from an interrupt handler which had it as a
static variable.
Can anyone shed any light on what's happening? I'm using the "cdk4msp"
rpms, which report to be verion 3.3.2. Would this problem be solved if I
used a later version of the compiler?
Cheers,
Rob Spanton