11

Nearly all modern Arduino boards use the Optiboot bootloader. Compared to the ATmegaboot used before, this is smaller in flash terms (by about 1.5KB) and faster in upload speed (115.2k vs 57.6k) and starts your sketch quicker (the delay whilst waiting after reset is shorter).

Are there any alternatives to the Optiboot bootloader? Specifically, are there any smaller (in flash terms) boot loaders? What differences do they have?

8

Optiboot is about the smallest bootloader available.

But, there is a much more powerful (with inbuilt console for hardware testing, RAM and Flash contents checking, etc) bootloader with a more developed and robust stk500v2 communications protocol between avrdude and the AVR bootloader.

I've used it on the ATmega2560 and on the ATmega1284p. It works for both 3 byte and 2 byte program counter MCU.

I have a STK500v2 Bootloader version on Sourceforge.

This bootloader is based the Peter Fleury STK500v2 bootloader, updated by Mark Sproul. I've made edits to have it supporting with the Goldilocks (an ATmega1284p) board.

The key feature is to use the STK500v2 protocol for uploading the Flash image to the Arduino. This protocol is more robust and gives better error capabilities than the avr109 protocol. As an aside the avr109 protocol is called "Arduino" in the Arduino world, because it toggles DTR (to reset the board and automatically enter the bootloader), and the STK500v2 protocol is called "Wiring" in the Arduino world, because of the same reason.

The Fleury/Sproul STK500v2 bootloader is designed to work with the ATmega2560 which has a 3 byte program register, because of the larger Flash size. But, it also supports normal 2 byte boards (everything else really).

For boards with plenty of Flash (like Goldilocks 1284p), there is a hardware monitor that can be used to query Flash, SRAM and hardware; you can check connections without additional code, and check the actual contents of Flash and EEPROM. Because the 1284p supports 2 USART, I added the ability to have debugging on USART1, so that the upload process via USART0 isn't disturbed.

  • This seems to be part of FreeRTOS, is that bootloader totally independent from FreeRTOS? – jfpoilpret Mar 28 '14 at 5:57
  • 1
    It is totally independent. The bootloader is used to write flash with anything. FreeRTOS comes later after main() is started. I just keep it in the same repository. I didn't write it, just modified for my purposes. – feilipu Mar 29 '14 at 8:47
  • This seems interesting; it would be useful if you could sum up important features of your bootloader in your answer: size in Flash, upload max speed, Arduino boars it can work with, and some more details about hardware testing). – jfpoilpret Mar 29 '14 at 9:15
  • It is (based on) the Peter Fleury STK500v2 bootloader, updated by Mark Sproul. I've made edits to have it supporting with the Goldilocks (an ATmega1284p) board. The key feature is to use the STK500v2 protocol for uploading the flash image to the Arduino. This protocol is more robust and gives better error capabilities than the avr109 protocol. As an aside the avr109 protocol is called "Arduino" in the Arduino world, because it toggles DTR (to reset the board and automatically enter the bootloader), and the STK500v2 protocol is called "Wiring" in the Arduino world, because of the same reason. – feilipu Mar 29 '14 at 11:00
  • 1
    Thanks for the info, I have updated your post as I think this information should directly be part of your answer. Feel free to add more information if you see fit! – jfpoilpret Mar 29 '14 at 17:23
3

TinySafeBoot is an alternative for ATtiny and ATmega devices.

  • Compatible to plenty of ATtinys and ATmegas (see below)

  • Read/Write access to Flash and EEPROM.

  • All IOs available for serial communication

  • One-wire, also with multiple AVRs on a single line

  • Autobauding, rugged protocol.

  • Activated by Reset + Password (optional)

  • Password and Timeout user changeable anytime.

  • "Emergency Erase" to overcome lost Password - kills all data but leaves bootloader intact.

  • ATtinys: ~ 550 bytes,

  • ATmegas: < 512 bytes (!)

  • TSB for ATtiny can update itself.

  • The Sourcecode is free Software (GPL)

  • anyone know how TSB compares to Optiboot? Last update seems at least 2 years ago... – johny why Mar 2 '18 at 1:15
1

Are there any alternatives to the Optiboot bootloader?

Err... not really. There's actually a [unofficial] modification to Optiboot to make it faster when uploading.

To install the high baud rate variations…

  • Ensure the Arduino IDE is not running
  • Download the 7-Zip archive using the link above
  • Extract the three files to the following directory: {Arduino Installation Root}\hardware\arduino\bootloaders\optiboot\
  • Open the boards.txt file located in the following directory: {Arduino Installation Root}\hardware\arduino\

Find This section inside it:

uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

Add the following section…

uno_uf.name=Arduino Uno / Upload Fast
uno_uf.upload.protocol=arduino
uno_uf.upload.maximum_size=32256
uno_uf.upload.speed=250000
uno_uf.bootloader.low_fuses=0xff
uno_uf.bootloader.high_fuses=0xde
uno_uf.bootloader.extended_fuses=0x05
uno_uf.bootloader.path=optiboot
uno_uf.bootloader.file=optiboot_atmega328_250000.hex
uno_uf.bootloader.unlock_bits=0x3F
uno_uf.bootloader.lock_bits=0x0F
uno_uf.build.mcu=atmega328p
uno_uf.build.f_cpu=16000000L
uno_uf.build.core=arduino
uno_uf.build.variant=standard
  • Change the two highlighted values to the baud rate you plan to use: 250000, 500000, or 1000000 Save and close the boards.txt file
  • Using your favourite ISP programmer, install the new bootloader. Don’t forget to: Ensure the Arduino Uno / Upload Fast board is selected (Tools / Board), If appropriate, ensure the Serial Port of your programmer is selected (Tools / Serial Port), Ensure the programmer is selected (Tools / Programmer), After installing the bootloader, change the Serial Port to the serial port of your Arduino Uno.

Above text slightly modified for compatibility with site. Original post


Besides that, and the ATmegaboot bootloader, you can't really find any alternative. I would imagine that if Arduino loads it on all the Unos ever produced, it's pretty optimized. The above hack speeds up upload time, but it doesn't reduce the size of the bootloader. You can also remove the wait time on the bootloader so it has a faster startup.

If you're that concerned about maximising flash see: How to really shrink a sketch and this answer [on on What can I do if I run out of Flash memory or SRAM?].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.