Skip to content

Commit f9bbc96

Browse files
committed
tcl/espressif: clear breakpoints before shutdown openocd
1 parent 300f661 commit f9bbc96

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tcl/target/esp_common.cfg

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,19 @@ proc configure_event_gdb_attach { } {
261261
}
262262
}
263263

264-
proc configure_shutdown_command { } {
264+
# When openocd gets the shutdown signal, it first executes shutdown commands. After that, invokes the gdb_detach event
265+
# callbacks. This is fine for the xtensa but for the riscv, command order is important. Because we will disable the DM
266+
# within the shutdown command
267+
proc configure_shutdown_command_riscv { } {
268+
lappend ::pre_shutdown_commands { esp process_lazy_breakpoints }
265269
# disable debug module to clear ASSIST_DEBUG_CORE_0_DEBUG_MODULE_ACTIVE register.
266270
lappend ::pre_shutdown_commands { riscv dmi_write 0x10 0 }
267271
}
268272

269273
proc configure_openocd_events { ARCH } {
270274
if { $ARCH == "riscv" } {
271275
configure_event_halted
272-
configure_shutdown_command
276+
configure_shutdown_command_riscv
273277
}
274278
configure_event_examine_end
275279
configure_event_reset_assert_post

0 commit comments

Comments
 (0)