Yahoo Groups archive

Lpc2000

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

Message

{To TomW} GCC-Bug in IRQs

2006-03-25 by Sten

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!)

At the moment I'm using a dirty workaround by generating correct entry and exit code "manually" in a
naked function.

Thanks,
     Sten

-----------------------------------------------------------------------------------------
Test-case:

#include <stdio.h>
#include <stdlib.h>

void irqFunc2a(void) __attribute__((interrupt("IRQ")));
void dummy(void);

void irqFunc2a(void) {
        dummy();
}
void dummy(void) {
        int test;

        test = *((volatile char*) 0xffff);
        test += 10;
        *((volatile char*) 0xffff) = test;
}

Compile these functions with:
$ arm-elf-gcc -mcpu=arm7tdmi-s -mthumb-interwork -fomit-frame-pointer -c test.c
OR
$ arm-elf-gcc -mcpu=arm7tdmi-s -mthumb-interwork -O2 -c test.c

and have a look at operations on LR register at entry and exit code of irqFunc2a() with:
$ arm-elf-objdump -DS test.o

-- 
/************************************************
 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.