I have a simple assembly file (temp.S) with one thumb2 (T32) instruction. for exmaple:
orr R4,R7,R8
I want to assemble it with the linaro assembler but I can't find the right flags to do it.
if I try:
arm-linux-gnueabihf-as -o temp.o temp.S
then I get the assembly of the A32 version of the instruction
however, if I try:
arm-linux-gnueabihf-as -o temp.o -mthumb temp.S
I get the error messages
> temp.S: Assembler messages:
> temp.S:1: Error: lo register required -- `orr R4,R7,R8
as if it was expecting a T16 instruction.
Any help with the correct flags for T32 instructions would be appreciated.
By the way, my assembler version is: GNU assembler (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) 2.24.0.20131220
Quoting from the Ubuntu wiki:
For historical reasons
as
does support a-mthumb
command-line option, but it doesn't do what you want: this enables the older Thumb-1, which has it's own, incompatible syntax. To produce Thumb-2 code you still need to turn on unified assembler syntax, which can only be done using the.syntax unified
directive in the assembler source. To keep everything in one place and avoid confusion, it's better to control the assembler output mode with directives rather than attempting to control it on the command line.
TL;DR, put this in your assembly file(s):
.syntax unified /* use unified assembler syntax */
.code 16 /* assemble in Thumb-2 (.thumb" can also be used) */