Aus LaborWiki
Wechseln zu: Navigation, Suche

Release status: beta [box doku]

Description Funk Bootloader für AVRs mit RFM12
Author(s)  Soeren, Hansinator
Last Version  0.1 ()
Platform  AVR Microcontrollers
License  GPL

The Nakkaloader is a bootloader for AVR Microcontrollers. When installed on the target device, it allows you to flash your AVR with a RFM12 radio transceiver module.

The project consists of two parts: Host and microcontroller firmware (the bootloader). The host software is designed to be used with a Rfm12usb device.

Installation[Bearbeiten | Quelltext bearbeiten]

Bootloader Firmware[Bearbeiten | Quelltext bearbeiten]

  1. Get the latest copy of the nakkaloader from our svn (see link on the left)
  2. cd into the firmware directory and edit the Makefile to suit your needs (set appropriate parameters for your MCU, programmer device & frequency)
  3. edit rfm12_config.h, set the appropriate pins for your hardware device
  4. run "make all install fuse"
  5. eventually set an address for the device (see instructions below)

Host software[Bearbeiten | Quelltext bearbeiten]

  1. cd into the directory "host/flasher"
  2. type "make" to compile
  3. run "nakkaloader firmware_file.bin address" (example: "nakkaloader main.bin 0xA3")

Protocol[Bearbeiten | Quelltext bearbeiten]

Nakkaloader Protokoll 1.0

The protocol is shown on the left. It is relatively simple in order to keep it small in terms of code size. When the microcontroller is powered up or reset, it sends out its configuration. If it doesn't receive an answer within a given time, it starts the application code as normal.

In case the device receives a reply, it accepts the following instructions from the master:

PAGE_FILL :: Fill the page buffer[Bearbeiten | Quelltext bearbeiten]

The bootloader fills its page buffer, creates a crc16 checksum over the received data and sends it back to the master.

PAGE_COMMIT :: Write the page buffer[Bearbeiten | Quelltext bearbeiten]

This command lets the bootloader commit the current page buffer and writes it to the flash.

BOOT :: Boot the application[Bearbeiten | Quelltext bearbeiten]

Start the application & disable interrupts.

Error handling[Bearbeiten | Quelltext bearbeiten]

Errors are exclusively handled by the host software in order to keep the bootloader small and therefore compatible with a broad range of devies. In its current Version the bootloader utilizes 1.8 Kilobytes on an ATmega8.

Whenever the host software detects that there's been an error (i.e. a wrong crc16 checksum), it just sends the appropriate segment again. When all received checksums were found to be correct, it commits the page.

Security[Bearbeiten | Quelltext bearbeiten]

In its current version, data is sent unencrypted and unauthenticated. The mayor reason for this is, because all possible (secure) ciphers or hmac functions are too big (in terms of flash size) to fit into 2K of flash. This is the maximum size we allowed for this project in order to let it run on an ATmega8 and similar controllers.

If you want, you may however add encryption and/or authentication on your own (see AVR-Crypto-Lib). Mind that you probably need a device that supports bootloaders greater than 2K.