Bootloader ATtiny – Micronucleus

Informatie (ENG):

Micronucleus V2.03
==================

Micronucleus is a bootloader designed for AVR ATtiny microcontrollers with a minimal usb interface, cross platform libusb-based program upload tool, and a strong emphasis on bootloader compactness. To the authors knowledge this is, by far, the smallest USB bootloader for AVR ATtiny

The V2.0 release is a complete rewrite of the firmware and offers significant improvements over V1.x:

• Support for the entire ATtiny family instead of only ATtiny85.
• Much smaller size. All configurations are below 2kb.
• Interrupt free V-USB: no patching of the user program INT-vector anymore.
• Faster uploads due to new protocol.
• Far jmp also allows using ATtinies with more than 8kb flash.
• Many robustness improvements, such as compatibility to USB hubs and
less erratic time out behavior.

Due to the many changes, also the upload tool had to be updated. The V2.0 upload tool is backwards compatible to the V1.X tool, though.

The last release of the V1.x can be found here: https://github.com/micronucleus/micronucleus/tree/v1.11

Usage
=====

The bootloader allows uploading of new firmware via USB. In its usual configuration it is invoked at device reset and will identify to the host computer. If no communication is initiated by the host machine within a given time, the bootloader will time out and enter the user program, if one is present.

For proper timing, the command line tool should to be started on the host computer _before_ the bootloader is invoked.

Windows machines will need to install the libusb drivers found in the /windows_drivers folder. Clean Micronucleus devices without uploaded userprogram will not time out and allow sufficient time for proper driver installation. Linux and OS X do not require custom drivers.

Windows 10: Installing unsigned drivers became more difficult in Windows 10. Please use the Zadig driver installer as provided in the /windows_driver_installer folder.

Please invoke the command line tool with “micronucleus -help” for a list of available options.

The bootloader resides in the same memory as the user program, since the ATtiny series does not support a protected bootloader section. Therefore, special care has to be taken not to overwrite the bootloader if the user program uses the self programming features. The bootloader will patch itself into the reset vector of the user program. No other interrupt vectors are changed.

Compiling
=========

Micronucleus can be configured to support all devices of the ATtiny series, with the exception of the reduced core ATtiny 4/5/9/10/20/40.

Currently, the following configurations are included and tested. Please check the subfolders /firmware/configurations/ for details. Hex files can be found in /releases.

1

2

3

4

5

6

t84_default - ATtiny84A default configuration - 1542 bytes

t841_default - ATtiny841 default configuration - 1594 bytes

t85_default - ATtiny85 default configuration - 1596 bytes

t85_aggressive - ATtiny85 smaller size - critical - 1426 bytes

t167_default - ATtiny167 default (uses xtal) - 1422 bytes

Nanite841 - Nanite841 firmware - 1618 bytes

You can add your own configuration by adding a new folder to /firmware/configurations/. The folder has to contain a customized “Makefile.inc” and “bootloaderconfig.h”. Feel free to supply a pull request if you added and tested a previously unsupported device.

If changes to the configuration lead to an increase in bootloader size, it may be necessary to change the bootloader start address. Please consult “Makefile.inc” for details.

Other make options:

1

2

make CONFIG=<config_name> fuse # Configure fuses

make CONFIG=<config_name> flash # Uploade the bootloader using AVRDUDEThere is also an option to disable the reset line and use it as an I/O. While it may seem tempting to use this feature to make an additional I/O pin available on the ATtiny85, we strongly discourage from doing so, as it led to many issues in the past.