19

What is the difference between arm-none-eabi and arm-linux-gnueabi? I know the difference in how to use them (one for bare metal software, the other one for software meant to be run on linux). But what is the technical background?

I see there is a difference in the ABI which is, as far as I understood, something like an API but on binary level. It ensures interoperability of different applications.

But I don't really understand in which way having or not having an operating system affects my toolchain. The only thing that came to my mind is, that libraries maybe have to be statically linked (do they?) while compiling bare metal software, because there is no os dynamically providing them.

The most pages I found related to this toppic just answered how to use the toolchains but not the technical background. I'm a student of mechatronics and new to embedded systems, so my experience in this field is somewhat limited.

sepp2k
  • 363,768
  • 54
  • 674
  • 675
ChrsBr
  • 313
  • 1
  • 2
  • 7
  • Yes it is mostly a library thing, trying to tune for running on linux (libc, etc) vs I think newlib. For bare metal work, either is fine as they can both make assembly from C and make objects from assembly and link with your own linker scripts, etc. And the bare metal i am talking about is one without standard libraries and/or you use this tool to create your own libraries from sources. Basically they both work as generic cross compilers, if you want/need built in library support, then it may matter which one you use. – old_timer Aug 15 '16 at 15:04
  • @dwelch: There is no need to use any library on bare-metal. You just **possibly** have to provide some functions (mostly `memcpy`, etc.) gcc might call (e.g. when assignming `structs`). – too honest for this site Aug 15 '16 at 15:06
  • @Olaf I dont use C libraries on bare metal, but some folks do, and of those some use newlib (or whatever is friendly to that build), and of those some want to use arm-none-eabi instead of arm-linux-gnueabi because it does matter to them. So it depends on what the OP is targeting as to whether or not the differences matter. – old_timer Aug 15 '16 at 16:44
  • @dwelch: I strongly doubt arm-linux-gnueabi will work for bare-metal systems. Never tried it, though. For one, iirc, `arm-none-*` is a freestanding implementation by default, so it does not rely on the C stdlib for hosted systems and gcc does not use its built-in optimisations for certain standard library functions. – too honest for this site Aug 15 '16 at 16:49
  • 1
    @Olaf most if not all of my work and personal bare metal code can use either variant as I dont rely on anything but a compiler that can make asm from C and assembler that can make machine code from asm, and a linker that links only the things I have supplied together. It is very dependent though on the user and their code and build system. More likely to get tripped up with the *-linux-* one. And yes the gcc lib things can very quickly get system dependent so I control those as well. – old_timer Aug 15 '16 at 17:04
  • @dwelch: Same for me. That way I have to search problems in my own parts nad not some 3rd source libraries. As I wrote, I never tried and never researched about the differences. Maybe the question is not that bad after all. I did not talk about the libgcc, but the C standard library as implemented e.g. by newlib or glibc. `libgcc` is hardly to avoid, but of course, you can implement its functions in your own library (I don't see much sense in that, though, as it has no external dependencies and is target-specific). – too honest for this site Aug 15 '16 at 17:16

1 Answers1

12

Maybe this link to a description will help.

Probably the biggest difference:

"The bare-metal ABI will assume a different C library (newlib for example, or even no C library) to the Linux ABI (which assumes glibc). Therefore, the compiler may make different function calls depending on what it believes is available above and beyond the Standard C library."

akhan
  • 2,952
  • 2
  • 22
  • 13
FlorianB
  • 169
  • 3
  • 5
    Link Down! :( :( – hEShaN Jun 30 '20 at 01:45
  • @hEShaN Try [this](https://wiki-archive.linaro.org/WorkingGroups/ToolChain/FAQ#What_is_the_differences_between_.2BIBw-arm-none-eabi-.2BIB0_and_.2BIBw-arm-linux-gnueabihf.2BIB0.3F_Can_I_use_.2BIBw-arm-linux-gnueabihf.2BIB0_tool_chain_in_bare-metal_environment.3F_How_do_you_know_which_toolchain_binary_to_use_where.3F) – akhan Aug 10 '21 at 16:05