You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to debug a project created with STM32Cube in PlatformIO, the assembler (arm-none-eabi-as) receives the -g2 flag, which it does not recognize, resulting in a fatal error. This issue prevents successful debugging even though the project compiles without errors in normal build mode.
When initiating a debug session using pio debug -v, PlatformIO automatically adds the -g2 and -ggdb2 flags to both the GCC compiler and the assembler. While the compiler accepts these flags, the assembler (arm-none-eabi-as) does not recognize -g2, leading to the following fatal error:
Even though I forced the -g option in build_flags, it did not take effect.I added the following content to the configuration file, and the debug debugging can be used normally.
debug_build_flags =
-g
Steps to Reproduce:
Create a new STM32Cube project using PlatformIO with the genericSTM32F103ZE board.
In platformio.ini, set -g as the debug flag.
Include an assembly startup file (e.g., startup_stm32f103zetx.s) in the project.
Build the project to confirm that it compiles without issues.
Start a debug session using pio debug -v.
Observe the assembler error related to the -g2 flag.
PlatformIO should respect the build_flags specified in the platformio.ini file and avoid adding unsupported flags like -g2 to the assembler. The debugger should initiate successfully without modifying the assembler flags in an incompatible way.
Actual Behavior:
During the debug build process, PlatformIO adds -g2 and -ggdb2 flags to both the GCC compiler and the assembler. While GCC handles these flags gracefully, the assembler does not recognize -g2, resulting in a fatal error and preventing the debug session from starting.
The text was updated successfully, but these errors were encountered:
I strongly suggest that in PlatformIO's platformio.ini, the compiler (gcc), linker (ld), and assembler (as) have their own independent flags options. The parameters among these three are not compatible, and applying build_flags to all components is unwise, resulting in a significant loss of flexibility and introducing many issues. Additionally, options like debug_build_flags are not a wise choice; they take effect during the compilation process before debugging, yet these compilation options also apply to gcc and as, which creates confusion and chaos for me.
Description:
When attempting to debug a project created with STM32Cube in PlatformIO, the assembler (
arm-none-eabi-as
) receives the-g2
flag, which it does not recognize, resulting in a fatal error. This issue prevents successful debugging even though the project compiles without errors in normal build mode.Environment:
arm-none-eabi-gcc
(version 12.3.1)Build Configuration (
platformio.ini
):Problem:
When initiating a debug session using
pio debug -v
, PlatformIO automatically adds the-g2
and-ggdb2
flags to both the GCC compiler and the assembler. While the compiler accepts these flags, the assembler (arm-none-eabi-as) does not recognize -g2, leading to the following fatal error:Even though I forced the -g option in build_flags, it did not take effect.I added the following content to the configuration file, and the debug debugging can be used normally.
debug_build_flags = -g
Steps to Reproduce:
Create a new STM32Cube project using PlatformIO with the genericSTM32F103ZE board.
In platformio.ini, set -g as the debug flag.
Include an assembly startup file (e.g., startup_stm32f103zetx.s) in the project.
Build the project to confirm that it compiles without issues.
Start a debug session using
pio debug -v
.Observe the assembler error related to the
-g2
flag.Log Output:
Expected Behavior:
PlatformIO should respect the build_flags specified in the platformio.ini file and avoid adding unsupported flags like
-g2
to the assembler. The debugger should initiate successfully without modifying the assembler flags in an incompatible way.Actual Behavior:
During the debug build process, PlatformIO adds
-g2
and-ggdb2
flags to both the GCC compiler and the assembler. While GCC handles these flags gracefully, the assembler does not recognize-g2
, resulting in a fatal error and preventing the debug session from starting.The text was updated successfully, but these errors were encountered: