[Tinyos-host-mote-wg] [Tinyos-2.0wg] Fwd: strange error compiling
for telosb with nesc 1.2alpha7
David Gay
dgay42 at gmail.com
Fri Aug 12 11:40:55 PDT 2005
This is the explanation of the problem Joe is seeing with beta1...
I'll think a bit about what we should do about it.
David
---------- Forwarded message ----------
From: David Gay <dgay42 at gmail.com>
Date: Apr 28, 2005 12:01 PM
Subject: Re: strange error compiling for telosb with nesc 1.2alpha7
To: get at eecs.berkeley.edu
Cc: Cory Sharp <cssharp at eecs.berkeley.edu>
On 4/27/05, Gilman Tolle <gilman.tolle at gmail.com> wrote:
> I'm trying to get TinyOS up and running on a new machine, and I'm
> seeing a strange compiler error while using nesC 1.2alpha7. The TinyOS
> tree is right out of the latest CVS snapshot. The error only occurs
> when I compile a component that includes DS2411C.nc.
> C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/msp430/MSP430GeneralIO.h:
> In function `TOSH_SET_PORT10_PIN':
> C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/msp430/MSP430GeneralIO.h:30:
> `__nesc_keyword_norace' undeclared (first use
> in this function)
It's, alas, a bug in msp430-gcc (or probably more accurately, in gcc
3.2.x), as the following cut&paste shows:
[dgay at barnowl tmp]$ gcc -E -dD -imacros aa.h bb.h | grep norace
#undef norace
[dgay at barnowl tmp]$ msp430-gcc -E -dD -imacros aa.h bb.h | grep norace
[dgay at barnowl tmp]$
Note the blank output with msp430-gcc: it's lost the #undef norace
(bb.h is blank, aa.h contains '#undef norace').
As to why it shows up with nesC 1.2 and not 1.1: nesC 1.2 preserves
macros from .nc files too, and the bug is related to #undef'ing things
which are not yet #define'd (1.1 only preserves macros from C files,
where norace is always defined, but in 1.2, when you preprocess a .nc
file, you don't #define norace, so you subsequently lose the #undef).
Fix: hmm. One option is to change the keyword-avoidance mechanism for
C files: instead of having a 'norace' keyword which we #define away to
avoid conflicts, we could have a __nesc_norace keyword for which we
provide a #define when preprocessing nesC files... Note that this
requires changing C header files which want to use norace&co to use
__nesc_norace (which is cleaner anyway, I'd say).
Another fix is to use a more recent gcc for the msp, but I guess those
might still be buggy?
David
_______________________________________________
Tinyos-2.0wg mailing list
Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg
More information about the Tinyos-host-mote-wg
mailing list