This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

stack pointer position upon interrupt

Hi there,

As from c28x (spru430e) Standard Operation for CPU Maskable Interrupts, after fetching interrupt vector, SP is increased by 1 and processor will perform automatic context save.

My question is what is the value of this SP upon interrupt triggering?

I only know that SP points to address 0x400 upon reset. But what is its value under above situation and what would be the difference between background/foreground system and rtos system.

 

Thank you!

Regards,

Leon

  • Hi Leon

    SP will be pointing whatever the application sets it to before the interrupt is triggered.

    Best Regards

    Santosh

  • Thank you Santosh!

    And if I write the isr in c the compiler should make sure the sp back to where it was after isr returned. Right?

    But if I write the isr in asm then I shall handle some other registers but even if I don't the sp should still be back to where before the interrupt. Right?

  • Hi Leon

    on C28x, to return from an ISR and if you are writing your ISR code in assembly you should use IRET instruction to return from ISR. Please take a look at assembly instructions guide for more details on this instructions.

    if you write your ISR function in C, using the 'interrupt' keyword to declare the ISR function, the IRET business it taken care of by the compiler/assembler itself.

    hope that helps and let us know if you have any more questions.

     

    Best Regards

    Santosh