ARM 编译器 Arm Compiler for Embedded 6 相关工具链简介

目录

1, Introduction to Arm® Compiler 6

1.1 armclang

1.2 armasm

1.4 armar

1.5 fromelf

1.6 Arm C++ libraries

1.7 Arm C libraries

1,8 Application development ,ARM程序开发流程

2,ARM 编译器 5和ARM 编译器 6的兼容性

3,ARM编译器相关链接


1, Introduction to Arm® Compiler 6

Arm Compiler 6 是 Arm 中用于 Arm Cortex® 和 Arm Neoverse™ 处理器的最先进的 C 和 C++ 编译工具链。Arm Compiler 6 与 Arm 架构一起开发。因此,Arm 编译器 6 经过优化,可为从小型传感器到 64 位设备的嵌入式裸机应用生成高效代码。

Arm Compiler 6 将 Arm 优化的工具和库与基于 LLVM 的现代编译器框架相结合。Arm 编译器 6 中的组件包括:

  1. armclang
  2. armasm
  3. armlink
  4. armar
  5. Arm C++ libraries
  6. Arm C libraries

1.1 armclang

编译 C、C++ 和 GNU 汇编语言源的编译器和汇编编译器。基于LLVM和Clang技术。Clang是LLVM的编译器前端,可以支持C和C++等编程语言。

1.2 armasm

传统的汇编编译器,针对ARM语法的汇编代码。使用armclang是针对GNU 语法的汇编文件。

armlink链接器可以将一个或多个目标文件以及一个或多个目标程序库链接,生成一个可执行的程序。

1.4 armar

归档器(archiver)可以将 多个ELF 对象收集在一起,并在归档或库中进行维护。如果不经常更改这些文件,这些已经编译好的ELF文件可以减少编译时间,因为不必每次使用它们时都从源代码重新编译。并且可以将此类库或存档传递给链接器,以代替多个 ELF 。还可以使用存档分发给第三方应用开发人员,这样就可以在不泄露源代码的情况下共享存档。

1.5 fromelf

fromelf可以将 Arm ELF 文件转换为二进制格式。它还可以生成有关输入的elf文件的文本信息,例如其反汇编、代码大小和数据大小。

1.6 Arm C++ libraries

Arm C++库是基于LLVM libc++工程:

  • libc++abi 库是一个rubtime 库,提供大量的低级语言特性的实现。
  • libc++ 库同样提供 ISO C++的标准库实现

如果C++编译单元是用不同的主要或次要版本的Arm编译器编译的,并且链接到单个image。那么ARM不保证该c++编译单元的兼容性。因此,ARM建议在编译C++源码时,使用单一版本的工具链。此外也支持C和C++的混合编译。

1.7 Arm C libraries

ARM的C库提供:

  • 标准的C语言库特性的实现。
  • 许多非标准的通用的C语言扩展
  • POSIX 扩展功能。
  • 使用POSIX的函数标准化。

1,8 Application development ,ARM程序开发流程

一个典型的ARM程序开发流程应该包含:

  1. 为主程序开发C/C++源码 (armclang)。
  2. 为底层硬件组件开发汇编源码,比如中断服务子程序(armclang,或者针对arm 汇编代码的armasm)
  3. 将所有目标文件链接成一个elf image(armlink)
  4. 将一个image转换成 plain binary, Intel Hex, 或者Motorola-Smeld等格式。

下图展示了一个典型的应用程序开发流程:


需要注意的是,

2,ARM 编译器 5和ARM 编译器 6的兼容性

如果用户之前使用的是ARM compiler 5,需要将code在ARM compiler 6中编译,可以参考文档:

Arm Compiler for Embedded Migration and Compatibility Guide

 compiler 5和compiler6最大的区别在于compiler 5使用的是armcc,而compiler 6使用的是armclang。以下是二者工具链的对比表格:

Table 1. List of compilation tools
Arm Compiler 5 Arm Compiler for Embedded 6 Function
armcc armclang Compiles C and C++ language source files, including inline assembly.
armcc armclang Preprocessor.
armasm armasm Legacy assembler for assembly language source files written in armasm syntax. Use the armclang integrated assembler for all new assembly files.
Not available armclang. This is also called the armclang integrated assembler. Assembles assembly language source files written in GNU assembly syntax.
fromelf fromelf Converts Arm ELF images to binary formats and can also generate textual information about the input image, such as its disassembly and its code and data size.
armlink armlink Combines the contents of one or more object files with selected parts of one or more object libraries to produce an executable program.
armar armar Enables sets of ELF object files to be collected together and maintained in archives or libraries.

