与 Terry Guo 的 gcc-arm-none-eabi 交叉编译

标签 c linux ubuntu gcc cross-compiling

我正在尝试使用 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。这可以通过以下方式解决:

  1. sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
  2. sudo apt-get autoremove
  3. sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
  4. sudo apt-get 更新
  5. 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/

相关文章:

c - 寻找新位的优化方法

c - Linux ps命令核心随机

python - 守护程序输出未写入 TXT

c - 任意浮点精度数到字符串

凯撒密码无法正常工作 C

c - I2C 通信和轮询

node.js - 运行 'ionic capacitor build android' 和 npm install 时出错

linux - 创建 vue 权限被拒绝

c - 将 C 程序分成 void 函数

linux - KASAN 在调用 copy_from/to_user 时提示