Hi there,
I am trying desperately to use the USB built-in JTAG debugger for my Esp32-s3 project but could not make it work properly. This now made me run in circle for days, going over all the forum posts related and I still could not solve it, so here I am
I managed multiple times to have the debugger starting, but it gets stuck pretty quickly. Either looping back to the same breakpoint indefinately or just hanging…
I have a main env, which I use in normal mode which uses TinyUSB, and a debug env in which I disable these features to let the debugger use the USB port.
I am working with only one USB interface on my board (connected to D+/D-)
My platform.ini looks like this:
[env]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_archive = no
lib_ldf_mode = deep+
lib_deps =
adafruit/Adafruit TinyUSB Library@ 3.1.0
esphome/ESPAsyncWebServer-esphome@3.1.0
esphome/AsyncTCP-esphome@2.1.1
bblanchon/ArduinoJson @ 7.2.0
board_build.filesystem = littlefs
board_build.partitions = partitions_custom.csv
upload_speed = 921600
monitor_speed = 115200
build_unflags = -DARDUINO_USB_MODE=1
build_flags =
-DUSE_TINYUSB=1
-DARDUINO_USB_MODE=0
-DARDUINO_USB_CDC_ON_BOOT=1
-DASYNCWEBSERVER_REGEX
-fpermissive
'-DCFG_TUSB_CONFIG_FILE="${platformio.home_dir}/packages/framework-arduinoespressif32/tools/sdk/esp32s3/include/arduino_tinyusb/include/tusb_config.h"'
-DCORE_DEBUG_LEVEL=5
-DASYNC_TCP_RUNNING_CORE=0
extra_scripts =
pre:scripts/copy_default_config.py
pre:scripts/define-version.py
[env:motion]
build_flags=
${env.build_flags}
-DPIPO_MOTION=1
[env:motiondebug]
debug_tool = esp-builtin
build_type = debug
debug_load_mode = manual
debug_speed = 921600
build_flags=
-DARDUINO_USB_CDC_ON_BOOT=1
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DASYNCWEBSERVER_REGEX
-fpermissive
-DASYNC_TCP_RUNNING_CORE=0
-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
monitor_filters = esp32_exception_decoder
[platformio]
default_envs = motion
Steps I follow:
- put the board in upload mode with boot+reset
- upload with: pio run -t upload -e motiondebug
- start debugging with F5
When doing so, the debugging start then after hanging for a while it ends up to the following, and keeps running in circle to that app_main(). I actually found way to make it continue further but then it stops because it cannot find the filesystem files. So I suppose something is not configured properly.
I also noticed the launch.json task of the debugger contained a path which did not seem to point to the debug env firmware (“executable” points to “motion” instead of “motiondebug” build, but I am unsure if this is related to my issue.
{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/Users/rup/Documents/GitHub/thisproject/.pio/build/motion/firmware.elf",
"projectEnvName": "motiondebug",
"toolchainBinDir": "/Users/rup/.platformio/packages/toolchain-xtensa-esp32s3/bin",
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
}
},
Thanks a lot for giving a look, I am probably not the only one struggling with this.