[英]How to install the aarch64 toolchain for armv8 cortex-a53 on Debian?
I'm wanting to start low level programming on ARM chips.我想在 ARM 芯片上开始低级编程。 I've installed qemu and followed a few example programs for hello world type stuff, but now I want to target the latest Raspberry Pi, which has the ARMv8 cortex-a53
and neon-fp-armv8
FPU.我已经安装了 qemu 并遵循了一些 hello world 类型的示例程序,但现在我想针对最新的 Raspberry Pi,它具有 ARMv8 cortex-a53
和neon-fp-armv8
FPU。 I'm currently running Debian:我目前正在运行 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
I've currently installed the following toolchain:我目前安装了以下工具链:
binutils-arm-none-eabi
gcc-arm-none-eabi
gdb-arm-none-eabi
However, when I try to compile with -mcpu=cortex-a53
, I receive the following error:但是,当我尝试使用-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)
I assumed I had an older GCC that did not contain that target CPU, so I tried to download the source for binutils, gcc, and gdb but I am unable to build binutils.我假设我有一个不包含该目标 CPU 的旧 GCC,所以我尝试下载 binutils、gcc 和 gdb 的源代码,但我无法构建 binutils。 It always fails when trying to make all
.尝试make all
时总是失败。
binutils configuration: binutils 配置:
$../../src/binutils-2.26.51/configure \
--target=arm-none-eabi \
--disable-nls
Build error:构建错误:
$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
What are the proper steps I need to take in order to get a toolchain setup to compile for an aarch64 cortex-a53
architecture?为了获得工具链设置以针对 aarch64 cortex-a53
架构进行编译,我需要采取哪些正确步骤?
Edit 1编辑 1
Discovered through the comments, I need to install the aarch64 toolchain, not the arm toolchain.通过评论发现,我需要安装aarch64工具链,而不是arm工具链。 Still clueless.还是一头雾水。
As of Ubuntu 18.04 you can do:从 Ubuntu 18.04 开始,您可以执行以下操作:
sudo apt-get install gcc-aarch64-linux-gnu
aarch64-linux-gnu-gcc -mcpu=cortex-a53 hello_world.c
The package gcc-aarch64-linux-gnu
is at version 4:7.3.0-3ubuntu2
包gcc-aarch64-linux-gnu
的版本是4:7.3.0-3ubuntu2
However, for Raspberry Pi, you should just download the official binaries from https://github.com/raspberrypi/tools which is the more reliable way to do it as explained at: https://raspberrypi.stackexchange.com/questions/64273/installing-raspberry-pi-cross-compiler/83215#83215但是,对于 Raspberry Pi,您应该只从https://github.com/raspberrypi/tools下载官方二进制文件,这是更可靠的方法,如: https : //raspberrypi.stackexchange.com/questions/ 64273/安装树莓派交叉编译器/83215#83215
Finally, for bare metal, I was not able to find the analogue of arm-none-eabi-gcc
, I wonder why: https://github.com/cirosantilli/cirosantilli.github.io/issues/68最后,对于裸机,我找不到arm-none-eabi-gcc
的类似物,我想知道为什么: https : //github.com/cirosantilli/cirosantilli.github.io/issues/68
This Project Summary: This project contains the UpToDate set of Precompiled/Pre-Built Raspberry pi GCC Cross & Native Compilers Binaries, saving your tons of time(No compiling or Error Handling needed whatsoever).本项目摘要:本项目包含 UpToDate 预编译/预构建 Raspberry pi GCC Cross & Native Compilers Binaries 集,节省您的大量时间(无需编译或错误处理)。 Just Extract, Link & Enjoy complete GCC(Raspberry Pi) functionality in your Machine.只需在您的机器中提取、链接和享受完整的 GCC(Raspberry Pi)功能。 You can use its native compilers for Raspberry Pi(Can be used along with old & slow 6.3.0 GCC), Or use the Cross-Compiler in any Linux Machine(Tested on Latest Ubuntu/bionic x64) to compile programs for your Raspberry Pi.您可以将其本地编译器用于 Raspberry Pi(可以与旧的和慢速 6.3.0 GCC 一起使用),或者在任何 Linux 机器上使用交叉编译器(在最新的 Ubuntu/bionic x64 上测试)为您的 Raspberry Pi 编译程序. All these compilers binaries are Raspberry Pi hardware optimized for enhanced overall performance.所有这些编译器二进制文件都是为增强整体性能而优化的 Raspberry Pi 硬件。
The Supported GCC Versions are:支持的 GCC 版本是:
Supported Environments:支持的环境:
Hope that helps!希望有帮助! :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.