Overview

edit

Normally, the boot sequence is:

  • the USB DFU bootloader at 0x8000000-80001FFF (8KB), which checks if the user button is pressed and, if it isn't, runs:
  • the eLua interpreter at 0x80002000

emBLOD is an embedded boot loader that replaces eLua at 0x80002000 and loads a modified version of the eLua interpreter code from a file on a FAT-formatted SD card into the start of the 32MB SDRAM then executes it there. It is fast to start up (a fraction of a second) and gets round the 120KB code size limit of the Mizar32 model C.

The downside is that when loaded into SDRAM instead of Flash, the eLua interpreter runs at one sixth of the speed. However, if you need floating point or ethernet support on a Mizar32 model C, this is the only way to do it.

Compiling emBLOD from source

edit

emBLOD is an open source code project hosted at http://github.com/cmp1084/emBLOD

To fetch and build the source on Ubuntu you will need to install:

apt-get install git dfu-programmer 

and the avr32 GCC cross-compiler, for which instructions are at the start of the compiling Alcor6L page.

The boot loader can be built from source as follows:

git clone https://github.com/cmp1084/emBLOD
cd emBLOD
make

which creates two versions of the same object file: emblod.elf and bin/emblod.bin. However, dfu-programmer requires a .hex file, so convert it:

avr32-objcopy -O ihex emblod.elf emblod.hex

then connect the Mizar32 to your PC over USB, reset or power-on the board while holding SW2 depressed and issue these commands on the PC:

dfu-programmer at32uc3a0128 erase
dfu-programmer at32uc3a0128 flash emblod.hex
dfu-programmer at32uc3a0128 start

If you have the serial port connected at 115200-8-N-1, you will see messages issued by emBLOD.

Compiling Alcor6L for emBLOD

edit

You should already be familiar with compiling Alcor6L.

Use eLua 0.9, add

bootloader=emblod

to the scons compilation command. This will create an ELF file, which you should convert to a BIN file using

avr32-objcopy -O binary *.elf autorun.bin

and copy autorun.bin to the root of a FAT-formatted micro SD card for the Mizar32.