Bug Alert & Fix: STM32CubeMonitor wipes Variable List selection (.elf parsing issue) upon file renaming/switching
Hi everyone,
I wanted to share a frustrating issue I encountered in STM32CubeMonitor while working on a complex project (vienna_stm32g474), hoping to save some headaches for fellow developers.
The Problem:
When updating or switching to a new version of the .elf file in the Edit variables node / Edit exe-config node, the entire selected variable list (which contained around 30 complex nested structures) gets completely wiped out/deselected. Interestingly, this behavior occurred only in one specific node, while other lists on different flows updated perfectly fine, even though the variables still existed in the new file.
The Root Cause:
After a lot of debugging, we found out that STM32CubeMonitor handles the .elf file path/name as a strict unique hash key inside the flows.json architecture.
If you rename the file (e.g., creating a backup like project-Copy.elf) or switch paths manually in the UI dropdown, the internal parser treats it as an entirely new project schema. Instead of safely migrating the checkboxes, a silent exception occurs during the UI string-matching process of nested structs, and the internal JSON field "checked": true gets stripped off, completely resetting your selection to empty.
The Fix / Best Practice:
To prevent STM32CubeMonitor from ever wiping your variable lists again, follow these two rules:
- Keep the filename and path 100% static: Never rename your output
.elffile or manually switch files via the UI dropdown. Let STM32CubeIDE overwrite the exact same file in theDebugorReleasefolder upon compilation. - Automate the update on the background (The permanent fix): Instead of manually opening the config node and clicking "Update", use Node-RED's core automation:
- Drag a
watchnode into your flow and point it to your absolute.elffile path. - Drag a
link outnode connected to thewatchnode. - In your other flows/tabs, place a
link innode connected directly to the input pin of yourvariable listnode. - Wire the links together.
- Drag a
Now, every time you hit Build in STM32CubeIDE, the watch node triggers a background re-parse across all flows simultaneously. The RAM addresses are updated on-the-fly, and your variable selections remain perfectly intact without any manual clicks.
Hope this helps anyone struggling with disappearing variables in CubeMonitor!
Tested on STM32CubeMonitor v1.12.0 and STM32CubeIDE v2.1.1).
Best regards,
k_nedelchev
