avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] AVR+gcc and CAN-bus


From: Larry Barello
Subject: Re: [avr-gcc-list] AVR+gcc and CAN-bus
Date: Fri, 30 Mar 2001 07:05:55 -0800

It is hard to say what the problem is.  I have never noticed had any issues
of structs vs individual statics/globals on code stability.  Code size is
another matter.  Dereferencing through a pointer is very efficient on GCC.
Some possibilities for your problems:

1. If you are using the latest snapshot (3.1) -O3 is broken.

2. you (or the compiler) might have some issues with things being/not being
'volatile' between the interrupt handler and the main code.  In other
words, you have to be aware of things changing w/o the compiler knowing
(e.g. an interrupt handler modifying a global variable used by main() or a
subroutine) because the compiler can optimize repeat accesses to variables
out of existence.  This also applied to subroutines that return stuff -
both real and inline.

3. by changing the access method you might have simply shifted timing away
from some race condition.

4. For random events, the stack is always suspect.  You gave no hints on
how you changed your code... Perhaps your stack needs went down?

----- Original Message -----
From: "Marlin Unruh" <address@hidden>
...
>
> I was using some global variables that were filled and maintained by the
> timer interrupts. The timing functions were erratic and the software
would
> hang inconsistently with interaction on the keypad, with uses the timing
> function for repeat rate. I changed to 'struct' and everything worked
> perfect. Why are global variables not as reliable as structures? I
switched
> from using Imagecrafts ICC-AVR compiler and never used structures without
a
> problem. For one thing on ICC-AVR structure code was not as efficient as
> AVR-GCC. The big reason I switched was code size.
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]