Portenta H7 -O0 gcc compilation error

I have a makefile project setup in the STM32 Cube IDE that lets me debug Arduino-generated code using the ST-Link v2 device. Unfortunately, the Arduino cxxflags.txt compilation commands use -Os. This optimization makes the debugging a jumpy experience, barely good enough to get by, and some variables are optimized out therefore invisible in the IDE. When I change cxxflags.txt to replace -Os with -O0, I get an error:

\build/core\core.a(USBCDC.cpp.o): In function arduino::internal::PluggableUSBModule::PluggableUSBModule(unsigned char)': <myUserFolder>\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\3.3.0\cores\arduino\USB/PluggableUSBDevice.h:40: undefined reference to vtable for arduino::internal::PluggableUSBModule'
collect2.exe: error: ld returned 1 exit status

Has anybody tried this and found a solution? I bet there is some attribute that would fix it, I just don't know which one.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.