2026-02-06 1:07 PM
I am building an STM32H7 project (STM32H753) using CMake + STM32CubeMX and GCC.
The firmware builds and runs correctly, but STMStudio fails to load debug symbols with the following error:
DWARF error. Wrong version in compilation unit header (is 5, should be 2,3 or 4)
Even when -g is used, the error persists. I set the following flags on CMakeLists:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gdwarf-4") set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -gdwarf-4") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-4")
So, I appreciate any advice.