Content originally posted in LPCWare by Audiomonster on Sat Dec 26 20:34:10 MST 2009
Hi,
I am trying to use assembly programming, and in particular, the MULS instruction in a C file.
I first do:
void test(unsigned int a, unsigned int b)
{
a = a * b;
}
The routines compiles into:
0x00000164 <test>: push {r7, lr}
0x00000166 <test+2>: sub sp, #8
0x00000168 <test+4>: add r7, sp, #0
0x0000016a <test+6>: str r0, [r7, #4]
0x0000016c <test+8>: str r1, [r7, #0]
a = a * b;
0x0000016e <test+10>: ldr r3, [r7, #4]
0x00000170 <test+12>: ldr r2, [r7, #0]
0x00000172 <test+14>: muls r3, r2
0x00000174 <test+16>: str r3, [r7, #4]
}
0x00000176 <test+18>: mov sp, r7
0x00000178 <test+20>: add sp, #8
0x0000017a <test+22>: pop {r7, pc}
So I can see the muls instruction being issued and it takes 2 bytes, fine.
Now I try to do the same, directly.
void test(unsigned int a, unsigned int b)
{
asm("muls r3,r2;");
}
I get the following error:
\AppData\Local\Temp\cc9rrcik.s: Assembler messages:
\AppData\Local\Temp\cc9rrcik.s:1838: Error: instruction not supported in Thumb16 mode -- `muls r3,r2'
My first test proves that I should be able to issue the instruction inside this file.
Is there some particular directive I should include to make this work ?
Thanks!