This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Corrupted value in register after interrupt on LPC2368

Note: This was originally posted on 21st July 2009 at http://forums.arm.com

Hello,

I've hit a wall guys...

My problem is as follows:

1. all the processes run normally
2. then external interrupt occures
3. I handle it with eint3 handler (external interrupt 3)
4. after returning form eint3 handler sometimes - not always -
r4 register containes corrupted value. Insted of containing value
which was in before the eint3 interrupt it contains - as it seems -
the value of stack pointer of user mode

Any ideas?

for clearifing my point
void main(void)
{
   while(1)
   {
     /*some code*/
     results_process(); --> eint3handler()
                                     {
                                       /*some code*/
                                platform_powerdown()-->application_powerdown();
                                       /*end of eint3 handler*/
                                     }
   /*register r4 gets corrupted sometimes*/
   }

}


I use RVCT 2.2
All the code is written in THUMB mode, except for eint3_handler which is in ARM mode.


best regards

uros
Parents
  • Note: This was originally posted on 21st July 2009 at http://forums.arm.com

    Hi,

    I've actually solved the problem. Sam, you are right, the problem is in a stack overflow.
    I have missed that there is a call to another function via function pointer in application_powerdown
    and that wrecks a havock to stack :(

    My IRQ stack starts at the location 0x40007fe0 and has been 256 bytes long (descending order)

    User stack started at the location 0x40007e80 and is 4k bytes long.

    The function called via function pointer uses more than 256 bytes. Irq SP stopped at 0x40007e28 :)


    and that was the reason of corrupted r4 register.


    thanks again

    uros
Reply
  • Note: This was originally posted on 21st July 2009 at http://forums.arm.com

    Hi,

    I've actually solved the problem. Sam, you are right, the problem is in a stack overflow.
    I have missed that there is a call to another function via function pointer in application_powerdown
    and that wrecks a havock to stack :(

    My IRQ stack starts at the location 0x40007fe0 and has been 256 bytes long (descending order)

    User stack started at the location 0x40007e80 and is 4k bytes long.

    The function called via function pointer uses more than 256 bytes. Irq SP stopped at 0x40007e28 :)


    and that was the reason of corrupted r4 register.


    thanks again

    uros
Children
No data