[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] generic queue library for AVR GCC?
From: |
Richard Urwin |
Subject: |
Re: [avr-gcc-list] generic queue library for AVR GCC? |
Date: |
Thu, 18 Nov 2004 08:12:35 +0000 |
User-agent: |
KMail/1.5.3 |
On Wednesday 17 Nov 2004 8:07 pm, Mike Panetta wrote:
> On Wed, 2004-11-17 at 12:30, E. Weddington wrote:
> > David Brown wrote:
> > >Personally, I'd like to see the addition of a "critical" function
> > > attribute, like in mspgcc. It is clearly readable, avoids any
> > > requirements for extra local variables, generates optimal code,
> > > and generates any required "goto out" automatically. You can use
> > > it on inlined functions to avoid function call overheads if you
> > > want.
> >
> > I think that's a *great* idea!
> ACK! NOO!! Its bad bad bad. It hides the fact that the function is
> critical so well that it makes it many times easier to make a simple
> mistake that would throw interrupt latency (or worse) all to hell,
> and the programmer may not even know why!
Just catching up here. I was mainly having fun, seeing how the standard
C constructs could be used for this simple task. And (even) I learned
something; why use do while(0) instead of just a pair of braces.
In my view, a critical section is simple enough that it should be
programmed directly, using any of the methods given. The code in the
section must be simple enough that it is efficient. Any more complex
code should be protected by semaphores, themselves implemented with
critical sections. In a large project you should probably only use
semaphores in the interests of clarity. We lose clarity and ease of
maintenance by coding the sections explicitly, but we gain efficiency.
Embedded code is always about finding the happy medium between the two.
--
Richard Urwin
- Re: [avr-gcc-list] generic queue library for AVR GCC?, (continued)
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Geoffrey Wossum, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Mike Panetta, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Mike Panetta, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, David Brown, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Dave Hansen, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?,
Richard Urwin <=
- Re: [avr-gcc-list] generic queue library for AVR GCC?, David Brown, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/18
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Theodore A. Roth, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, David Brown, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Bruce D. Lightner, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Andy Warner, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, rusty+avr-gcc-list, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Bruce D. Lightner, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Ben L. Titzer, 2004/11/17
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/18