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;
......
}
Regards,ArekMessage
GCC-3.3.1 and nested function call in ISR - compiler ERROR???
2006-02-24 by arrek_x
Attachments
- No local attachments were found for this message.