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

问题描述 投票:6回答:2

我想在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工具链。还是一无所知。

gcc arm toolchain
2个回答
4
投票

从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/installing-raspberry-pi-cross-compiler/83215#83215

最后,对于裸机,我无法找到arm-none-eabi-gcc的类似物,我想知道为什么:https://askubuntu.com/questions/1049249/is-there-a-package-with-the-aarch64-version-of-gcc-arm-none-eabi-for-bare-metal


0
投票

You can try my Latest Pre-Built Open-Sourced GCC Toolchains for Raspberry Pi from this Github Project:

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

支持的GCC版本是:

  • GCC 6.3.0
  • GCC 7.4.0
  • GCC 8.2.0
  • GCC 8.3.0

支持的环境:

  • 交叉编译器:目前支持所有Linux Distros(x32 / x64)。
  • Native-Compiler:支持所有带Raspbian OS的Raspberry Pi版本/型号。其他操作系统可能/可能不起作用。

希望有所帮助! :)

© www.soinside.com 2019 - 2024. All rights reserved.