Skip to content

Invalid FQBN assembled when discovery specifies custom board options #1588

Closed
@per1234

Description

@per1234

Describe the problem

Arduino boards platforms may provide additional configurability of a given board definition via "custom board options".

These options are specified as part of the FQBN, via the following format:

<vendor ID>:<architecture>:<board ID>[:<menu ID>=<option ID>[,<menu ID>=<option ID>]...]

The default option is used for custom board options when not specified via the FQBN, so those components are optional even for boards that have custom options.

Previously, due to limitations in the pluggable discovery infrastructure, it was not possible for custom board options settings to be identified along with the base board identification. That limitation has now been overcome (arduino/arduino-cli#1674). Board options can now be set according to the identification properties provided by a discovery tool:

https://arduino.github.io/arduino-cli/dev/pluggable-discovery-specification/#identification-of-board-options

This means the fqbn field of the cc.arduino.cli.commands.v1.BoardListItem message may now contain FQBNs that contain custom board options.

🐛 Board options from the Tools menu selections are appended to the FQBN from the cc.arduino.cli.commands.v1.BoardList response under the assumption the FQBN will have the basic <vendor ID>:<architecture>:<board ID> form. This produces an invalid FQBN.

To reproduce

Equipment

  • A board that is configured for identification of custom board options via discovery properties.

Currently, the only boards platform taking advantage of this capability is the "Teensy" platform. Any Teensy board can be used. If this is an obstacle for those working on this issue, I can provide instructions for setting up custom board option identification for any board.

Steps

  1. Connect the board to your computer.
  2. Select the board from the "Board Selector" menu on the Arduino IDE toolbar.
    ❗ The board must be selected from this specific menu. The issue does not occur when selecting the board from the Tools > Board menu or "Select Other Board and Port" dialog.
  3. Select Sketch > Verify/Compile from the Arduino IDE menus.

🐛 Compilation fails:

Invalid FQBN: not an FQBN: teensy:avr:teensy41:usb=rawhid:usb=rawhid,speed=600,opt=o2std,keys=en-us

Compilation error: Invalid FQBN: not an FQBN: teensy:avr:teensy41:usb=rawhid:usb=rawhid,speed=600,opt=o2std,keys=en-us

Compare the generated FQBN:

teensy:avr:teensy41:usb=rawhid:usb=rawhid,speed=600,opt=o2std,keys=en-us

To the correct FQBN:

teensy:avr:teensy41:usb=rawhid,speed=600,opt=o2std,keys=en-us

Note that the full set of custom board options usb=rawhid,speed=600,opt=o2std,keys=en-us was appended to the FQBN provided by BoardList teensy:avr:teensy41:usb=rawhid (the usb option value is identified via the discovery properties).

Expected behavior

Arduino IDE always generates valid FQBN.

Arduino IDE version

2.0.1

Operating system

Windows

Operating system version

10

Additional context

The workaround for this bug is to always select the board from the Tools > Board menu in the Arduino IDE.


Originally reported by @KurtE at https://forum.arduino.cc/t/invalid-fqbn-not-an-fqbn/1046630


Additional reports:

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions