arm-elf 和 arm-none-eabi 工具链生成的可执行文件的格式有什么不同吗?

Sre*_*esh 4 c gcc arm elf gnu-toolchain

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

我正在使用 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'.
Run Code Online (Sandbox Code Playgroud)

提前致谢。

Sre*_*esh 5

我终于找到了问题的解决方案。我注意到,在 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 模拟试验。

  • 工具链在某些方面有所不同,包括调用时的默认“隐式”选项。如果编译器版本相同,只要提供相同的选项,基本上两个编译器都会生成相同的二进制文件。arm-none-eabi 工具链针对大多数通用用途,因此禁用了一些“花哨的”功能。此外,除了启动符号外,它通常也不包含和链接到标准库(默认情况下)。所以是的,你是对的,该选项可能在 arm-elf 中默认启用 (2认同)