11

I have some experience compiling bare metal code for ARM cortex-m devices as well as the Linux kernel, uBoot, and applications for the Beaglebone Black (BBB) (more featured ARM with MMU, for those living under a rock). It makes sense to me that the cortex-m code should be compiled using arm-none-eabi-gcc (as there is no OS) and the application code for the BBB should be compiled with arm-linux-gnueabi-gcc (as there is an OS, for which system calls can be made and program loaders and shared objects can be utilized).

What I don't understand is why uBoot and the kernel also should be compiled with arm-linux-gnueabi-gcc. In my mind, uBoot at least, is a bare metal program with no fancy OS to account for. This has been bugging me for sometime, but I can't find an answer. Is there anyone out there that can enlighten me?

Darren Ng
  • 373
  • 5
  • 12
Joshua DeWeese
  • 330
  • 1
  • 9
  • Where did you learn this *"uBoot [sic] and the kernel also should be compiled with arm-linux-gnueabi-gcc"*? I've seen U-Boot and the Linux kernel compiled with the same toolchain (e.g. in Buildroot) presumably because of convenience. But I typically use a baremetal toolchain for bootloaders such as U-Boot (i.e. I build two toolchains). – sawdust Nov 07 '15 at 19:00
  • I just assumed from examples such as [this](http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User's_Guide#Building_U-Boot). Are you saying that uBoot can actually be compiled with either? What about the kernel? – Joshua DeWeese Nov 08 '15 at 02:00
  • 2
    When compiling .c into .o, the ABI you choose affects which registers are used for parameters, stack-layout etc. When linking the .o into an executable, the ABI have a default linker script and helper objects. But both the kernel and probably u-boot provides their own linker scripts etc, so the ABI for this step is not so important – Stian Skjelstad Mar 24 '17 at 13:56
  • This question has been answered here : https://stackoverflow.com/questions/38956680/difference-between-arm-none-eabi-and-arm-linux-gnueabi – Anna Lyons Nov 29 '18 at 23:59
  • @JoshuaDeWeese [processors.ti.wiki.com EOL](https://e2e.ti.com/support/processors/f/processors-forum/916040/eol-of-processors-wiki-ti-com-resource). Link dead. Archive [here](https://web.archive.org/web/http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User's_Guide#Building_U-Boot). – Darren Ng May 05 '21 at 16:31

1 Answers1

-2

U-Boot was designed to mirror the Linux design philosophy as much as possible. It uses the same configuration system, general directory structure, etc. It shares some APIs with Linux - see the include/linux directory. As the comments above mention, the ABI compatibility doesn't matter at this point, but using a Linux compiler isn't philosophically inappropriate for U-Boot.

John Moon
  • 924
  • 6
  • 10