t-boot - compact and crossplatform AVR bootloader

AVR bootloader

Description:

tboot Loader is a ultra small (only 256 bytes) opensource boot loader for AVR microcontrollers, it's used for programming flash using a serial link between your computer and the microcontroller through any free COM port (or USB to serial adapter).
tboot consists of two parts:
1. on chip boot loader, that resides at the boot section of the flash memory, this loader based on SSBL bootloader
2. windows software, the console utility, that has the responsibility of writing/reading data into/from the microcontroller

Tested on devices:

ATmega8, ATmega8535, ATmega32;

If you used tboot Loader with other devices, please inform me (otrifonow@gmail.com).

Requirements:

  • Microsoft Windows (tested on XP and Vista), Linux or Mac OS X
  • A free serial port (or USB port + USB to serial adapter)
  • WinAVR

Command line usage syntax

(similary avrdude):
Usage: tboot [options]
Options:
  -p <partno>         Specify AVR device.
  -b <baudrate>       Override RS-232 baud rate.
  -C <config-file>    Specify location of configuration file.
  -p <partno>         Specify AVR device.
  -b <baudrate>       Override RS-232 baud rate.
  -C <config-file>    Specify location of configuration file.
  -P <port>           Specify connection port.
  -U <flash|eeprom>:r|w|v:<filename.ext>
                      Memory operation specification.
                      Multiple -U options are allowed, each request
                      is performed in the order specified.
  -n                  Do not write anything to the device.
  -V                  Do not verify.
  -v                  Verbose output.
  -q                  Quell progress output.

For example:

tboot -U flash:w:data.hex

writes firmware from data.hex file into avr

tboot -U flash:r:data.bin

reads flash memory from avr to data.bin file.

The file expansion should be .hex or .bin for Intel hex or simply binary file format.

 

Serial protocol

Each command is one character, possibly followed by data. Data is sent in hexadecimal, in lowercase. Whitespace or other characters in hex strings sent to SSBL are not allowed and will cause an error. The bootloader responds to unrecognized characters with a '!' char. When waiting for a command, the bootloader sends a CR (ascii 0x0D). The exception to this is the 'p' command, which does not send a CR when it finishes.

'Z' (0x5A)
Followed by four hex digits, loads the Z-register with the specified value.
'R' (0x52)
Followed by two hex digits, which are interpreted as a byte count. Reads program memory starting at the location pointed to by the Z register, and returns contents in hexadecimal. The Z register is advanced by the amount read (a value of 00 will cause 256 bytes to be read).
'W' (0x57)
Writes to program memory. The command character is followed by a word count (not a byte count as in 'R'). That many words are read, and stored into program memory at the location pointed to by the Z register. The Z register is advanced accordingly. This command does not perform a full program sequence. The programmer will need to use the 'P' command to complete the programming operation, and will need to be aware of the page structure of the target chip.
'P' (0x50)
Reads one word into R0:R1, then one byte into SPMCR, then executes an SPM instruction.
'Q' (0x51)
Sends some state information back to the host. The bootloader returns 4 bytes - the Z register value and bootloader offset in flashmemory.
'@' (0x40)
Performs an IJUMP, transferring control to the address in the Z register. This is useful for jumping to address 0 to start a loaded program, but could also be used to call a utility routine.

Configuration

In Makefile is necessary to specify the microcontroller name (MCU=atmega8) and the bootloader offset (BOOTSTART=0x1F00). The bootlaoder offset is equal to device flash size - 0xFF.
In tboot.S need to define constants FOSC and BAUDRATE and to specify an port and pin which will be used for bootloader control (CONTROL_PORT_DDR, CONTROL_PORT_PORT, CONTROL_PORT_PIN, CONTROL_PIN).


Download:

Download Bootloader firmware sources and windows software
Download Bootloader firmware sources and linux software
Download Software sources
Rating: 
0
No votes yet