New Bootloader (in progeress)

Frederik Walk edited this page Jul 1, 2015 · 1 revision

Architecture

The new bootloader uses the network and mac drivers of the contiki OS, both to keep things simple and to stay up-to-date with current developments. For access to the non-volatile memory, the nvm app of the main firmware is used to keep track of the memory layout.

A first, yet untested implementation is in the fw-bootloader branch.

Checksum

For a more reliable checksum, the AES module of the RF transceiver is used in ECB mode, but in an CBC like fashion. The contents of the flash memory are ciphered in blocks of 16 bytes after they were XORed with the previous result. Unused parts of the flash have to be set to 0xFF. The encryption to key has to be the same for all devices (currently 16 times 0x39).

Protocol

When entering the bootloader, the device periodically broadcasts flash_request frames on the broadcast PAN ID, containing an device type identifier specifying the size of the flash memory.

On receiving a flash request, the host begins unicasts of flash_data packages to the device. Those a memory address and the corresponding 64k of flash content. On receiving a correct package (addresses must be sent consecutively), the device ACKs the write to the address. The content is written to the flash and the next increment of the checksum is calculated on the device. On receiving an ACK packet, the host continues to sending the next 64k chunk of data.

After the last chunk was ACKed, the hosts sends a flash_finish packet, containing the final checksum. The device fills the remaining flash with 0xFF and calculates its own checksum. It verifies the checksum and sends an ACK or NACK packet for address -1 respectively.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.