Howto: Re-program Bubba (one) FLASH

A collection of tips on howto tweak your Bubba.
Post Reply
Posts: 1470
Joined: 31 Dec 2006, 07:12
Location: Sweden

Howto: Re-program Bubba (one) FLASH

Post by johannes » 05 May 2008, 17:39

Hi all. On request, a very brief howto on how to restore the contents of the FLASH, without having a running system. This requires Linux knowledge, so I won't write down all details. If I forget anything though, don't hesitate to ask.
This is untested and parts of it written down from memory, so use it on you own risk.

The FLASH normally contains three things: The bootloader, the initrd (rescue file system) and the Linux kernel. It is writeable from within Linux, so upgrading the kernel can be done without this howto, but if it fails, or if you would like to do some low-level development, this might be handy.

This guide uses the same tools as the Bubba factory uses when programming fresh boards. The hardware is very simple, only a slightly modified USB-cable is needed.

This is how it works
We are using the AT91RM9200 built in hardware bootloader (not to be confused with the soft bootloader mentioned above), that can copy data from USB (PC) to the internal RAM. Now, the problem is that it can't write to FLASH (since it can't know what flash we have chosen to put there), so we have to load an intermediate bootloader (referred to as bootstrap loader in this guide) in to the RAM, that can copy the real binaries from the PC to the FLASH. The next catch is that the internal RAM is only 16 kB, so we can't throw in too much functionality. But first:

Step 1) Building the hardware
You need a regular A-B USB cable:
41BJB7ZK2HL._SL500_AA280_.jpg (8.24 KiB) Viewed 5392 times
Somewhere in the middle, cut open the isolator and dig through the shield carefully, without damaging the four interternal wires. Or, if you find it simpler, just cut the entire cable in two and later re-connect the two unused wires, and the shield.
Now, you need to solder a 1.5 kOhm resistor between D+ and VCC. D+ is normally green, and VCC is normally red, but don't count on it, I have seen several cables with randomly coloured internal wires. Measure and compare to a pin-out listing (google for it). To test the cable, connect the 'A' end to your PC. Windows should detect it as a USB device, and then define it as an 'Unknown device'. Check your device tree listing to see that it's a "full speed" device. If it's recognised as a low-speed device, you have connected the resistor between D- and VCC instaed of D+.
This is how mine ended up:
DFU_cable.jpg (13.62 KiB) Viewed 5392 times
Step 2) Installing the software
The host software (requiring Linux) can be found at I'll simply assume that you'll get it working without instructions. Remember to always run it as root.

Step 3) Compiling the bootloader
This is optional, you may have a backup-copy of the bootloader already. If not, or if you wan't to change something, download the source from:
You need a cross-compiler for ARM installed, but again, I'm sure you'll work that out with help from the make-file. :)
If you wan't to change the MAC-adress for your board (this is set in the bootloader), just change in config.h.
It may also be easier to email us and ask for a boot-loader binary with your original mac adress.

Step 4) Compiling the bootstrap loader
Download the source from Again, I guess you'll work it out. :) Name it: "usbboot.bin" and place it in the same folder as the programmer (base).

Step 5) Downloading to FLASH
Now the fun begins.

1) Start the programmer software (as root!).
2) Power up your Bubba board (with or without HDD, doesn't matter)
3) If the LED blinks, the original bootloader has started, and the board won't initiate the hardware bootloader. If it doesn't blink - jump to step 4.

Pause - how to disable the original bootloader

You have two options to disable the original bootloader, either delete it from within Linux (which may be impossible if your system is down), or disable the FLASH in hardware. The latter is quite simple even though you need a steady hand. You need to short two signals on the board, the FLASH MDO pin and GND. This prevents the CPU to recognize the flash contents upon boot, and the CPU will instaed launch it's hardware bootloader. I usually use a pair of tweezers, but I guess there are other ways.
See this image for detail:
flash_short.jpg (49.98 KiB) Viewed 5392 times
So: Unplug the power, shorten the two signals and re-plug the power. Wait three seconds and then remove the short. Now, if the LED won't blink you have succeded. If it still blinks, try again.

4) Plug in the modified USB cable between Bubba and your PC.
5) In the programmer software - select target - bootstrap. You will see a bunch of error messages, this is normal.
6) Unplug the USB cable from the PC (note, it's important that you unplug this side, just unplugging the Bubba side won't do it)
7) Select target - ping. It should respond "Ping returned: 0". Now, you are in contact with the downloaded bootstrap loader!
8) Now select Flash - Download. Erase isn't neccessary, download does that too. Browse to the file you wan't to download and type the target adress. Adresses are:

0xC0000000 - FLASH base adress. This is where the bootloader goes
0xC019C800 - initrd location
0xC0010800 - kernel location

Press OK and wait until it finishes. All done! :)

Note: If you wan't to flash several locations you have to re-start the programmer tool in between. You also have to unplug and re-plug the USB cable in between. There is no need to power-cycle the board however, so you can keep the bootstrap loader in memory throughout all three programmings.

And again, if I left something out, let me know.
/Johannes (Excito co-founder a long time ago, but now I'm just Johannes)

Posts: 106
Joined: 13 Jan 2007, 06:03
Location: Venice

Re: Howto: Re-program Bubbas FLASH

Post by msx » 04 Aug 2009, 03:59

hello, do you mind fixing the image links ? i'm going to recompile the kernel and i'm probably going to need this stuff :)

Posts: 474
Joined: 07 May 2008, 04:41

Re: Howto: Re-program Bubbas FLASH

Post by carl » 04 Aug 2009, 10:57

msx wrote:hello, do you mind fixing the image links ? i'm going to recompile the kernel and i'm probably going to need this stuff :)
/Carl Fürstenberg, Excito Software Developer

Post Reply