Can ELF be executed under U-boot

hi all,

I compiled a c code using an ARM cross-compiler toolchain to generate
an ELF -arm file. I have no problems running this ELF file under
Ångström. But I'm wondering if I can run this file under U-boot
without a RTOS?


u-boot has some facilities to execute (elf) code as a sort of
'extension' within the u-boot environment, and I think it even gives
you a few calls for very basic stuff like memory and serial i/o. I
haven't actually used it though, probably better off looking at the u-
boot docs - I know it is there.

Presumably you know 'no os' means you have to do absolutely everything
yourself ... e.g. even serial output has to bang the hardware, so a
normal linux binary wont work obviously since it has no kernel to

If that's what you really want, perhaps have a look at my puppybits
project ( which has a collection of routines
and some basic build scripts for bare-metal hacking. There's code to
turn on video, make a beep, enable the fpu, enable cpu caches (needs
the mmu turned on/setup properly), handle interrupts, dump the
registers on error, etc. It's more or less just my personal workspace
for finding out about the hardware and playing with ideas, but you
might find something there if that's what you're after (it probably
represents a full-time month of `guru-mediations', so it could save
you some grey hairs).

It builds images which appear as 'linux kernels' to u-boot and are
fairly straightforward to boot. The images start as elf but the elf
header gets stripped since it isn't necessary. I have a simple script
which loads them over the serial console and executes them every time
i hit the reset button or power it up - I have no jtag debugger ... so
that means a lot of reboots and printf-debugging. Ahh, a lot of

Currently no examples use a C library, but newlib is fairly easy to
add support for (well obviously file i/o wont work).


File I/O is pretty easy to get going on newlib, theres stubs and even fs libs that can be pulled over from devkitPro:

The interesting bits are the sources for libfilesystem and libfat.

These libs are proven to work on the ARMv4/ARMv5 (the cpus in the NintendoDS & Gameboy), and should work fine on ARMv7.
They are also in use on PPC (Gamecube and Wii) so the code should be reasonably portable to other 32bit cpus.

I'm fairly sure that dkA toolchain can be used to build binaries like you want as well. You'll just have to provide the right -march / -mcpu options.

- Grizzly

NotZed wrote: