#include <stdint.h>
char *usb_ep0_start;
char *usb_ep0_end;
void test(void)
{
uint8_t *b;
unsigned char i;
while(i < 8 && usb_ep0_start < usb_ep0_end)
b[i++] = *(usb_ep0_start++);
}
Will compile, but not assemble with
sdcc -mpic14 -p16c745 -c --std-sdcc99
It says:
Error [113] Symbol not previously defined (_test_b_1_1).
sdcc --version gives
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.6 #1243 (Apr 11 2006) (UNIX)
Logged In: YES
user_id=888171
This is probably a result of not initializing b (or i).
It's legal C so it should compile, assemble and link but
don't expect it to 'work'.
A warning about using a variable before initializing it
would also be nice.
Logged In: YES
user_id=564030
I plit the program for the bug reports:
The initialization of b is in #1469031.
Logged In: YES
user_id=1115835
Local variables do not yet work with the pic14 port; use
global variables instead and your program should compile.
I keep this open until local variables are implemented
correctly.
Logged In: YES
user_id=564030
Does that mean that code using local variable won't work
even if it compiles correctly?
Logged In: YES
user_id=1115835
> Does that mean that code using local variable won't work
> even if it compiles correctly?
No, I meant that using local variables can result in the
error message you got (_<function>_<variable>_1_1 not
previously defined). This happens whenever the compiler does
not manage to keep assignments to this variable in its
temporary registers (r0x??) but opts to "spill" them.
The use of local varibales does not influence the
correctness of the generated code; if it compiles and can be
assembled, be happy. If you get the above error, replace the
indicated local by a global variable and be happy as well :-)
Logged In: YES
user_id=564030
OK, thanks.
I'll make my local variablees static, then they compile, but
are still local variables.
Logged In: YES
user_id=1115835
Yippiyeah!
Finally, local variables work in SDCC r4250.
After all these months, the fix is just a single line ;-)
Regards,
Raphael