Beaglebone bootloader

I was thinking in developing bootloader for beaglebone as kind of self study and getting better in the field , do you think it worth the effort and is it feasible?
I understand in this case it would replace the ubot right?
Did anyone try it before or has any guide or materials for that and how to start?

I was thinking in developing bootloader for beaglebone as kind of self study and getting better in the field , do you think it worth the effort

It is a very useful lesson.

and is it feasible?

For sure. The Staterware bare metal library has been useful, though it hasn’t been maintained.

I understand in this case it would replace the ubot right?

Or, you could just run a bare metal app. Up to you. U-boot start-up is simpler to understand than the Linux kernel start-up, but neither is super, super simple.

I’d probably start by creating an app I could load from u-boot itself and run it to have the hardware do something like blink an LED or otherwise tell me it is running. Then, I’d start to look at how I format that same application to be loaded by the ROM bootloader.

Doing something in ARM assembly could be especially empowering, because then you can decipher the actual opcodes in the binary image you create. You can also have the compiler generate assembly listings from C files, which will give you a starting point for creating your own assembly or at least help you map instructions to the binary image. If you are trying to understand how things work at the lowest levels, this can really give you confidence the processor is running exactly what you are providing it, with some caveats.

Did anyone try it before or has any guide or materials for that and how to start?

Doubt anyone has done a really nice write-up, but I could be wrong.

Check out https://diydrones.com/profiles/blogs/booting-up-a-beaglebone-black

Of course, most people looking at bare metal will encourage a JTAG connection.

Such as https://www.twosixlabs.com/running-a-baremetal-beaglebone-black-part-1/.

That’s why I suggest trying to run a very simple application that gives some indication, like toggling a GPIO, in u-boot. Even there you have to deal with the fact a lot of things get setup ahead of time.

Getting a write-up that doesn’t require JTAG would be great.

Another super example to look at is https://github.com/ravikp7/BeagleBoot. It uses the ROM bootloader to load an application over USB. Unfortunately, the application loaded as part of the example is rather complicated (u-boot, kernel, etc.), but the fact you are booting over USB rather than uSD/eMMC gives you some live interaction such that you have confidence the processor is looking at the code you are providing. Breaking this down a bit, you can see the original project it was based on, https://github.com/ungureanuvladvictor/BBBlfs.

The advantage of USB is that it doesn’t require any additional hardware with a BeagleBone Black. However, the absolutely most direct way of bootloading in a way where you can observe the initial interactions is over the UART. Check out http://labs.isee.biz/index.php/Firsts_steps_with_AM335x#UART_recovery_boot for an example. Again, the example uses a complicated application (u-boot).

Perhaps the very best write-up I’ve seen is https://octavosystems.com/app_notes/bare-metal-on-osd335x-using-u-boot/. Even though it talks about the OSD3358, that is based on the same circuit used on the BeagleBone Black.

Good luck and keep us informed. Be sure to reach out on #beagle on irc.freenode.net if you get stuck. I’m ‘jkridner’ there.