Zhani Baramidze
Zhani Baramidze

Reputation: 1497

arm instruction width specifiers cannot be compiled

I'm trying to disassemble and modify some code for arm. Disassembly shows some instructions with Instruction width specifiers, e.g:

 80002be:   f44f 5360   mov.w   r3, #14336  ; 0x3800
 80002c2:   f2c4 0302   movt    r3, #16386  ; 0x4002
 80002c6:   f44f 5260   mov.w   r2, #14336  ; 0x3800
 80002ca:   f2c4 0202   movt    r2, #16386  ; 0x4002

but when I'm trying to modify code and assemble, assembler doesn't like mov.w:

main.asm:5: Error: unexpected character `w' in type specifier
main.asm:5: Error: bad instruction `mov.w r3,#14336'

I tried specifying -mcpu=cortex-m4 -march=armv7-m -mthumb but it won't help. Any ideas?

Upvotes: 1

Views: 1023

Answers (1)

Notlikethat
Notlikethat

Reputation: 20934

Instruction width specifiers are part of the UAL syntax. It appears you're using the GNU assembler, which defaults to (a rather relaxed interpretation of) the legacy separate ARM/Thumb syntaxes, depending on -marm/-mthumb or the equivalent directives. If you want to properly use UAL features, you need to first set it with the .syntax unified directive.

Upvotes: 3

Related Questions