1

I have legacy code for an embedded 8051 core (in a cypress FX2) that used to compile with other versions of SDCC. However, current SDCC doesn't know the _naked qualifier:

delay.c:27: syntax error: token -> '_naked' ; column 21

as triggered by

static void
udelay1 (void) _naked
{
  _asm              ; lcall that got us here took 4 bus cycles
    ret         ; 4 bus cycles
  _endasm;
}

and other occurrences.

As _naked practically is supposed to tell the C compiler to "nah, ignore the fact that you're a C compiler and understand that you'd need to save frame context", I don't feel like I should just #define it away.

Is there any solution to this? Should I just go ahead and manually inline the assembler wherever a _naked function is used? I feel like I'd betraying the compiler on a CALL there, and that would change the timing.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
  • The downvote more than a year after posting and answering this question is democratically very fine, but I'd still like to know what I could've done better, so I'd love to read a comment. – Marcus Müller Mar 09 '18 at 20:54

1 Answers1

1

_naked was replaced by __naked in newer versions of SDCC. Same applies to asm/__asm, at/__at, interrupt,bit,xdata/__….

So, this turned out to be an exercise in regex replacements.

I'm still having linker/ranlib/mostly ar problems, and CMake ignores what I instruct it to use as compilers, but oh well.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94