I am having a problem with inline assembly with the IAR compiler for ARM, Cortex-M4. Here is a simple example of my problem; put the following code in a file, say, named test.c
void irqrestore(int flags)
{
asm volatile(
"tst %0, #1\n"
"bne 1f\n"
"cpsie i\n"
"1:\n"
:
: "r" (flags)
: "memory");
}
Now try compiling with IAR compiler:
$ iccarm --thumb test.c
IAR ANSI C/C++ Compiler V6.40.2.53884/W32 for ARM
Copyright 1999-2012 IAR Systems AB.
asm volatile(
^
"C:\home\NuttX\nuttx\test.c",6 Error[Og010]: Inline assembler instruction
does not have a unique size: " bne ?1_0"
Errors: 1
Warnings: none
Any ideas what is going wrong? If I change the "bne 1f\n" to "bne 1\n", it compiles fine, but I'm not sure if it is correct.