Optiboot bootloader arduino

Optiboot bootloader arduino

You can compile Optiboot for platforms that do not have pre-existing .hex files, or you can make modifications to the source code and/or Makefile in order to implement «custom» versions of Optiboot.

This will require some relatively deep knowledge of avr-gcc, Atmel AVR hardware and processor details, Makefiles, and the command line environment. We HAVE tried to take steps to allow Optiboot to be compiled without installing a full AVR development suite.

Optiboot is designed to be compiled with the same version of avr-gcc that is distributed with the Arduino environment: 4.3.2. This is actually quite an old version of gcc; some effort has been made to allow the compile to procede with new versions of the compiler. However, since Optiboot MUST compile to a total size of less than 512 bytes, it is very sensitive to changes in the way the compiler does optimizations, or the way it processes optimization options on the compile command.

In all cases, Optiboot compiles directly from the command line using «make», rather than from within any IDE. It is currently designed to used compilers installed in one of three different places:

  • Local Development Environment — you have WinAVR (on Windows), CrossPack (on Mac), or an avr-gcc package (linux) installed on your system, with appropriate development tools somewhere in your path.
  • You have Arduino installed, and are trying to compile Optiboot from its home directory within the Arduino directory structure (hardware/arduino/bootloaders/optiboot/) The Arduino app includes a pretty complete set of compiler tools, and these can be used to compile optiboot without installing a separate toolchain. (as of Version 1.5 of the Arduino IDE, a much smaller set of tools is included, and this method doesn’t work any more.)
  • You have downloaded the Arduino Source code, which also includes (binary) copies of avr-gcc toolchains, and a source directory containing the Optiboot source code.

WARNING: some targets don’t compile with «make» 3.81 or 3.82 due to bug in it. See #106

The Optiboot build procedure has been set up to allow a large set of customization options. The general format of a build command is:

The «make help» command should output a list of possible options and targets, probably more complete and up-to-date than this documentation.

Источник

Optiboot bootloader arduino

There are two aspects to «installing optiboot.» The first problem, which is discussed here, involves getting the optiboot firmware into chips, whether the chips have an older version of a bootloader, or are completely blank.

The second problem is configuring the Arduino IDE to support the optiboot-loaded chips. This is easy if you’re loading up ATmega328x chips, since any 328 chip with optiboot is essentially an Arduino Uno, and you can use the existing Uno configuration. It is more difficult (and not yet documented) if you’re adding a new chip, or putting optiboot on a chip that normally uses a different bootloader. This is (will be) described at AddingOptibootChipsToIde.

Much information about burning optiboot into ATmega chips for use in Arduino can be found in the Arduino forums, especially in this thread

There are about three main methods of installing optiboot on an otherwise blank AVR chip.

Installing using the Arduino IDE

The Optiboot project here includes ONLY the bootloader, not any support for a chip or chip options in the «core» Arduino code. It also includes bootloaders for many chips, of which only a few are likely to be of interest to any one person. This means that while it is possible to «install» Optiboot in the IDE, this is no longer the preferred way to do thing.

In recent years, since the introduction of installable 3rd party hardware in Arduino 1.6.4, open-source developers have been busy creating additional «boards» for the IDE that can be installed very easily. Many of these cores use Optiboot, or a modified version of Optiboot, as their bootloader, and the preferred method of installing «XXX processor with Optiboot bootloader» is to ignore this repository entirely, find a core for that processor, and use the board manager to install it.

Here are some of the well-known and well-used «cores» that use Optiboot:

  • https://github.com/MCUdude/MiniCore (ATmega328, ATmega168, ATmega88, ATmega48 and ATmega8)
  • https://github.com/MCUdude/MightyCore (ATmega8535, ATmega16, ATmega32, ATmega164, ATmega324, ATmega644 and ATmega1284)
  • https://github.com/MCUdude/MegaCore (ATmega64, ATmega128, ATmega640, ATmega1280, ATmega1281, ATmega2560 and ATmega2561)
  • https://github.com/SpenceKonde/ATTinyCore (ATtiny 841, 828, 1634, 87, 167)

