Skip to content

"Blink" variants of Caterina bootloader are used to generate "with_bootloader" exported binaries for some boards #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kuroneko opened this issue May 19, 2021 · 1 comment
Labels

Comments

@kuroneko
Copy link

kuroneko commented May 19, 2021

Describe the problem

Background

When an "Export Compiled Binary" operation is performed, the Arduino development tools generate two variants of the binary:

  • The sketch application alone (e.g., FooSketch.ino.hex)
  • The sketch application merged with the bootloader binary of the board (e.g., FooSketch.ino.with_bootloader.hex)

The latter of these variant is useful in case you want to allow uploading via the bootloader at some point in time after flashing a board with the exported binary file, without being forced to first perform a "Burn Bootloader" operation to replace the bootloader on the board (which is lost if you flash the board with the first variant on the above list.

Bootloader binaries may include an application program. This is the case with the platform's "Caterina" bootloader binaries, which contain an application to blink the built-in LED at 0.5 Hz.

The "with_bootloader" variant of the exported binary will not function as intended if the application is merged with a bootloader binary that already contains an application.

For this reason, the Arduino boards platform platform framework allows the location of the bootloader binary file to be defined via either one of two (undocumented 😢) platform properties (implementation here):

  • bootloader.file
  • bootloader.noblink

If bootloader.noblink is not defined, then the bootloader binary specified by the bootloader.file property (which is also traditionally used in the bootloader action command template of the "Burn Bootloader" operation) will be used for the "Export Compiled Binary" operation.

Problem

The following boards have an application embedded in their bootloader binary, but do not specify a bootloader-only binary via a bootloader.noblink property:

  • Arduino Leonardo
  • Arduino Leonardo ETH
  • Arduino Micro

🐛 This results in the "with_bootloader" binary file generated by performing an "Export Compiled Binary" operation for these boards having a blink application instead of the sketch exported.

To reproduce

Equipment

  • One of the boards listed above.
  • An ISP programmer.

Demo

  1. Create a sketch with the following code:
    const byte LEDPin = LED_BUILTIN;
    const unsigned int duration = 100;
    
    void setup() {
      pinMode(LEDPin, OUTPUT);
    }
    
    void loop() {
      digitalWrite(LEDPin, HIGH);
      delay(duration);
      digitalWrite(LEDPin, LOW);
      delay(duration);
    }
  2. Select the board you are using from Arduino IDE's Tools > Board menu.
  3. Select Sketch > Export Compiled Binary from the Arduino IDE menus.
    A compile operation will begin.
  4. Wait for the compilation to finish successfully.
  5. Select Sketch > Show Sketch Folder from the Arduino IDE menus.
    The folder of the sketch will open in your file manager.
  6. Find the binary with the .with_bootloader.hex filename suffix that is located under the build subfolder of the sketch subfolder (e.g., build/arduino.avr.leonardo/FooSketch.ino.with_bootloader.hex).
  7. Use AVRDUDE to flash the binary to your board.

🐛 The built-in LED on the does not blink at 0.05 Hz as it should if the compiled sketch program was running.

Arduino AVR Boards version

Original report

Not stated.

Last verified with

fff865837b225d17b932f9c416c7fd36a6b3a645

Additional context

Unlike the boards listed above, the "Arduino Yún" is correctly configured:

yun.bootloader.file=caterina/Caterina-Yun.hex
yun.bootloader.noblink=caterina/Caterina-Yun-noblink.hex

Additional reports

@sterretjeToo
Copy link

sterretjeToo commented Feb 3, 2025

Recently reported on the forum: https://forum.arduino.cc/t/exporting-compiled-binary-not-exporting-sketch-properly/1346173.

Confirmed for avr board package 1.8.6 on both IDE 2.3.4 and portable install of 1.8.19.

@per1234 per1234 added the bug label Feb 20, 2025
@per1234 per1234 changed the title Several 32u4 boards missing noblink firmware "Blink" variants of Caterina bootloader are used to generate "with_bootloader" exported binaries for some boards Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants