| |||||
Technical Support Support Resources
Product Information | ARMCC: IN-LINE ASSEMBLER ACCESS TO SPSRInformation in this article applies to:
QUESTIONThe following code was written for the ARM ADS Compiler to disable an interrupt:
__asm
{
MRS R0,SPSR
ORR R0,R0,#0x80 // disable interrupt
MSR SPSR_c,R0
}
When I try to re-compile it with the current version of the RealView Compiler, I get several error messages: error C197: inline-asm: Syntax error *** MRS R0, SPSR error C197: inline-asm: undefined identifier *** MRS R0, SPSR Is there a solution to this problem? ANSWERAccess to the SPSR registers is no longer allowed, since there are collisions with code optimization. Instead, use the following intrinsic functions: void __disable_irq(void); void __enable_irq(void); void __disable_fiq(void); void __enable_fiq(void); These functions are designed for enabling and disabling interrupts and you need to replace the in-line assembler. Note that they only work in Supervisor mode. For classic microcontroller applications implement SWI functions as explained in ARMCC: MODIFY IRQ FLAG TO DISABLE/ENABLE INTERRUPTS. MORE INFORMATION
SEE ALSOLast Reviewed: Wednesday, November 15, 2006 | ||||
| |||||