I've seen a Teensy developer having problems with warnings stopping their compile sessions trying to move from Arduino v1.8.x to Arduino IDE v2.0.3.
While I added in-circuit debugging to the STM32 platform for IDE v2, I started working on getting OpenOCD working with the ESP32 and added those features to the Tools menu for the espressif ESP32. It's not very difficult to add this and it improves the developer experience considerably having control of the compiler and compiler output.
example of changes to boards.txt:
menu.DebugLevel=Core Debug Level
menu.Debugging=Compiler Debug Levels
menu.opt=Optimize
teensy40.menu.DebugLevel.none=None
teensy40.menu.DebugLevel.none.build.code_debug=0
teensy40.menu.DebugLevel.error=Error
teensy40.menu.DebugLevel.error.build.code_debug=1
teensy40.menu.DebugLevel.warn=Warn
teensy40.menu.DebugLevel.warn.build.code_debug=2
teensy40.menu.DebugLevel.info=Info
teensy40.menu.DebugLevel.info.build.code_debug=3
teensy40.menu.DebugLevel.debug=Debug
teensy40.menu.DebugLevel.debug.build.code_debug=4
teensy40.menu.DebugLevel.verbose=Verbose
teensy40.menu.DebugLevel.verbose.build.code_debug=5
teensy40.menu.Debugging.none=None
teensy40.menu.Debugging.enable_sym=Symbols Enabled (-g)
teensy40.menu.Debugging.enable_sym.build.flags.debug=-g -DNDEBUG
teensy40.menu.Debugging.enable_log=Core logs Enabled
teensy40.menu.Debugging.enable_log.build.flags.debug=
teensy40.menu.Debugging.enable_all=Core Logs and Symbols Enabled (-g)
teensy40.menu.Debugging.enable_all.build.flags.debug=-g
teensy40.menu.opt.osstd=Smallest (-Os default)
teensy40.menu.opt.osltd.build.flags.optimize=-Os
teensy40.menu.opt.oslto=Smallest (-Os) with LTO
teensy40.menu.opt.oslto.build.flags.optimize=-Os -flto
teensy40.menu.opt.o1std=Fast (-O1)
teensy40.menu.opt.o1std.build.flags.optimize=-O1
teensy40.menu.opt.o1lto=Fast (-O1) with LTO
teensy40.menu.opt.o1lto.build.flags.optimize=-O1 -flto
teensy40.menu.opt.o2std=Faster (-O2)
teensy40.menu.opt.o2std.build.flags.optimize=-O2
teensy40.menu.opt.o2lto=Faster (-O2) with LTO
teensy40.menu.opt.o2lto.build.flags.optimize=-O2 -flto
teensy40.menu.opt.o3std=Fastest (-O3)
teensy40.menu.opt.o3std.build.flags.optimize=-O3
teensy40.menu.opt.o3lto=Fastest (-O3) with LTO
teensy40.menu.opt.o3lto.build.flags.optimize=-O3 -flto
teensy40.menu.opt.ogstd=Debug (-Og)
teensy40.menu.opt.ogstd.build.flags.optimize=-Og
teensy40.menu.opt.o0std=No Optimization (-O0)
teensy40.menu.opt.o0std.build.flags.optimize=-O0
and example of using those flags in platform.txt( note build.lfags.optimize, build.flags.debug )
compiler.c.flags.teensy40=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb {build.flags.optimize} {build.flags.debug} -freorder-blocks -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -MMD -c
# Defaults config
build.flags.optimize=-Os
build.flags.debug=-DNDEBUG
While I added in-circuit debugging to the STM32 platform for IDE v2, I started working on getting OpenOCD working with the ESP32 and added those features to the Tools menu for the espressif ESP32. It's not very difficult to add this and it improves the developer experience considerably having control of the compiler and compiler output.
example of changes to boards.txt:
menu.DebugLevel=Core Debug Level
menu.Debugging=Compiler Debug Levels
menu.opt=Optimize
teensy40.menu.DebugLevel.none=None
teensy40.menu.DebugLevel.none.build.code_debug=0
teensy40.menu.DebugLevel.error=Error
teensy40.menu.DebugLevel.error.build.code_debug=1
teensy40.menu.DebugLevel.warn=Warn
teensy40.menu.DebugLevel.warn.build.code_debug=2
teensy40.menu.DebugLevel.info=Info
teensy40.menu.DebugLevel.info.build.code_debug=3
teensy40.menu.DebugLevel.debug=Debug
teensy40.menu.DebugLevel.debug.build.code_debug=4
teensy40.menu.DebugLevel.verbose=Verbose
teensy40.menu.DebugLevel.verbose.build.code_debug=5
teensy40.menu.Debugging.none=None
teensy40.menu.Debugging.enable_sym=Symbols Enabled (-g)
teensy40.menu.Debugging.enable_sym.build.flags.debug=-g -DNDEBUG
teensy40.menu.Debugging.enable_log=Core logs Enabled
teensy40.menu.Debugging.enable_log.build.flags.debug=
teensy40.menu.Debugging.enable_all=Core Logs and Symbols Enabled (-g)
teensy40.menu.Debugging.enable_all.build.flags.debug=-g
teensy40.menu.opt.osstd=Smallest (-Os default)
teensy40.menu.opt.osltd.build.flags.optimize=-Os
teensy40.menu.opt.oslto=Smallest (-Os) with LTO
teensy40.menu.opt.oslto.build.flags.optimize=-Os -flto
teensy40.menu.opt.o1std=Fast (-O1)
teensy40.menu.opt.o1std.build.flags.optimize=-O1
teensy40.menu.opt.o1lto=Fast (-O1) with LTO
teensy40.menu.opt.o1lto.build.flags.optimize=-O1 -flto
teensy40.menu.opt.o2std=Faster (-O2)
teensy40.menu.opt.o2std.build.flags.optimize=-O2
teensy40.menu.opt.o2lto=Faster (-O2) with LTO
teensy40.menu.opt.o2lto.build.flags.optimize=-O2 -flto
teensy40.menu.opt.o3std=Fastest (-O3)
teensy40.menu.opt.o3std.build.flags.optimize=-O3
teensy40.menu.opt.o3lto=Fastest (-O3) with LTO
teensy40.menu.opt.o3lto.build.flags.optimize=-O3 -flto
teensy40.menu.opt.ogstd=Debug (-Og)
teensy40.menu.opt.ogstd.build.flags.optimize=-Og
teensy40.menu.opt.o0std=No Optimization (-O0)
teensy40.menu.opt.o0std.build.flags.optimize=-O0
and example of using those flags in platform.txt( note build.lfags.optimize, build.flags.debug )
compiler.c.flags.teensy40=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb {build.flags.optimize} {build.flags.debug} -freorder-blocks -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -MMD -c
# Defaults config
build.flags.optimize=-Os
build.flags.debug=-DNDEBUG