2

I wanted to load a 32bit constant into a register and I found a pseudo-instruction "mov32" on which can do this (mov32 pseudo-instruction). Then I write an assembly file which includes:

MOV32 r0, #0xABCDEF12

And compiled it with linaro toolchain(version 13.04):

arm-linux-gnueabihf-as -march=armv7-a -mcpu=cortex-a9 test.s -o test.o

But it failed with message:

Error: bad instruction `mov32 r0, #0xABCDEF12'

I don't know if it's the matter of unified assembly language. In case, I wrote ".syntax unified" in source code and tested again, but also failed. Does GNU toolchain support ARM pseudo-instruction like "mov32", "ldr r0, =address" etc. ? If does, how can I solve this problem? Thanks.

4

2 に答える 2

5

GNU アセンブラーではmov32、次の方法で合成できます。

.macro mov32, reg, val
    movw \reg, #:lower16:\val
    movt \reg, #:upper16:\val
.endm

それはARMv7で機能します。「一般的な」動作が必要な場合は ( ldr reg,=valwhere movw/ movtdon't exist で置き換えます) #ifdef、.

(クレジットが必要な場合のクレジット:これはarch/arm/mach-tegra/sleep.hARM Linuxカーネルソースからのものであり、私の発明ではありません)

于 2013-05-21T08:56:31.117 に答える