------- Comment #7 from torsten at debian dot org  2010-05-20 20:47 -------
This also hit me. I wanted to build a simple data logger for an ARM board. Of
course I wanted to give gcc 4.4 a go (I used a compiler from the 3.x series
before...), combined with current FreeRTOS (from www.freertos.org).

The interrupt handlers do not compile just as for Nut/OS. I found a discussion
about the issue at the arm-gnu archives. Quoting the post at 
http://www.codesourcery.com/archives/arm-gnu/msg02517.html by Mark Mitchell:

-----
This code makes invalid use of the "naked" attribute.

>From the manual:

"The only statements that can be safely included in naked functions are
asm statements that do not have operands. All other statements,
including declarations of local variables, if statements, and so forth,
should be avoided. Naked functions should be used to implement the body
of an assembly function, while allowing the compiler to construct the
requisite function declaration for the assembler."
-----

I disagree with this interpretation. "should" be avoided is different from
"must". For me this is just an indication that nothing is guaranteed about the
generated code - which is fine, interrupt handlers will naturally have to
revised for compiler updates.

Disregarding this as "invalid code" basically sends the signal that gcc is
unusable for small embedded systems. Of course it is possible to create a
trampoline function in assembler for each interrupt handler, but for small
systems, the overhead is relevant. So I'd rather set up the required registers
manually using some asm instructions but write the body of the function in C.

Looking at FreeRTOS' Subversion repository, they already started to add an
extra indirection to all interrupt handlers. :-(


-- 

torsten at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torsten at debian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43404

Reply via email to