If you are using a chip that is «supported» by the Arduino team, or by some other person who has provided files, you can install optiboot (or for that matter, any other bootloader) directly from the Arduino IDE. This usually has the following steps:

  1. Install the files as directed, usually (for Arduino 1.0+) in a subdirectory of your personal sketch’s ../hardware/ directory. Note that the formats of various files (notably boards.txt) have changed with different versions of the IDE, and you’ll need to make sure that the files you have been provided match the version of the IDE you are using.
  2. Connect a device programmer to the ISP connector of the target board, or via wires to an avr chip with appropriate support hardware in a protoboard, as per the instructions associated with that programmer. It will need to be a programmer of a type supported by the Arduino IDE in the tools/programmer Menu. You can use a 2nd Arduino with the ArduinoISP sketch as a programmer. The details are beyond the scope of this document, but are often discussed in the Arduino forums.
  3. Running the Arduino IDE, select the tools/board of the target chip, and the tools/programmer of your programmer, and if necessary the tools/serial port of the programmer.
  4. Select tools/Burn Bootloader

Installing using a specialized bootloader loader sketch

There are a couple of Arduino sketches that have been written to make it easier to reprogram Optiboot (or other SW) into other Arduinos, especially in bulk. One example is WestfW’s OptiLoader. Similar programs are available from Adafruit and Nick Gammon. These typically contain a pre-loaded copy of some version of the bootloader for several different chips (OptiLoader supports ATmega8, ATmega168, ATmega328P, and ATmega328.) It’s very fast and easy IF you have one of the supported targets:

  1. Set up an existing Arduino with an Arduino to ISP connector and load the optiLoader sketch using the standard Arduino IDE.
  2. For each target board, connect the ISP connector and hit the reset button on the optiLoader Arduino, or use the «G» command in the Serial Monitor. Programming the bootloader takes about 5 seconds, and reports status and information to the Arduino serial port.

Installing using the optiboot repository Makefile

We might assume that you’re here at the optiboot code repository because you want to use optiboot on a chip that is NOT supported by another party, but is supposed to be supported by the optiboot in general. (An example might be the ATmega1280, which normally runs a different bootloader.)

  1. Compile the appropriate binary target (ie «mega1280»), as described on the CompilingOptiboot page.
  2. Connect a device programmer to your target as appropriate.
  3. Edit the Makefile to make the ISPxxx variables correct for your programmer. Make sure that there is a «target_isp» make target defined, or create it using the existing targets as examples.
  4. Use a command like «make mega1280_isp» to burn the bootloader.
  5. You can also use avrdude at the command line, manually. Burning the bootloader is usually a two-step process: * «chip erase» the target and set the fuses and lockbits to allow writing to the bootloader section of the device * burn the bootloader at its defined address, and reset the lockbits to prevent accidental overwriting of the bootloader section.

Источник

SodaqMoja/optiboot

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This is optiboot.

Optiboot is an easy to install upgrade to the Arduino bootloader within Arduino boards. It provides the following features:

  • Allows larger sketches. Optiboot is a quarter of the size of the default bootloader, freeing 1.5k of extra space.
  • Makes your sketches upload faster. Optiboot operates at higher baud rates and has streamlined programming.
  • Adaboot performance improvements. Optiboot runs your sketches sooner, with no watchdog issues.
  • Compatible with 168 and 328 Arduinos including Lilypad, Pro, Nano
  • Believed to work with ATmega1280 («Mega»), ATmega644 («Sanguino»), and ATmega1284.

Optiboot is now installed by default on the Arduino Uno. It can be installed on all older mega8, 168 or 328 based Arduinos. To install into the Arduino software

  • Download the latest Optiboot zip file and extract it.
  • You will need to be using a recent version of the Arduino environment, version 18 or later.
  • Create a ‘hardware’ directory inside your sketches folder.
  • Copy the optiboot directory into the hardware directory.
  • Restart the Arduino software. New boards will appear in the Tools > Board menu.

To burn Optiboot onto an Arduino board

  • Select the appropriate Optiboot board type (or non-Optiboot if you want to change back)
  • Connect your Arduino to an ISP programmer (more details)
  • Use the ‘Burn Bootloader’ item in Arduino.
  • You can then upload sketches as normal, using the Optiboot board type.

Источник

Optiboot bootloader arduino

Copy raw contents

Copy raw contents

Optiboot Bootloader for Arduino and Atmel AVR

