This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

inline assembler not permitted in thumb code

I am working with LPC1768 with Keil realview MDK ARM V4.01.
When iam using "__asm" keyword in my code for IENABLE,IDISABLE macros (to switch between sys mode and irq mode), it is generating a compilation error as "Inline assembler not permitted when generating Thumb code".
these two macros i wish to use.
#define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode }//__asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode }
#define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }

please suggest regarding this.

Parents
  • "I guess that, the inline assembly code you posted is written for IAR or GNU Toolchain."

    No need to even guess - it is clearly stated:

    // Note that this works as-is in IAR 5.20, but could have a different syntax
    // in other compilers.
    //****************************************************
    

    When downloading stuff from the net, it is important that you take time to understand what you have got!

    Are you sure that this code is for a Cortex-M3?

    Is using printf in a Hard Fault handler really a good idea...?

Reply
  • "I guess that, the inline assembly code you posted is written for IAR or GNU Toolchain."

    No need to even guess - it is clearly stated:

    // Note that this works as-is in IAR 5.20, but could have a different syntax
    // in other compilers.
    //****************************************************
    

    When downloading stuff from the net, it is important that you take time to understand what you have got!

    Are you sure that this code is for a Cortex-M3?

    Is using printf in a Hard Fault handler really a good idea...?

Children