4
votes

I am trying to build a bare metal arm project. I tried the GNU toolchains arm-elf and arm-none-eabi. Executables generated by both toolchains, when converted to intel hex format, runs fine.

I am using the software Proteus for simulation. Proteus supports debugging executables in both elf and coff format.

In my case Proteus accepts the executable generated by arm-elf but its showing error when loading the executable generated by arm-none-eabi. The error message shown by Proteus is:

enter image description here

I just ran the file command in linux with the two executables as argument, one by one.

The results are shown below.

arm-none-eabi output

image: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

arm-elf output

image: ELF 32-bit LSB executable, ARM, version 1, statically linked, not stripped

Is there any option to generate Proteus compatible elf file using arm-none-eabi toolchain?

Edit: Details of my tollchains' versions.

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'.

Thanks in advance.

1
Probably it depends on gcc version. There are various options that your should look at (in some versions). For instance, -mabi will control some eabi parameters. You could ask the vendor of Proteus (and they should support a wider variety of ELF files for a better product).artless noise
where did you get these toolchains or did you build them yourself from the same gnu sources? If not built from the same gnu sources, then who knows what differences there will be. But even from the same sources those, normaly triplets, arm-none-eabi, arm-linux-gnueabi, (arm-none-elf, arm-elf) etc trigger a number of build options, any one of those or a combination of them might do something to the elf file that Proteus supports. I agree with artless noise though the problem here is Proteus not supporting elf files generally, and/or putting the blinders on to a specific subset or flavorold_timer
I dont remember if arm-elf builds anymore with the current sources, might have to go back a few, but an interesting experiment would be to build arm-none-eabi and arm-elf from the same binutils and gcc, take a very small project maybe even just a branch to self, build that (well that would be binutils only no need for gcc)(actually binutils is likely the package generating all the elf files anyway). and use a hex dump tool or some other to see if there are any actual differences. I suspect you may not be fighting arm-elf vs arm-none-eabi but instead one binutils version to another.old_timer
can you post the versions of each arm-elf-as --version arm-elf-gcc --version arm-none-eabi-as --version, etc.old_timer
@dwelch I have updated my question with version details of my toolchainSreeyesh

1 Answers

5
votes

I finally found out the solution for the issue. I noticed that, in Proteus, there is option to configure the toolchain and build the source code from Proteus itself.

I just did the foloowing things

  1. Selected GNU ARM toolchain from the list of supported compilers
  2. Configured the tool chain path to point to my arm-none-eabi tool chain.
  3. Created a new project with an empty main function.
  4. Built the project.

The build was successful and more interestingly I could debug the executable.

Proteus logs the build commands. When I analysed the logs, I noticed that some extra options being used by Proteus when invoking arm-none-eabi-gcc. I experimented with those extra options and finally found out that the option -gdwarf-2 plays the key role.

I updated my makefile with this option and it worked fine.

This option simply enables DWARF version 2 format, That's all what I understood from the web search. But why arm-elf toolchain worked without this option is still a question in my mind. May be, this option is enabled in arm-elf by default.

Anyway I am satisfied with this finding as I can proceed with my work now.

Thanks to all those who spared their precious time to help me out. Hope this finding will help people experimenting with Proteus simulation using GNU ARM toolchain.