I'm trying to retrieve the binary representation of a few FPU instructions for the Cortex-M4 processor. I resolved to put the code I need to retrieve in a file like this
.syntax unified
vsub.f32 s0, s1, s2 ; or any other instruction
and then call
arm-none-eabi-as -o /dev/null -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -al -EB <file>
However, for FPU instructions, it fails telling me
Assembler messages:
Error: invalid instruction shape -- `vsub.f32 s0,s1,s2'
What am I doing wrong? Thanks
Apparently, the -mfpu
flag is needed too (in this case, -mfpu=fpv4-sp-d16
):
[alessandro@commodoroII src]$ arm-none-eabi-as -o /dev/null -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -al -EB /tmp/temp-julia.s
/tmp/temp-julia.s: Assembler messages:
/tmp/temp-julia.s:2: Error: invalid instruction shape -- `vsub.f32 s0,s1,s2'
ARM GAS /tmp/temp-julia.s page 1
1 .syntax unified
2 vsub.f32 s0, s1, s2
[alessandro@commodoroII src]$ arm-none-eabi-as -o /dev/null -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -al -EB /tmp/temp-julia.s
ARM GAS /tmp/temp-julia.s page 1
1 .syntax unified
2 0000 EE300AC1 vsub.f32 s0, s1, s2