---- Original Message ----
From: "arrek_x" <hal9900@...>
To: <lpc2000@yahoogroups.com>
Sent: Saturday, February 25, 2006 12:24 AM
Subject: [lpc2000] GCC-3.3.1 and nested function call in ISR - compiler
ERROR???
> Hello folks,
> I noticed something weird about GCC-3.3.1 compiler. When calling a
> function (here called SomeFunction) with pointer among arguments list
> from ISR, SomeFunction does not return to the right place. I checked
> out in *.lst file, that compiler makes place for variable val (local
> in ISR, pointed by pData in SomeFunction) out of ISR's frame on the
> stack and exactly, where SomeFunction stores it's Link Register!
> Writing to the pointed location (*pData=2) overrides SomeFunction's LR
> and program crashes. I also noticed, that in GCC-4.0.1 all works well
> - compiler makes place for ISR's locals in ISR's frame, not out of it.
>
> Could it be GCC-3.3.1 compiler's error?
>
>
> Here some C code:
>
> //*******************************
> // EINT0 interrupt routine
> //*******************************
> void EINT0ISR(void)
> {
> unsigned char val;
>
> EXTINT=0x01; //Clear EINT0 interrupt flag
>
> SomeFunction(a, b, &val);
>
> //doing something with val
> ......
>
> VICVectAddr=0x00000000;
> }
>
> //*******************************
> // SomeFunction
> //*******************************
> SomeFunction(const unsigned int x, const unsigned char y, unsigned
> char *pByte)
> {
> .....
>
> //this causes SomeFunction not to return properly
> //without this the function return is OK
> *pByte=2;
>
> ......
> }
Are you using the compiler's interrupt entry/exit code, such as
void EINT0ISR(void) __attribute__ ((interrupt("IRQ")));
?
GCC 3.3 generates incorrect interrupt entry/exit code, and that is most
likely what you see here. It is fixed in GCC 3.4 and newer.
Karl OlsenMessage
Re: [lpc2000] GCC-3.3.1 and nested function call in ISR - compiler ERROR???
2006-02-25 by Karl Olsen
Attachments
- No local attachments were found for this message.