[Tinyos-help] AVR GCC compiler problems
José Moyano
josehmoyano at yahoo.com.ar
Wed Feb 27 10:59:18 PST 2008
Thanks for your answer. I've checked that the first call returns true. In fact, I change the "&&" for a sentences sequence, and the error is the same. Don't be so skeptic to compiler errors. This isn't my first compiler problem. For example, if you has something like:
uint16_t number1 = 0x1002;
uint32_t number2;
number2 = number1 << 14;
Generates an erroneous code. AT90CAN128, ATMega128 (the mcus that I use) have a 16-bit architecture. So, the AVR GCC make code to store the number1 in a 16 bit space, and then shift the buffer 14 bits to the left, and then stores the final result in my 32-bit variable. A wrong value, because the temporary space doesn't have bit space to store a 30-bit number. Check it out, you'll see it happening.
Another idea?
Thanks.
----- Mensaje original ----
De: Kevin Klues <klueska at gmail.com>
Para: José Moyano <josehmoyano at yahoo.com.ar>
CC: tinyos-help at millennium.berkeley.edu
Enviado: miércoles 27 de febrero de 2008, 15:33:11
Asunto: Re: [Tinyos-help] AVR GCC compiler problems
If you are checking via he call to Leds.yellowOff(), keep in mind that
if the first call to setReceive[3]() returns FAIL, the if statement
will short circuit and never run the second call, thus never turning
off the yellow LED.
Kevin
On Wed, Feb 27, 2008 at 10:28 AM, Kevin Klues <klueska at gmail.com> wrote:
> I'm very skeptical in saying that its a problem with the compiler.
> How have you verified that the parameters do not contain the proper
> values?
>
> Kevin
>
>
>
> On Wed, Feb 27, 2008 at 10:18 AM, José Moyano <josehmoyano at yahoo.com.ar> wrote:
> >
> >
> > Take a look at this code:
> >
> > One module has:
> >
> > command result_t CPSSetReceive.setReceive[uint8_t channel](uint32_t id,
> > uint32_t mask) {
> > if ((call CANReceive.setReceive[channel](id, mask)) && (call
> > CANReceive.setReceive[channel + 7](id, mask))) {
> > ...
> > }
> >
> > This operation is called with a mask equal to CAN_DEFAULT_MASK, and is
> > connected to a module with this code:
> >
> > command result_t CANReceive.setReceive[uint8_t channel](uint32_t id,
> > uint32_t mask) {
> > //DEBUG
> > if (channel == 10)
> > if (mask != CAN_DEFAULT_MASK)
> > call Leds.yellowOff();
> > //*********************
> >
> > call MOb.disable[channel]();
> > atomic status[channel] = IDLE;
> > if (id >= MAX_ID)
> > return SUCCESS;
> > if (call MOb.prepareRx[channel](id, mask)) {
> > atomic status[channel] = RX;
> > return SUCCESS;
> > }
> > else
> > return FAIL;
> > }
> >
> > As you can see, in CPSSetReceive.setReceive[..](..) there are two calls to
> > CANReceive.setReceive[..](..). In the first call, the actual parameters of
> > CPSSetReceive.setReceive are equal to the actual parameters of
> > CANReceive.setReceive. When you make the second call, in the body of
> > CANReceive.setReceive[](), the actual parameters doesn't match with the
> > parameters sent by CPSSetReceive.setReceive[](), even when the parameters
> > aren't modified and aren't references or global variables. Is easy to
> > conclude that the compiler is changing the semantic of my program. The
> > cuestion is why. Any ideas?
> > I'm using TinyOS 1.1
> >
> > Thanks in advance.
> >
> >
> >
> > ________________________________
> >
> > Tarjeta de crédito Yahoo! de Banco Supervielle. Solicitá tu nueva Tarjeta de
> > crédito. De tu PC directo a tu casa.
> > Visitá www.tuprimeratarjeta.com.ar
> > _______________________________________________
> > Tinyos-help mailing list
> > Tinyos-help at millennium.berkeley.edu
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
>
>
>
> --
> ~Kevin
>
--
~Kevin
Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080227/10dcc0f5/attachment.htm
More information about the Tinyos-help
mailing list