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.
Part Number: CC430F5135
Tool/software: TI C/C++ Compiler
In section 7.2 of the MSP430 GCC User's Guide (Rev. C), there is a "critical" attribute that is documented as "Disable interrupts on entry, and restore the previous interrupt state on exit." When I compile an ISR with this attribute, it adds a push r2; dint; nop to the beginning of the ISR and additional instructions at the end to undo this.
However, in Section 18.104.22.168 Interrupt Acceptance in the MSP430x5xx Family User's Guide (Rev. Q), it specifies that before entry into the user ISR, "3. The SR is pushed onto the stack." Further, "6. All bits of SR are cleared except SCG0, thereby terminating any low-power mode. Because the GIE bit is cleared, further interrupts are disabled."
This makes the critical attribute in MSP430 GCC seem redundant. Can someone explain this redundancy here? When should I ever mark a ISR critical?
I don't know. So, I filed the entry MSPGCC-93 in the SDOWP system. You are welcome to follow this entry with the SDOWP link below in my signature. This should either result in the critical attribute being removed, or an explanation given as to when it is useful.
Thanks and regards,
TI C/C++ Compiler Forum ModeratorPlease click This Resolved My Issue on the best reply to your questionThe CCS Youtube Channel has short how-to videosThe Compiler Wiki answers most common questionsTrack an issue with SDOWP. Enter your bug id in the Search box.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to George Mock:
In reply to Kevin Zheng:
It takes a few hours for a new entry to propagate through the system. Please try again later.
Since the MSP430 hardware handles interrupt acceptance (pushing the PC, SR to stack, clearing the SR) and interrupt return (popping the PC, SR from stack, restoring interrupt state), software instructions to performthese tasks are not necessary when an ISR has been registered in the interrupt vector table.
However, if there is a need for a regular function to not be interrupted, it can be marked with the critical attribute, to disable interrupts on entry and restore the previous interrupt state on exit.
But you are correct that the use of the critical attribute is redundant on a function already marked with the interrupt attribute. GCC should at least warn and probably disallow these attributes being used together.
Jozef LawrynowiczMSP430-GCC Developerwww.mittosystems.com
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.