Optiboot is an easy to install upgrade to the Arduino bootloader within Arduino boards. It provides the following features:

  • Allows larger sketches. Optiboot is only 512 bytes, freeing 1.5k of extra code space compared to older bootloaders.
  • Makes your sketches upload faster. Optiboot operates at higher baud rates and has streamlined programming.
  • Adaboot performance improvements. Optiboot implements «fastboot» that starts sketches immediate after power-on.
  • Compatible with ATmega8, ATmega168, and ATmega328p Arduinos and derivatives including Lilypad, Pro, Nano, and many derivatives.
  • Works with MANY additional Atmel AVR chips — almost anything that supports bootloads or «flash self-programming.» This includes chips from ATtiny 8pin chips through the 100pin ATmega2560 used on Arduino Mega.
  • Supports alternate serial ports, CPU frequencies and baud rates.
  • Additional support for AVR-USB-MCUs of the families ATmegaXYu2/4/6 and AT90usbXYZS – e.g. Arduino Uno USB-MCU (ATmega16u2) and Micro (ATmega32u4).

Optiboot (an older version) is installed by default on the Arduino Uno and (as of 2018) official Arduino Nano boards. It can be installed on all older mega8, 168 or 328 based Arduinos.

As of 2019, Atmel was acquired by Microchip Inc, and released several «new» architectures with the AVR CPU. These are known as the Mega-0, Tiny-0, and Tiny-1 Series. While the basic CPU operation is about the same as older AVRs, the peripherals, including Flash self-programming, are significantly different. This justified a new version of Optiboot with separate source code and Makefiles, which we’re calling «optiboot_x» (the new AVR chips closely resemble the «AVR XMega» chips.)

More detailed documentation is being added (slowly) to the repository wiki.

Notes on IDE Version compatibility

Optiboot is «compatible», in a loose sense, with all versions of the Arduino IDE. It was originally written at about the same time as v1.0, and has some «quirks» that date back to that timeframe. Most significantly, the directory structure of the git repository is «weird.»

To install into the Arduino software

You do NOT need to «install» Optiboot if you are trying to update an installed platform that already uses some form of Optiboot. In fact, you should almost certainly NOT install Optiboot using the board manager. The Optiboot GitHub repository these days is mostly useful as a source-code repository, for anyone who needs to make a highly customized version for some reason. Or an improvement to Optiboot itself.

Most end users should find a supported «Arduino Core» that includes Optiboot for their desired target, and install that. Many such cores are provided by the hardware vendor, and they’ll include Board definitions, Variant files, and Arduino core code needed to support the target as well as one or more Optiboot .hex files that should work.

There are also some major repositories of «generic» versions of cores for various targets, including:

  • MegaCore by MCUdude Supports large AVRs like ATmega128, ATmega640, ATmega1280, ATmega1281, ATmega2560 and ATmega2561.
  • MightyCore by MCUdude Supports most 40pin AVRs including ATmega1284, ATmega644, ATmega324, ATmega32, and ATmega8535.
  • MiniCore by MCUdude Supports most 28pin ATmega AVRs, including the CPUs used by Uno/etc as well as the new CPUs like the ATmega328PB.
  • MajorCore by MCUdude Supports a couple of relatively obsolete large AVRs, like ATmega8515 and ATmega162.
  • ATTinyCore by Spence Konde Supports many ATtiny AVRs, including ATtiny85, ATtiny1634, ATtiny84, and ATtiny841.
  • MegaCoreX by MCUdude Supports the Mega-0 Series AVRs (notably the ATmega480x and ATmega320x) (Using Optiboot_X.)
  • megaTinyCore by Spence Konde Supports many of the Tiny-0 and Tiny-1 series AVR chips (using Optiboot_X.)

If you need a new Optiboot feature not included in a pre-packaged core, the recommended procedure is to download or fork the source code, manually compile the version you need, and copy the .hex file to the existing board directory (after renaming the old .hex file, in case you need it back.)

Nevertheless, there is an automatically installable Board Manager package that includes the .hex files for Optiboot on several popular Arduino boards (a very small subset of the possible targets.). Using the Optiboot «install» procedure does not install any cores or variants, so it is only useful for CPUs that are already supported by the standard Arduino core.

The following instructions are based on using the Arduino «Board Manager», present in IDE versions 1.6.5 and later.

  1. Find the desired Optiboot release on the Optiboot Release page.
  2. Use the «Copy link address» feature of your browser to copy the URL of the associated .json file.
  3. Paste this URL into the «Additional Boards Manager URLs» field in the Arduino IDE «Preferences» pane. (Separate it from other URLs that might be present with a comma or click the icon to the right of the field to insert it on a new line.)
  4. After closing the Preferences window, the Tools/Boards/Boards Manager menu should include an entry for that version of Optiboot. Select that entry and click the Install button.

For additional installation information, see the Optiboot AddingOptibootChipsToIde Wiki page

To burn Optiboot onto an Arduino board

Источник

Adblock
detector