4

我正在尝试构建一个裸机臂项目。我尝试了 GNU 工具链arm-elfarm-none-eabi. 两个工具链生成的可执行文件在转换为 intel hex 格式时运行良好。

我正在使用 Proteus 软件进行模拟。Proteus 支持调试 elf 和 coff 格式的可执行文件。

在我的情况下,Proteus 接受生成的可执行文件,arm-elf但在加载生成的可执行文件时显示错误arm-none-eabi。Proteus 显示的错误信息是:

在此处输入图像描述

我只是file在 linux 中以两个可执行文件作为参数运行该命令,一个接一个。

结果如下所示。

arm-none-eabi 输出

图片:ELF 32 位 LSB 可执行文件,ARM,EABI5 版本 1 (SYSV),静态链接,未剥离

手臂精灵输出

图片:ELF 32 位 LSB 可执行文件,ARM,版本 1,静态链接,未剥离

是否有任何选项可以使用 arm-none-eabi 工具链生成与 Proteus 兼容的 elf 文件?

编辑:我的收费链版本的详细信息。

C:\SysGCC\arm-elf\bin>arm-elf-gcc.exe --version
arm-elf-gcc.exe (GCC) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\SysGCC\arm-elf\bin>arm-elf-as.exe --version
GNU assembler (GNU Binutils) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-elf'.

sreeyesh@ITP-PTLX118:~$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:4.9.3+svn227297-1) 4.9.3 20150529 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

sreeyesh@ITP-PTLX118:~$ arm-none-eabi-as --version
GNU assembler (2.25-10ubuntu1+5build1) 2.25
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-none-eabi'.

提前致谢。

4

1 回答 1

5

我终于找到了问题的解决方案。我注意到,在 Proteus 中,有一个选项可以配置工具链并从 Proteus 本身构建源代码。

我只是在 Proteus 中做了以下事情

  1. 从支持的编译器列表中选择 GNU ARM 工具链
  2. 将工具链路径配置为指向我的 arm-none-eabi 工具链。
  3. 用空的 main 函数创建了一个新项目。
  4. 建了项目。

构建成功,更有趣的是我可以调试生成的可执行文件。

Proteus 记录构建命令。当我分析日志时,我注意到 Proteus 在调用 arm-none-eabi-gcc 时使用了一些额外的选项。我尝试了这些额外的选项,最后发现选项-gdwarf-2起着关键作用。

我用这个选项更新了我的makefile,它工作得很好。

此选项仅启用 DWARF 版本 2 格式,这就是我从网络搜索中了解的全部内容。但是为什么 arm-elf 工具链在没有这个选项的情况下工作仍然是我心中的一个问题。也许,这个选项默认在 arm-elf 中启用。

无论如何,我对这一发现感到满意,因为我现在可以继续我的工作了。

感谢所有抽出宝贵时间帮助我的人。希望这一发现能帮助人们使用 GNU ARM 工具链进行 Proteus 模拟实验。

于 2016-02-18T07:51:38.117 回答