9
votes

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?

1
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
I just assumed from examples such as this. Are you saying that uBoot can actually be compiled with either? What about the kernel?Joshua DeWeese
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 importantStian Skjelstad
This question has been answered here : stackoverflow.com/questions/38956680/…Anna Lyons
@JoshuaDeWeese processors.ti.wiki.com EOL. Link dead. Archive here.Darren Ng

1 Answers

-2
votes

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.