ESP32-S3 JTAG Debugging User Guide

本文介绍了如何使用ESP32-S3的JTAG引脚和USB引脚进行调试,包括硬件设置、软件环境准备、固件烧录以及使用OpenOCD和GDB进行调试的步骤。特别提到了启用闪存加密和安全启动后对JTAG调试的影响,以及如何配置eFuse来启用JTAG功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、Introduce

The ESP32-S3 support use the JTAG pins or USB pins for JTAG debugging. For more instructions,please read the “ESP32-S3 JTAG Debugging ”guide.


2、Hardware Instructions

2.1 JTAG Pins for Debugging

For debugging with JTAG pins, you need to use the ESP-PROG tool.

ESP32-S3 PinJTAG Signal
MTDO / GPIO40TDO
MTDI / GPIO41TDI
MTCK / GPIO39TCK
MTMS / GPIO42TMS

Please Note :

  • If you need to use the JTAG pins for debugging, First, you need to set the STRAP_JTAG_SEL to ‘1’ in eFuse , and then the GPIO3 needs to be pulled down.

在这里插入图片描述

  • Write the eFuse STRAP_JTAG_SEL command
espefuse.py -p COM4 burn_efuse STRAP_JTAG_SEL 1

在这里插入图片描述

  • Please refer to the 《ESP32-S3 Datasheet》 about the "Table 2-13. JTAG Signal Source Control" instructions. As follows :

在这里插入图片描述


2.2 USB Pins for Debugging

If you need to use the USB pins for debugging,the GPIO3 can be float.

  • ESP32-S3 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary. The necessary connections are shown in the following section. Please read the "Configure ESP32-S3 built-in JTAG Interface " instructions.
ESP32-S3 PinUSB Signal
GPIO19D-
GPIO20D+
5VV_BUS
GNDGround

3、Debugging Environment Preparation

3.1 The Software Environment

  • The esp-idf SDK software compilation environment
  • OpenOCD environment
  • GDB command environment

The software development environment we recommend to you is the simplest.


3.2 The Hardware Preparation

在这里插入图片描述


4、Debugging Steps

4.1 Flash the firmware

  • Under the esp-idf SDK compilation environment, please use the UART0 pins and running the following command to download the firmware and view the firmware running log.
idf.py -p COM4 flash monitor

在这里插入图片描述


4.2 Running OpenOCD

  • We recommend to open a new esp-idf CMD terminal environment, then to running the “openocd” environment,Please refer to the "Run OpenOCD " . For example,

    在这里插入图片描述

    • If you are using the USB Pins for Debugging , you need to use the “openocd” command to running the “esp32s3-builtin.cfg” file.
openocd -f C:\Users\caiguanhong\.espressif\tools\openocd-esp32\v0.10.0-esp32-20211111\openocd-esp32\share\openocd\scripts\board\esp32s3-builtin.cfg
    • If you are using the JTAG Pins for Debugging , you need to use the “openocd” command to running the “esp32s3-ftdi.cfg” file.
openocd -f C:\Users\caiguanhong\.espressif\tools\openocd-esp32\v0.10.0-esp32-20211111\openocd-esp32\share\openocd\scripts\board\esp32s3-ftdi.cfg

在这里插入图片描述
在这里插入图片描述

【Note】

If you get similar the follows error report when running openocd commands, please try to install the zadig tool to resolve the problem. Please refer to “Windows - manual driver change” instructions.

E:\esp\Espressif\frameworks\esp-idf-v5.1.2>openocd -f E:\esp\Espressif\tools\openocd-esp32\v0.12.0-esp32-20240318\openocd-esp32\share\openocd\scripts\board\esp32-wrover-kit-1.8v.cfg
Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
Error: unable to open ftdi device with description '*', serial '*' at bus location '*'
E:\esp2\Espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg:9: Error:
at file "E:\esp2\Espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 9

在这里插入图片描述


4.3 Create a configuration file and name it gdbinit

  • Under the current debug project, create a configuration file named “gdbinit” and write the following. Please read the “Command Line ” instructions.
target remote :3333
set remote hardware-watchpoint-limit 2
mon reset halt
flushregs
thb app_main
c

图像_2023-03-10_15-05-59.png


4.4 Ready to launch GDB

  • We recommend to open a new esp-idf CMD terminal environment, and to enable the “GDB” environment. Please refer to “Command Line” .

  • You need to running your project ".elf " file, As follows:

在这里插入图片描述

  • Ready to launch GDB
xtensa-esp32s3-elf-gdb -x gdbinit build\blink.elf

在这里插入图片描述


4.5 Setting and clearing breakpoints

  • Use the gdb break 33 command to set the breakpoints
  • Use the gdb c command to running breakpoints

As follows:

在这里插入图片描述

For more guide ,please refer to “Debugging Examples”


The BSDL file can refer to “openocd-esp32 ” Source Code.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值