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.
Is there a #pragma to force the TI MSP430 compiler to use software multiply inside an ISR? I have turned on the hardware multiplier in the build settings but I don't want it re-enabing interrupts if I multiply something inside an ISR.
Darren,
looking into the current compiler users guide: http://www.ti.com/lit/ug/slau132g/slau132g.pdf, chapter 5.10, it seems currently it is not possible to do this. May i ask you what you would do this? Can you just not do the calculation in the main() thread instead inside the ISR?
Normally, it should do it without any specific pragma.Darren Beckwith said:Is there a #pragma to force the TI MSP430 compiler to use software multiply inside an ISR?
The multiplication code generated by the compiler usually saves the status register and disables GIE, then restores the status register after the multiply. So no ISR will interrupt a multiplication in main, and therefore no multiplication in an ISR will disturb one in main.
On MSPGCC there was an option to prevent usage of HWM inside ISRs, so the compiler could skip saving and restoring the status register and disabling interrupts during a multiplication.
If the compiler generates code that simply clears and sets GIE around a multiplication, I'd consider this a serious bug.
Jens-Michael Gross said:The multiplication code generated by the compiler usually saves the status register and disables GIE, then restores the status register after the multiply. So no ISR will interrupt a multiplication in main, and therefore no multiplication in an ISR will disturb one in main.
Jens-Michael, you are correct. I should have reviewed the library assembly code mode carefully. The first line in the __mpyl_f5hw subroutine saves the current interrupt state.
**Attention** This is a public forum