Question

I'm not very into assembly but for a project I have to modify a few lines of assembly code for the C51 C compiler to the SDCC.

This is code for C51

setb    T1Run
setb    T0Run

setb    IDLE
jnb     T0Full, $

Which, compiled with SDCC produces

?ASlink-Warning-Undefined Global 'IDLE' referenced by module 'Com_Func'

?ASlink-Warning-Undefined Global '$' referenced by module 'Com_Func'

?ASlink-Warning-Undefined Global 'T0Run' referenced by module 'Com_Func'

?ASlink-Warning-Undefined Global 'T1Run' referenced by module 'Com_Func'

?ASlink-Warning-Byte PCR relocation error for symbol  $
         file              module            area              offset
  Refby  ./Com_Func.rel    Com_Func          CSEG                     004A
  Defin  ./Com_Func.rel    Com_Func          CABS                     0000

as compiler errors/warnings.

  • I know the $-symbol is replaced by the actual address of the instruction by the assembler - but what is the SDCC equivalent?
  • How can I resolve the warnings for T0Run etc.?
Was it helpful?

Solution

I would think you could just replace the $ with a label defined on the same line.

00001$: 
  jnb     T0Full, 00001$

Note that according to the SDCC Compiler User Guide:

All labels defined within inline assembler code have to be of the form nnnnn$ where nnnnn is a number less than 100 (which implies a limit of utmost 100 inline assembler labels per function).

As for the other compiler warnings, those are symbols that assumedly haven't been defined anywhere. How were they defined in the original C51 code?

OTHER TIPS

LOL... That sounds like sdcc it is amusing. I am just now starting to add header files. I had to put it in the bin Dir, as it did not find it as keil does in its project folder.

this might help. now i am not an expert yet, but some things they say don't work as they say. i had to use both the SDCC manual, and the migration manual eventually i found the correct syntax for what i wanted...

http://www.infineon.com/dgdl/AP0806510_XC800_Migration_Keil_2_SDCC.pdf?folderId=db3a30431375fb1a01138c57204603bd&fileId=db3a304314dca389011517efc5860d61&ack=t

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top