Skip to content

Commit 06a624f

Browse files
sylvioalvescarlescufi
authored andcommitted
soc: esp32: add west debug support
This adds west debug support for ESP32 and ESP32S2 boards using custom openocd tool. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 49bcc08 commit 06a624f

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

boards/common/esp32.board.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# SPDX-License-Identifier: Apache-2.0
22

33
board_set_flasher_ifnset(esp32)
4+
board_set_debugger_ifnset(openocd)
5+
6+
board_runner_args(openocd --no-init --no-halt --no-targets --no-load)
7+
board_runner_args(openocd --gdb-init "set remote hardware-watchpoint-limit 2")
8+
board_runner_args(openocd --gdb-init "set disassemble-next-line on")
9+
board_runner_args(openocd --gdb-init "set print pretty on")
10+
11+
board_runner_args(openocd --gdb-init "flushregs")
12+
board_runner_args(openocd --gdb-init "mon reset halt")
13+
board_runner_args(openocd --gdb-init "thb main")
414

515
set(ESP_IDF_PATH ${ZEPHYR_ESPRESSIF_MODULE_DIR})
616
assert(ESP_IDF_PATH "ESP_IDF_PATH is not set")

boards/xtensa/esp32/board.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
board_runner_args(openocd --cmd-pre-init "set ESP_RTOS none")
4+
board_runner_args(openocd --cmd-pre-init "set ESP32_ONLYCPU 1")
5+
6+
# select FT2232 as default interface (as in ESP-WROVER-KIT or ESP-Prog)
7+
board_runner_args(openocd --config "interface/ftdi/esp32_devkitj_v1.cfg")
8+
board_runner_args(openocd --config "target/esp32.cfg")
9+
10+
set (ESPRESSIF_OPENOCD_TOOL ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin/openocd)
11+
set (ESPRESSIF_OPENOCD_SCRIPTS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/share/openocd/scripts)
12+
13+
set(OPENOCD ${ESPRESSIF_OPENOCD_TOOL})
14+
set(OPENOCD_DEFAULT_PATH ${ESPRESSIF_OPENOCD_SCRIPTS})
15+
316
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
17+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
board_runner_args(openocd --cmd-pre-init "set ESP_RTOS none")
4+
board_runner_args(openocd --cmd-pre-init "set ESP32_ONLYCPU 1")
5+
6+
# select FT2232 as default interface (as in ESP-WROVER-KIT or ESP-Prog)
7+
board_runner_args(openocd --config "interface/ftdi/esp32s2_kaluga_v1.cfg")
8+
board_runner_args(openocd --config "target/esp32s2.cfg")
9+
10+
set (ESPRESSIF_OPENOCD_TOOL ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin/openocd)
11+
set (ESPRESSIF_OPENOCD_SCRIPTS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/share/openocd/scripts)
12+
13+
set(OPENOCD ${ESPRESSIF_OPENOCD_TOOL})
14+
set(OPENOCD_DEFAULT_PATH ${ESPRESSIF_OPENOCD_SCRIPTS})
15+
316
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
17+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

0 commit comments

Comments
 (0)