[Tinyos-8051wg] tep121, SDCC

Frieder Ferlemann frieder.ferlemann at web.de
Thu Jun 22 09:21:23 PDT 2006


Hello,

I just found the document tep121.txt in the attic at:
http://tinyos.cvs.sourceforge.net/tinyos/tinyos-2.x/doc/txt/tep121.txt?hideattic=0&revision=1.1.4.2&view=markup
and, being one of those who occasionally update the SDCC manual,
would like to post some comments on items referring to SDCC.

Sorry for jumping right into the middle without having insight
into either nescc or tinyos:



ad 3.4.1 SFR and SBIT Declarations
==================================

the preferred syntax on recent SDCC would be
  "__sfr __at (0x80) P0;"
instead of:
  "sfr at 0x80 P0;"

The double underscore syntax avoids name clashes if a
variable should be named sfr.

Eventually use "typedef volatile unsigned char"
instead of  "typedef int sfr;"?


Versions of SDCC newer than 2006-06-10 include a compiler.h file
which allows to do Keil/SDCC/other compiler adaptation of header
files on the C preprocessor level.
(The file compiler.h aims to provide compatibility for the compilers
SDCC, Keil, Raisonance, IAR, Hi-Tech, Tasking, Crossware, Wickenhäuser,
so you would not be locked to either Keil or SDCC.)


ad 3.4.3 Reserved Keywords in SDCC
==================================

The reserved keywords are also available with a double underscore prefix
(f.e. __data,  __xdata, __interrupt, __sfr, ...).
If --std-c89 (or 99) is specified on the command line then only the reserved
keywords with the double underscore prefix are recognised.
Thus a user could use a variable named "data" without conversion
within the mangle script.


ad 3.4.4 Removal of inlining
============================

Another option would be to handle this by the C preprocessor
(with defines: "#define inline" and "#define __inline")
If you should switch to another 8051 compiler which supports "inline"
you could handle this within a file like the above mentioned
compiler.h.


ad 3.4.7 Interrupt Vectors
==========================

"void __vector_5(void) __interrupt (5)" would be preferred



ad 6. Future Work
=================
"The radio module is currently under development, in which the
main hurdle is the three wire SPI interface."

The SDCC manual (http://sdcc.sourceforge.net/doc/sdccman.pdf)
includes an SPI example (section 3.5 "Absolute Addressing")
which might be of use.



Greetings,

Frieder



More information about the Tinyos-8051wg mailing list