circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

February 2006, Issue 187

Robust Bootloader for FPGAs


The size of 207 words is a pretty small bootloader, especially considering that that includes both the FPGA loader and AVR loader. The key is that, when programming an FPGA, you need somewhere to store the programming file. I used an Atmel AT45DB041B DataFlash serial interface flash memory for this project. It’s inexpensive, small (eight-pin SOIC), and easy to use. Compared to the 1.5 Mb that my FPGA uses, the AVR’s 64-Kb programming file is barely noteworthy.

The magic comes in here. The bootloader resident in the ATmega88 microcontroller is less than 256 words; all it’s able to do is load data from the DataFlash memory into the AVR and FPGA. During normal start-up, data is loaded from the AT45DB041B to the FPGA and program execution starts in the ATmega88’s flash memory.

There are set bootloader sizes for the ATmega88, so the tinyloader fits in the 256-word space. (“Tinyloader” refers to the program native to the ATmega88 AVR. “LUB,” “lub,” and “bootloader” refer to the code loaded in the ATmega88 AVR for the purpose of bootloading. “Lubloader” refers to the computer program that is the user interface.) This means there is room for expansion yet! If you want to add some sort of encryption that would prevent an attacker from simply reading out the AT45DB041B, there’s room for it.

When bootloading is requested, a bootloader program is loaded from the AT45DB041B memory into the ATmega88’s flash memory. This bootloader isn’t restricted to work only in the confines of the ATmega88’s bootloader section. Now the bootloader can take up all the available application space for the program. Instead of downloading the file to the ATmega88’s code memory, the code is downloaded to the AT45DB041B. The tinyloader takes care of loading the user program from the AT45DB041B to the ATmega88’s application space.