3,Compiler 6所支持的ARM 架构

Arm Compiler for Embedded 6支持以下ARM架构:

  • Armv9-A.
  • Armv8-A and all update releases, for bare-metal targets.
  • Armv8-R.
  • Armv8-M.
  • Armv7-A for bare-metal targets.
  • Armv7-R.
  •  Armv7-M.
  • Armv6-M.
     

当编译代码时,编译器需要知道以哪种体系结构为目标,以便利用特定于该体系结构的特性。要指定目标架构,必须提供目标执行状态(AArch32或AArch64),以及目标体系结构(例如Armv8-A)或目标处理器(例如cortex-A53处理器)。

要使用armclang指定目标执行状态(AArch64或AArch32),使用强制的 --target 命令行选项:

--target=<arch>-<vendor>-<os>-<abi>

支持的目标包括:

  • aarch64-arm-none-eabi
    • 为A64状态产生A64的指令,如果没有指定-march 或者-mcpu 属性则暗示-march=armv8-a
  • arm-arm-none-eabi
    • 为A32状态产生A32的指令,同时必须使用-march(指定架构)-mcpu(指定处理器)

如果想要针对某个架构的所有处理器生成通用的代码,可以使用-march 选项,使用 -march=list
 可以看到全部的支持的架构。此外,如果想针对某款处理器优化你的代码,可以使用 -mcpu 选项,使用 -mcpu=list 可以看到全部的支持的处理器。

需要注意的是,--target, -march和-mcpu选项是armclang选项。对于所有其他工具,如armlink,使用 --cpu选项指定目标处理器和体系结构。

4,ARM编译器相关链接

Arm product resources Document ID Confidentiality
Arm Compiler for Embedded Reference Guide 101754 Non-Confidential
Arm Compiler for Embedded Migration and Compatibility Guide 100068 Non-Confidential
Arm Compiler for Embedded Arm C and C++ Libraries and Floating-Point Support User Guide 100073 Non-Confidential
Arm Compiler for Embedded Errors and Warnings Reference Guide 100074 Non-Confidential
Arm Support - -
Arm Compiler for Linux - -
Arm Development Studio Getting Started Guide 101469 Non-Confidential
Arm Development Studio User Guide 101470 Non-Confidential
Arm Compiler for Embedded Licensing Configuration - -
Request a license - -
Manage Arm Compiler Versions - Non-Confidential
User-based licensing User Guide 102516 Non-Confidential
CMSIS 5 - Non-Confidential
Arm® architecture and specifications Document ID Confidentiality
Arm Architecture Reference Manual for A-profile architecture DDI 0487 Non-Confidential
ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition DDI 0406 Non-Confidential
A-Profile Architecture - Non-Confidential
M-Profile Architecture - Non-Confidential
R-Profile Architecture - Non-Confidential
ABI for the Arm Architecture - Non-Confidential
Base Platform ABI for the Arm Architecture - Non-Confidential
C Library ABI for the Arm Architecture - Non-Confidential
C++ ABI for the Arm Architecture - Non-Confidential
C++ Application Binary Interface Standard for the Arm 64-bit Architecture - Non-Confidential
DWARF for the Arm Architecture - Non-Confidential
ELF for the Arm Architecture - Non-Confidential
Exception Handling ABI for the Arm Architecture - Non-Confidential
Procedure Call Standard for the Arm Architecture - Non-Confidential
Run-time ABI for the Arm Architecture - Non-Confidential
Support for Debugging Overlaid Programs - Non-Confidential
Addenda to, and Errata in, the ABI for the Arm Architecture - Non-Confidential
Whitepaper - Armv8-M Architecture Technical Overview - Non-Confidential
Armv8-M Stack Sealing vulnerability - Non-Confidential
Non-Arm resources Document ID Organization
GCC - Top (Using the GNU Compiler Collection (GCC))
GNU Binutils - https://sourceware.org/binutils
Itanium C++ ABI - C++ ABI Summary
The Security Implications Of Compiler Optimizations On Cryptography - A Review - https://arxiv.org
Using Clang as a Compiler - Welcome to Clang's documentation! — Clang 17.0.0git documentation
Automatic variable initialization - https://reviews.llvm.org
C++ implementation status in LLVM Clang - Welcome to Clang's documentation! — Clang 17.0.0git documentation
Undefined Behavior Sanitizer - Welcome to Clang's documentation! — Clang 17.0.0git documentation
Update for Universal C Runtime in Windows - https://support.microsoft.com

猜你喜欢

转载自blog.csdn.net/luolaihua2018/article/details/129804289