1
votes

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?

1
with gcc? I only know a bit about ARM, but maybe this is something that only works that way in "unified" syntax mode (vs. the separate thumb-only syntax)Peter Cordes

1 Answers

3
votes

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.