-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Reporting this on ESP32-S3 since that was what I had tested, but this likely applies to all ESP32-* Xtensa and RISC-V cores.
OpenOCD v0.12.0 added Zephyr OS awareness and also supports the ESP32-S3 chip directly. However, setting CONFIG_DEBUG_THREAD_INFO=y results in a debug error:
Open On-Chip Debugger 0.12.0+dev-01324-gfb52ba4fa (2023-09-19-00:01)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
force hard breakpoints
can't read "_TARGETNAME": no such variable
Adding set _TARGETNAME esp32s3.cpu1 to the openocd.cfg file to bypass probing shows the OpenOCD error
Info : Zephyr: looking for target: esp32s3
Error: Could not find target in Zephyr compatibility list
Looking at the v0.12 OpenOCD code, the Zephyr RTOS support shows that only arm and arcv2 architectures are supported.
static struct zephyr_params zephyr_params_list[] = {
{
.target_name = "cortex_m",
.pointer_width = 4,
.callee_saved_stacking = &arm_callee_saved_stacking,
.cpu_saved_nofp_stacking = &arm_cpu_saved_nofp_stacking,
.cpu_saved_fp_stacking = &arm_cpu_saved_fp_stacking,
.get_cpu_state = &zephyr_get_arm_state,
},
{
.target_name = "cortex_r4",
.pointer_width = 4,
.callee_saved_stacking = &arm_callee_saved_stacking,
.cpu_saved_nofp_stacking = &arm_cpu_saved_nofp_stacking,
.cpu_saved_fp_stacking = &arm_cpu_saved_fp_stacking,
.get_cpu_state = &zephyr_get_arm_state,
},
{
.target_name = "hla_target",
.pointer_width = 4,
.callee_saved_stacking = &arm_callee_saved_stacking,
.cpu_saved_nofp_stacking = &arm_cpu_saved_nofp_stacking,
.cpu_saved_fp_stacking = &arm_cpu_saved_fp_stacking,
.get_cpu_state = &zephyr_get_arm_state,
},
{
.target_name = "arcv2",
.pointer_width = 4,
.callee_saved_stacking = &arc_callee_saved_stacking,
.cpu_saved_nofp_stacking = &arc_cpu_saved_stacking,
.get_cpu_state = &zephyr_get_arc_state,
},
{
.target_name = NULL
}
};
See the following links for the code
- Official OpenOCD - https://github.com/openocd-org/openocd/blob/master/src/rtos/zephyr.c#L335
- EspressIf Branch of OpenOCD - https://github.com/espressif/openocd-esp32/blob/master/src/rtos/zephyr.c#L334
Describe the solution you'd like
Add Zephyr RTOS thread awareness to OpenOCD / GDB to enable multi-threaded debugging when running west debug for ESP32-S3 targets (this would likely work for ESP32 and ESP32-S2 targets as well).
Describe alternatives you've considered
No known alternatives to this for Zephyr RTOS other than using the tracing and logging frameworks for debugging.