Skip to content

Custom board option selection made in one window affects other windows as well #2240

Closed
@per1234

Description

@per1234

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.

🐛 If the user changes the setting in a custom board option menu in one menu, compilations and uploads for the board in other windows will also use that custom board option setting instead of the one the user had selected in that window.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
    I will refer to the IDE window that opens as "window A" from here on.
  2. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  4. Click the "OK" button.
  5. Select Tools > Board > Arduino AVR Boards > Arduino Nano from the Arduino IDE menus.
    This board was selected arbitrarily for the demo. The fault will occur with any board that has a custom board option.
  6. Select Tools > Processor > ATmega328P (Old bootloader) from the Arduino IDE menus.
    This setting was selected arbitrarily for the demo. The fault will occur with any custom board option setting.
  7. Select Sketch > Verify/Compile from the Arduino IDE menus.
  8. Scroll up to the top of the "Output" view.
    🙂 The FQBN shown there is as expected for the custom board option setting:
    FQBN: arduino:avr:nano:cpu=atmega328old
    
  9. Select File > New Sketch from the Arduino IDE menus.
    I will refer to the IDE window that opens as "window B" from here on.
  10. Select Tools > Processor > ATmega168 from the Arduino IDE menus.
  11. Select Sketch > Verify/Compile from the Arduino IDE menus.
  12. Scroll up to the top of the "Output" view.
    🙂 The FQBN shown there is as expected for the custom board option setting:
    FQBN: arduino:avr:nano:cpu=atmega168
    
  13. Switch back to "window A".
  14. Open the Tools > Processor menu (❗ Don't select anything; only open the menu).
    🙂 The ATmega328P (Old bootloader) setting you chose in step (6) is still selected, as expected.
  15. Select Sketch > Verify/Compile from the Arduino IDE menus.
  16. Scroll up to the top of the "Output" view.

🐛 The FQBN shown there does not match the setting of the window's Tools > Processor menu. Instead, it is the FQBN for the setting made in "window B":

FQBN: arduino:avr:nano:cpu=atmega168

Expected behavior

The board selection in each IDE window can be configured independently without any effect on the configuration of other windows.

Arduino IDE version

ed2d8ad

Operating system

Windows

Operating system version

11

Additional context

I checked for the fault in various IDE versions going all the way back to 2.0.0-beta.1 and was able to reproduce it with all of them. So it seems this is not a regression.

I looked for existing issues without finding any, but it is possible there might be some that are reports of the final symptoms of an unexpected configuration being applied to a given board (e.g., an upload failure) instead of the immediate symptom of incorrect content in the compilation output as I was able to identify and report here.

Workaround

Select the desired settings from each custom board option menu before compiling or uploading, even though the IDE's GUI shows the desired setting is already selected from the menu.

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