OK, I was able to find the cause of the problem.
Version 1.0.0 of the "Seeed nRF52 mbed-enabled Boards " platform did have a softdevice
custom board option . Arduino IDE remembers the previously selected options for convenience so that you don't need to reconfigure the board every time you select it. Unfortunately, this causes a bug where Arduino IDE continues to try to use that option even after you update to a different version of a platform that doesn't have the option anymore. This is why you now get that error message when compiling.
I have submitted a formal bug report to the Arduino IDE developers:
opened 11:42AM - 11 Dec 22 UTC
topic: code
type: imperfection
Compilation fails after updating to platform version with different custom board… options
### Describe the problem
Arduino boards platform authors can define arbitrary [custom board options](https://arduino.github.io/arduino-cli/dev/platform-specification/#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:
```text
<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.
1. Open the "**Boards Manager**" view.
1. Scroll down until you see the "**Arduino Mbed OS Portenta Boards**" platform entry.
1. If it is not already installed, click the <kbd>**INSTALL**</kbd> button and wait for the installation to finish.
1. Select **Tools > Board > Arduino Mbed OS Portenta Boards > Arduino Portenta H7 (M7 core)** from the Arduino IDE menus.
1. Select **Sketch > Verify/Compile** from the Arduino IDE menus.
1. Wait for the compilation process to finish.
🙂 The process is successful as expected.
1. In the "**Arduino Mbed OS Portenta Boards**" platform entry in the "**Boards Manager**" view, select "**2.4.1**" from the version menu.
1. Click the <kbd>**INSTALL**</kbd> button.
1. Wait for the install operation to finish.
1. Select **Sketch > Verify/Compile** from the Arduino IDE menus.
🐛 The compilation process fails unexpectedly with the error:
```text
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`
1. 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](https://forum.arduino.cc/t/2-0-3-compilation-error-invalid-option-softdevice/1063253)
---
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:
```text
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: https://github.com/arduino/arduino-ide/issues/1030
---
Originally reported at https://forum.arduino.cc/t/2-0-3-compilation-error-invalid-option-softdevice/1063253
---
#### Workaround
1. Select **File > Quit** from the Arduino IDE menus if it is running.
1. Delete the following folder to clear the incorrect FQBN from Arduino IDE's data store:
- Windows:
```
C:\Users\<user name>\AppData\Roaming\arduino-ide
```
- Linux:
```
~/.config/arduino-ide
```
- macOS:
```
~/Library/Application Support/arduino-ide
```
⚠ Please be very careful when deleting things from your computer. When in doubt, back up!
1. Start Arduino IDE.
1. Select the board again.
1. Retry whatever operation that failed previously.
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [X] My report contains all necessary details
I'll share the workaround you can use to get Arduino IDE working again:
Select File > Quit from the Arduino IDE menus if it is running.
Delete the following folder to clear the incorrect FQBN from Arduino IDE's data store:
Please be very careful when deleting things from your computer. When in doubt, back up!
Start Arduino IDE.
Select the board again.
Retry whatever operation that failed previously.
Deleting the C:\Users\<user name>\AppData\Roaming\arduino-ide
folder will cause Arduino IDE to forget some convenience information like the board options you had selected before, and it will cause it to run some setup processes that normally only occur on the first run of a fresh installation, but no essential data is stored in that folder so you don't need to worry about this causing the loss of anything essential.
Please let me know if you have any questions or problems while following those instructions.
1 Like