In order to provide OTA firmware updates, I wrote a bootloader. For more information, see the ACRIS bootloader page.
This project will require extensive modifications to support wireless communication. The existing wireless driver needs to support automatic retransmission and have error modes that inform the master firmware updater application of failures.
This bootloader provides the following features:
- Fast startup time (i.e. bootloader->application time)
- Downloading of program to device
- Set address of instrument
- Set the transmission baud rate (via the divisor)
- Set a mask (only operate on some devices)
- View the instrument address on the debug LEDs
- Program verification (not ready)
Transmission is done through a serial protocol, which looks like
FN ARGS DESCRIPTION ___ _______ ____________________________________________________ 170 0 SYNC -- start of a packet N 0 NOP -- sent to wake bootloader up A 1 Set 1-byte address of the device in EEPROM B 2 [High][Low][Double?] -- set divisor and U2XN of the UART in EEPROM D 0 Show the high nibble of the instrument address on the debug LEDs E 0 Show the low nibble of the instrument address on the debug LEDs M 1 [InstAddr] Instrument address to work with for all following commands 0xFF - all instruments 0xF0-0xFE - blocks of 16 P 2 [Addr][Page...] - Send program one page at a time To simplify the bootloader, it does NOT take an Intel HEX file as an input. Rather, a special "program" script reads the HEX file and outputs the following format: [Starting Address][Page][Checksum] The checksum is the one's complement of the sum of the page stream. Note: this means that the stream length depends on the page size (whereas Intel HEX files have known lengths). Furthermore, it requires that unused bytes be 0-filled or something. I'd rather make the programmer R 0 BOOT - boot the application
- Enable automatic retransmission
- Allow reading bytes from EEPROM to debug LEDs
- Add ability to write to and read from any EEPROM address