Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] {To TomW} GCC-Bug in IRQs

2006-03-25 by Sten

Tom Walsh wrote:
> Sten wrote:
> 
> 
>>Tom Walsh wrote:
>> 
>>
>>
>>>Sten wrote:
>>>
>>>
>>>   
>>>
>>>
>>>>Hello Tom,
>>>>
>>>>some days ago I discovered a GCC bug on interrupt service routines for functions with
>>>>__attribute__((interrupt("IRQ"))). At GCC-Bugzilla I found that this bug has still been reported in
>>>>2005 under bug report #16634 in which you are involved in. Do you know why this bug is still
>>>>"UNCONFIRMED"?!?
>>>>
>>>>The bug still persists in:
>>>>arm-elf-gcc (GCC) 4.0.1
>>>>arm-elf-gcc (GCC) 4.1.0
>>>>
>>>>Do you (or somebody else) have a gcc-patch to solve this problem? I took a look to the gcc sources
>>>>by myself but the problem occurs in conjunction with optimization under conditions, where LR
>>>>register is used for subroutine branches, and this could a little bit more tricky to solve it than
>>>>just hacking the ARM section of GCC!
>>>>
>>>>Can somebody confirm this bug in the binary-tool-chain from www.gnuarm.com or on other GCC-based
>>>>cross compiler versions? It seems gnuarm don't have any special patches against this problem, too.
>>>>(See test-case below!)
>>>>
>>>>
>>>>     
>>>>
>>>
>>>I am not sure what your question is. Why do you feel you have to 
>>>intentionally suppress the apcs stack frame?
>>>
>>>   
>>>
>>
>>With -mapcs-frame the code produced looks good but due to the APCS a lot of overhead at entry and
>>exit of my functions is generated. Without that option (or with -mno-apcs-frame) gcc generates wrong
>>entry/exit code but the code footprint is more slim.
>>In my opinion an arm-elf-gcc should produce correct code for ARM cores in any case.
>>
>> 
>>
> 
> I don't use:
> 
> void someISR (void) __attribute__((interrupt("IRQ")));
> 
> I declare as:
> 
> void someISR (void) __attribute__((interrupt));
> 
> Entry / exit code is fine.
> 
> 
> 
> TomW
> 

I've tried this. But entry/exit is still not correct.
Here's the result:

void uart_irqHandler0(void) __attribute__((interrupt));

00000204 <uart_irqHandler0>:
 204:   e24ee004        sub     lr, lr, #4      ; 0x4
 208:   e92d500f        stmdb   sp!, {r0, r1, r2, r3, ip, lr}
 20c:   e3a0120e        mov     r1, #-536870912 ; 0xe0000000
 210:   e2811903        add     r1, r1, #49152  ; 0xc000
 214:   e3a00000        mov     r0, #0  ; 0x0
 218:   ebfffffe        bl      d0 <uart_irqHandler_common>
 21c:   e8bd500f        ldmia   sp!, {r0, r1, r2, r3, ip, lr}
 220:   e25ef004        subs    pc, lr, #4      ; 0x4

Question:
Which gcc version do you use? Which command line parameters do use?
How do you differentiate between IRQ and FIQ (only r0..r7 need to be saved) if use
__attribute__((interrupt)) only?

Regards.
  Sten

-- 
/************************************************
 Do you need a tiny and efficient real time
 operating system (RTOS) with a preemtive
 multitasking for LPC2000 or AT91SAM7?

   http://nanortos.net-attack.de/

 Or some open-source tools and code for LPC2000?

   http://www.net-attack.de/

************************************************/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.