Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
New Bootloader (in progeress)
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.
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).
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.