2021-06-01 02:19 AM
It does parse global variables in the corresponding .elf file of the same project, compiled in Debug mode (without optimizations). The introductory video (of Cube Monitor) said it can parse debug and release .elf files, but it does not seem to be the case.
Solved! Go to Solution.
2021-06-02 09:25 AM
Check in GCC compiler settings in debugging page.
Global variable, in some cases can be simple removed, but this usually don't happen,
2021-06-02 12:04 AM
If variable will be optimized, than it can't be monitored, also, in release debug information are not included to elf file, check your compiler settings.
2021-06-02 07:58 AM
Why would it be not possible to monitor a global variable of some code that is not optimized? That variable still sits in a defined place, in SRAM, that place is known at the moment of compilation, STM32CubeMonitor could perfectly know where to look for it, and JTAG/SWD should have no problem reading from/writing to that variable. It should have nothing to do.
The .elf file created in Debug mode is much larger than the .elf file created in Release file.
I checked my (GNU) compiler settings, and I found nothing that it would tell it not to embed in the .elf file the info regarding where each global variable is, in the case of Release compilation (with optimizations for speed). Of course, there is a setting that tells it to optimize for speed, in that case (of Release). In Release mode, I want code optimized for speed, and I would like the .elf to also include the info about where each global variable is (so that CubeMonitor can parse them).
Is there a way to tell the compiler that has to create code that is optimized for speed AND that includes in the .elf file the location of each global variable?
2021-06-02 09:25 AM
Check in GCC compiler settings in debugging page.
Global variable, in some cases can be simple removed, but this usually don't happen,
2021-06-02 10:29 AM
Yes, I found it. For STM32CubeIDE, it is in (Project) Properties -> C/C++ Build -> Settings -> (Tab) Tool Settings -> MCU G++ Compiler -> Debugging -> Select configuration "Release" -> Debug level: "Maximum (-g3)".
And that is independent on the optimization level. The .elf file from compilation in Release mode is now much larger (not because it is not optimized --which it is-- but because it now includes debug info.
Thank you.