I recently inherited an SDCC based, 8051 project. I downloaded SDCC version 2.6.0 and read all the documentation. I fixed a few bugs like "LED = ~LED;" to "LED = !LED" but I had one nagging error.

This produces no error:

SDCC -c --opt-code-size --nogcse --model-large --xram-size 0x1000 --code-size 0xFDFF "x-0.c"

This produces an ugly, impossible to locate error:

SDCC -c --opt-code-size --nogcse --model-large --xram-size 0x1000 --code-size 0xFDFF --debug "x-0.c"

?ASxxxx-Error-<o> in line 89 of x-0.asm
              <o> .org in REL area or directive / mnemonic error
?ASxxxx-Error-<o> in line 103 of x-0.asm
              <o> .org in REL area or directive / mnemonic error
?ASxxxx-Error-<o> in line 114 of x-0.asm
              <o> .org in REL area or directive / mnemonic error
?ASxxxx-Error-<o> in line 131 of x-0.asm
              <o> .org in REL area or directive / mnemonic error
?ASxxxx-Error-<o> in line 156 of x-0.asm
              <o> .org in REL area or directive / mnemonic error

where:

filename: "x-0.c"
----------------------------------------------------------------
#include <stdlib.h>

struct x {
int y;
char z;
float f;
};

struct x var;

void func(void)

{
var.y = 5;
var.z = var.y;
var.f = (float)(var.y);

}
----------------------------------------------------------------

I read the linker manual for more information in this error, but found the exact same text repeated, so no help there. I wasn't allocating anything in .org, the compiler was.

It turns out that the dash in the file name is the culprit!

rename "x-0.c" as "x_0.c" and all is once again fine.

-Wayne