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.

Compiler/MSP430F47187: Modifying the Prologue and Epilogue of ISRs

Part Number: MSP430F47187

Tool/software: TI C/C++ Compiler

Hello, 

I need to push additional registers on to the stack i.e other than SR and PC before entering an ISR. 

Is there a way to do this automatically ie. have the compiler insert the appropriate code to do this?

OR do I need to do it the long route by coding the PUSH instructions in assembly at the beginning of my ISR?

Thanks 

Best Regards

Anand

  • Hi Anand,

    Coding the push instructions in assembly would definitely be the most robust way to do this, as it wouldn't depend on the compiler that you are using.

    Regards,
    Nathan
  • Hi Nathan, 

    Thanks for your reply.

    But it has its down side. ... I have two Timers, the RTC, one UART, One DMA channel, the SD ADC and P1.0 mapped to interrupts, each with its own ISR. 

    I would need to write code to PUSH and POP the registers in each ISR. Not to mention, I would have to do this on the roughly 17 variants of software that we have. 

    I thought it would be nice to be able to modify the prologue and epilogue of the ISRs in one go and then let the compiler do the heavy lifting. 

    That way, I wouldn't have to worry about a missed out POP instruction for example. But I guess... I was expecting too much. 

    Thanks for your help anyway.

    regards

    Anand

  • I have multiple interrupts each with its own ISR and multiple variants of code. Physically writing to each variant would be tedious, not to mention, the risk of error due to a missed out POP instruction leading to a stack overflow or underflow error.
  • Hi Anand,

    I do not know of any way to do that using the compilers in CCS.

    Regards,
    Nathan