Keil Logo

ARMCC: IN-LINE ASSEMBLER ACCESS TO SPSR


Information in this article applies to:

  • RealView C Compiler Version 3

QUESTION

The 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?

ANSWER

Access 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

  • RealView Compiler and Libraries User's Guide, Intrinsic functions, Intrinsics that modify the CPSR

SEE ALSO

Last Reviewed: Tuesday, March 23, 2010


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.