I have a bit of 8051 inline assembly that won't compile under SDCC. At the assembly stage I get the error message:
?ASxxxx-Error-<u> in line 727 of main.asm
<u> undefined symbol encountered during assembly
Examining the asm file, it becomes apparent that the assembler can't find a label, even though the label clearly appears two lines after the reference. The code looks something like this in C:
JNZ MYSTERY_LABEL; //jump to MYSTERY_LABEL
NOP; // do something or nothing
MYSTERY_LABEL:
_endasm;
}
Names have been changed to protect the innocent. Don't ask me why the assembler can't find the MYSTERY_LABEL label. I considered examining the source code, I really did. I decided I just didn't have the time. I did find a solution though. Replace the nice, fancy readable label with a more "traditional" nnnnn$ format labels:
JNZ 00023$; //jump to 00023$ AKA MYSTERY_LABEL
NOP; // do something or nothing
00023$: //AKA MYSTERY_LABEL
_endasm;
}
This version of the code is less readable, but SDCC compiles it just fine. Happy hacking!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment