Showing results for 
Search instead for 
Did you mean: 

STM Studio Upload Error: Wrong version in compilation unit header (is 5 should be 2, 3, or 4)

Senior III


Since a recent upgrade to STM32CubeIDE I am getting the following error when importing variables into STM Studio:

Wrong version in compilation unit header (is 5 should be 2, 3, or 4)

This is preventing me from debugging my system.  I tried using STM32CubeMonitor, but the charting is so rudimentary it is useless.

I am assuming that the upgrade to the IDE incorporated a later version of GCC and it is this that is producing elf files in that have a CU header of 5.

Is there any simple work-around that anyone knows of?

I could go back to a later version of the IDE, but once you get on that merry-go-round you end up with a big mess, because inevitably something else will break.

I know you can also enter the variables and their addresses into Studio manually and that's OK for small numbers of variables, but when you use structures to store different types calculating the offsets to the fields is tedious and error prone.  As I recall if the addresses of the variables changed after program edits Studio would warn you and corrects them to their new addresses

I wish ST would resurrect STM Studio. It is an excellent tool. Anyone with even a modicum of embedded experience can set it up and get results in ten minutes.  To use the Monitor you have to spend a couple of hours reading manuals and watching tutorials only to find out at the end that the charting/plotting is useless. That's what I did. Silly me.

I am sure that the Monitor would be OK for testing logic as it can simulate  a UI but for real-time processing of real-time variables it is useless.

The charting function in the IDE is sometimes useful, but it is clunky and inflexible.

Bring back STM Studio I say.






Associate III

Unfortunately I have the same problem that started with the last CubeIDE update (version 1.13.2). Too bad it happened because STMStudio was a very useful tool. I hope someone will come up with a good idea to fix this problem.

Associate III

To force all compilation units to have the same DWARF version, you must specify the desired DWARF version in your compiler's compiler options. DWARF is a debugging format mainly used in compiling and debugging programs. Here's how to do it: see the 3 screenshots.
I tried it and it works fine now.3.JPG4.JPG5.JPG

Thank you @costi for your valuable solution! Personally, I also find CubeMonitor less suitable for my purposes and prefer to use STM-studio. With your help, this is now possible again.

Hi, I am running into the same problem.
However in version 1.15.0 the settings look different to the one's in the images.
I tried searching for this online but couldnt find anything.

Could someone please show me how to do this in v1.15.0?


Thank you!

How can I download dwarf4