繁体   English   中英

如何在 Debian 上为 armv8 cortex-a53 安装 aarch64 工具链?

[英]How to install the aarch64 toolchain for armv8 cortex-a53 on Debian?

我想在 ARM 芯片上开始低级编程。 我已经安装了 qemu 并遵循了一些 hello world 类型的示例程序,但现在我想针对最新的 Raspberry Pi,它具有 ARMv8 cortex-a53neon-fp-armv8 FPU。 我目前正在运行 Debian:

$ lsb_release -a
    No LSB modules are available.
    Distributor ID: BunsenLabs
    Description:    BunsenLabs GNU/Linux 8.5 (Hydrogen)
    Release:    8.5
    Codename:   bunsen-hydrogen

$ cat /etc/debian_version
    8.5

我目前安装了以下工具链:

binutils-arm-none-eabi
gcc-arm-none-eabi
gdb-arm-none-eabi

但是,当我尝试使用-mcpu=cortex-a53进行编译时,收到以下错误:

arm-none-eabi-gcc: error: unrecognized argument in option '-mcpu=cortex-a53'

$ arm-none-eabi-gcc --version
    arm-none-eabi-gcc (4.8.4-1+11-1) 4.8.4 20141219 (release)

我假设我有一个不包含该目标 CPU 的旧 GCC,所以我尝试下载 binutils、gcc 和 gdb 的源代码,但我无法构建 binutils。 尝试make all时总是失败。

binutils 配置:

$../../src/binutils-2.26.51/configure \
 --target=arm-none-eabi \
 --disable-nls

构建错误:

$make -j4
    checking for bison... /home/nathan/development/tools/arm/src/binutils-2.26.51/missing bison -y
    checking for flex... /home/nathan/development/tools/arm/src/binutils-2.26.51/missing flex
    checking lex output file root... configure: error: cannot find output from /home/nathan/development/tools/arm/src/binutils-2.26.51/missing flex; giving up
    Makefile:3545: recipe for target 'configure-binutils' failed
    make[1]: *** [configure-binutils] Error 1
    no
    checking for bison... /home/nathan/development/tools/arm/src/binutils-2.26.51/missing bison -y
    checking for flex... /home/nathan/development/tools/arm/src/binutils-2.26.51/missing flex
    checking lex output file root... configure: error: cannot find output from /home/nathan/development/tools/arm/src/binutils-2.26.51/missing flex; giving up
    Makefile:4834: recipe for target 'configure-gas' failed
    make[1]: *** [configure-gas] Error 1
    make[1]: Leaving directory '/home/nathan/development/tools/arm/build/binutils-2.26.51'
    Makefile:844: recipe for target 'all' failed
    make: *** [all] Error 2

为了获得工具链设置以针对 aarch64 cortex-a53架构进行编译,我需要采取哪些正确步骤?

编辑 1

通过评论发现,我需要安装aarch64工具链,而不是arm工具链。 还是一头雾水。

从 Ubuntu 18.04 开始,您可以执行以下操作:

sudo apt-get install gcc-aarch64-linux-gnu
aarch64-linux-gnu-gcc -mcpu=cortex-a53 hello_world.c

gcc-aarch64-linux-gnu的版本是4:7.3.0-3ubuntu2

但是,对于 Raspberry Pi,您应该只从https://github.com/raspberrypi/tools下载官方二进制文件,这是更可靠的方法,如: https : //raspberrypi.stackexchange.com/questions/ 64273/安装树莓派交叉编译器/83215#83215

最后,对于裸机,我找不到arm-none-eabi-gcc的类似物,我想知道为什么: https : //github.com/cirosantilli/cirosantilli.github.io/issues/68

你可以从这个Github 项目中尝试我最新的预构建开源 GCC 工具链,用于 Raspberry Pi:

本项目摘要:本项目包含 UpToDate 预编译/预构建 Raspberry pi GCC Cross & Native Compilers Binaries 集,节省您的大量时间(无需编译或错误处理)。 只需在您的机器中提取、链接和享受完整的 GCC(Raspberry Pi)功能。 您可以将其本地编译器用于 Raspberry Pi(可以与旧的和慢速 6.3.0 GCC 一起使用),或者在任何 Linux 机器上使用交叉编译器(在最新的 Ubuntu/bionic x64 上测试)为您的 Raspberry Pi 编译程序. 所有这些编译器二进制文件都是为增强整体性能而优化的 Raspberry Pi 硬件。

支持的 GCC 版本是:

  • 海湾合作委员会 6.3.0
  • 海湾合作委员会 7.4.0
  • 海湾合作委员会 8.2.0
  • 海湾合作委员会 8.3.0

支持的环境:

  • 交叉编译器:当前支持所有 Linux 发行版 (x32/x64)。
  • 本机编译器:支持所有带有 Raspbian 操作系统的 Raspberry Pi 版本/型号。 其他操作系统可能/可能不工作。

希望有帮助! :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM