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

Predicated inline assembly instructions raise error

Hi there,

I was inlining some assembly code according to an example for a fault handler as:

__asm volatile( "ITE NE" );
__asm volatile( "MRSNE R0, PSP" );
__asm volatile( "MRSEQ R0, MSP" );

However, that raised an error when compiling:

../../Setup/HardFault_handler.c(72): error: predicated instructions must be in IT block
        __asm volatile( "MRSNE R0, PSP" );
                        ^
<inline asm>(1): note: instantiated into assembly here
        MRSNE R0, PSP
        ^
../../Setup/HardFault_handler.c(73): error: predicated instructions must be in IT block
        __asm volatile( "MRSEQ R0, MSP" );
                        ^
<inline asm>(1): note: instantiated into assembly here
        MRSEQ R0, MSP
        ^
2 errors generated.

When rewriting this to a single __asm function, the equivalent code compiles fine:

__asm volatile (
  ...
  "ITE EQ \n\t"
  "MRSEQ R0, MSP \n\t"
  "MRSNE R0, PSP \n\t"
  ...

);

In my opinion, the compiler in the upper example should somehow remember from the last translated __asm instruction that an IT block is already opened, and how many lines it comprises.

(Compiler 6 in Keil µVision, Code for ARM Cortex M4)