ARMv8的两种执行状态: AArch64/AArch32

Copied from ARM® Compiler User Guide
When compiling code, you must first decide which target the executable is to run on. An ARMv8-A target can run in different states:
• AArch64 state targets execute A64 instructions using 64-bit wide general-purpose registers.
• AArch32 state targets execute A32 or T32 instructions using 32-bit wide general-purpose registers.
The –target option determines which target state to compile for. This option is a mandatory option.
To create an executable for an AArch64 target in a single step:
armclang –target=aarch64-arm-none-eabi hello.c
This command creates an executable, a.out.
The –target option selects the target that you want to compile for. This example compiles for an AArch64 state target. Because only –target is specified, the compiler defaults to generating code that runs on any ARMv8-A target. You can also use -mcpu to target a specific processor.
To create an executable for an AArch32 target in a single step:
armclang –target=arm-arm-none-eabi -mcpu=cortex-a53 hello.c
In this example, there is no default target for AArch32 state, so you must specify either -march to target an architecture or -mcpu to target a processor. This example uses -mcpu to target the Cortex®-A53 processor. The compiler generates code that is optimized specifically for the Cortex-A53, but might not run on other processors.
Use -mcpu=list or -march=list to see all available options.

• The –target option is an armclang option. For all of the other tools, such as armasm and armlink,
use the –cpu and –fpu options to specify target processors and architectures.

ARMv8-A有两种执行状态: AArch64和AArch32(后者是为了兼容以前的32bit的程序)。
AArch64执行A64指令,使用64bit的通用寄存器;
AArch32执行A32/T32指令,使用32bit的通用寄存器;
arm compiler使用 –target=aarch64-arm-none-eabi 来产生 AArch64的可执行程序。默认使用ARMv8-A target,也可使用 -mcpu 指定特定的ARMv8处理器。
使用 –target=arm-arm-none-eabi 来产生 AArch32的可执行程序。对AArch32而言,没有默认target(处理器),所以需要使用 -march 或者 -mcpu 来指定处理器:
–target=arm-arm-none-eabi -mcpu=cortex-a53

可使用 -mcpu=list 或者 -march=list 查看可选的架构和处理器选项。

–target是armclang用的参数,别的工具,例如armasm/armlink,使用 –cpu 和 -fpu 参数来指定处理器和架构。

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值