我正在尝试使用 Terry Guo's gcc-arm-none-eabi 测试交叉编译.简而言之,以下是在 Ubuntu 上安装的步骤:
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
- sudo apt-get 更新
- sudo apt-get install gcc-arm-none-eabi
我遇到的问题是找不到文档(或 I'm doing something wrong )。我知道我不能索要文档或其他场外资源,所以我开门见山:
- 编译器的名称是什么?
- 编译器位于何处?
arm-eabi
header 位于何处?arm-eabi
库位于何处?arm-eabi
sysroot
位于何处?
$ find /usr -iname *arm-eabi*
$ find /usr -iname *gcc-arm*
/usr/share/lintian/overrides/gcc-arm-none-eabi
/usr/share/doc/gcc-arm-none-eabi
$ info gcc-arm-none-eabi
No menu item `gcc-arm-none-eabi' in node `(dir)Top'.
$ man gcc-arm-none-eabi
No manual entry for gcc-arm-none-eabi
最佳答案
问题是我在 Ubuntu 14 上安装了 Debian 的贫血 arm 嵌入式工具;而不是 Terry Guo 的工具,即使我添加了 Guo 的 PPA。这可以通过以下方式解决:
- sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
- sudo apt-get autoremove
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
- sudo apt-get 更新
- sudo apt-get install gcc-arm-none-eabi=4-8-2014q2-0trusty10
有了适当的包装:
What is the name of the compiler?
Where is the compiler located?
/usr/bin/arm-none-eabi-gcc 和 friend 。
Where are the arm-eabi headers located?
Where are the arm-eabi libs located?
Where is the arm-eabi sysroot located?
SYSROOT 是/usr/lib/gcc/arm-none-eabi/4.8.2/armv7-m。
我还需要使用 -mcpu=cortex-m3
进行编译, -mthumb
和 --specs=nosys.specs
.
相关:Ubuntu 将在 upgrade
期间尝试升级 Guo 的软件包或 dist-upgrade
.可以通过固定 Guo 的包裹来修改该行为。要固定郭的包裹,请将以下内容添加到 /etc/apt/preferences
:
Package: binutils-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900
Package: gcc-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900
感谢 Super User 上的 grawity的信息。参见 Permanently block distro package installation? .
关于与 Terry Guo 的 gcc-arm-none-eabi 交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25839084/