Skip to content

Invalid FQBN used after updating to platform version without previously used custom board option #1762

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
3 tasks done
per1234 opened this issue Dec 11, 2022 · 1 comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Dec 11, 2022

Describe the problem

Arduino boards platform authors can define arbitrary custom board options to provide additional configurability for a given board selection. These options are presented to the Arduino IDE user as arbitrary submenus under the IDE's Tools menu.

At the machine level, custom board options are specified as part of the FQBN, following this format:

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

Arduino IDE stores the FQBN data for a couple of reasons:

  • Retain custom board option selections for a given board
  • Retain board selection for a given sketch

Custom board options may change from one platform release to another.

🐛 If the user updates to a version of a platform where a previous custom board option is not present, Arduino IDE continues to use the stored FQBN with custom board options based on the previously used version of the platform, which is invalid for use with the new platform version. This causes compilation and upload operations to fail.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Open the "Boards Manager" view.
  3. Scroll down until you see the "Arduino Mbed OS Portenta Boards" platform entry.
  4. If it is not already installed, click the INSTALL button and wait for the installation to finish.
  5. Select Tools > Board > Arduino Mbed OS Portenta Boards > Arduino Portenta H7 from the Arduino IDE menus.
  6. Select Sketch > Verify/Compile from the Arduino IDE menus.
  7. Wait for the compilation process to finish.
    🙂 The process is successful as expected.
  8. In the "Arduino Mbed OS Portenta Boards" platform entry in the "Boards Manager" view, select "2.4.1" from the version menu.
  9. Click the INSTALL button.
  10. Wait for the install operation to finish.
  11. Select Sketch > Verify/Compile from the Arduino IDE menus.
    🐛 The compilation process fails unexpectedly with the error:
    Error resolving FQBN: getting build properties for board arduino:mbed_portenta:envie_m7: invalid option 'security'
    
    Compilation error: Error resolving FQBN: getting build properties for board arduino:mbed_portenta:envie_m7: invalid option 'security'
    
    Arduino IDE is attempting to compile with an FQBN like: arduino:mbed_portenta:envie_m7:split=50_50,security=none
  12. Open the Tools menu.
    🐛 The menu contains "Flash split" and "Security setting" submenus even though version 2.4.1 of the "Arduino Mbed OS Portenta Boards" platform does not define these custom board options.

Expected behavior

Arduino IDE uses a valid FQBN for all operations even when the custom board options of a board have changed.

Note that, in addition to updates via Boards Manager, these changes may occur due to the user modifying or manually updating installed platforms between Arduino IDE sessions, so the Boards Manager update operation can not be used as the trigger to update the stored FQBN.

Arduino IDE version

f8c01e3

Operating system

Windows

Operating system version

10

Additional context

Other than the workaround described below, I have not found any way to recover Arduino IDE from this state. The error continues even after opening a new window, restarting the IDE, or re-selecting the board.


In order to make it more simple by using a platform from the primary package index, the demo used a roll back to a previous version of a platform to produce the required conditions. However, the fault also occurs for the more common use pattern of updating to a newer version of an installed platform if a custom board option was removed in that version (real world example here


In the demo, the fault was triggered by the removal of a custom board option menu entirely. However, the fault can also occur if only the previously selected option within a menu was removed by the update, even if the new platform version still contains that board option menu. In this case, the error message will have this form:

Error resolving FQBN: getting build properties for board per1234:avr:foo: invalid value 'a' for option 'bar'

Compilation error: Error resolving FQBN: getting build properties for board per1234:avr:foo: invalid value 'a' for option 'bar'

Possibly related: #1030


Originally reported at https://forum.arduino.cc/t/2-0-3-compilation-error-invalid-option-softdevice/1063253


Workaround

  1. Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.

  2. Delete the following folder to clear the incorrect FQBN from Arduino IDE's data store:

    • Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\
      
      (where <username> is your Windows username)
      ❗ If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
    • Linux:
      /home/<username>/.config/arduino-ide/
      
      (where <username> is your Linux username)
      ❗ The .config folder may be hidden by default in your file manager and terminal.
    • macOS:
      /Users/<username>/Library/Application Support/arduino-ide/
      
      (where <username> is your macOS username)
      ❗ The Library folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut.

    ⚠ Please be very careful when deleting things from your computer. When in doubt, back up!

  3. Start Arduino IDE.

  4. Select the board and port from the Arduino IDE menus.

You should now be able to perform whatever action was previously failing with the "getting build properties" error.

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
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Dec 11, 2022
@kittaakos
Copy link
Contributor

Storing board settings per platform version was an IDE2 feature. It has been removed via 877c1a1.

@kittaakos kittaakos self-assigned this Jun 23, 2023
@kittaakos kittaakos removed their assignment Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants