|
From: openocd-gerrit <ope...@us...> - 2025-10-11 16:02:56
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 5fa74d4ee8739ef15d529ce0d4a49d129ce6f517 (commit)
from 8b43a967e59de4eacb65627ea0ff6665dcdb0ac4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5fa74d4ee8739ef15d529ce0d4a49d129ce6f517
Author: EasyDevKits <in...@ea...>
Date: Wed Sep 3 22:21:21 2025 +0200
jtag/ch347: Refine driver and configs for EasyDevKits adapters
This commit improves support for CH347-based JTAG adapters:
- configure.ac: removed "Mode3" restriction (CH347F does not require mode).
- configs: added board config for ESP32-WROVER-E WCH JTAG DevKit and
ESP32-WROVER-E FTDI JTAG DevKit
- ch347 driver: removed `ch347 activity_led` command; activity LED
is now controlled via the generic `adapter gpio led` command.
- doc/openocd.texi: updated documentation accordingly.
Change-Id: I5524290297adcc004e00af919181868d2b6303af
Signed-off-by: EasyDevKits <in...@ea...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9015
Reviewed-by: zapb <de...@za...>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/configure.ac b/configure.ac
index ed26d45e1..128c565a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,7 @@ m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
m4_define([USB1_ADAPTERS],
[[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
- [[ch347], [Mode 3 of CH347 based devices], [CH347]],
+ [[ch347], [CH347 based devices], [CH347]],
[[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
[[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
[[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 6301077fc..d6f9736b8 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2590,6 +2590,9 @@ mitigates the problem.
@end itemize
@end itemize
+The driver supports activity LED through the generic
+command @ref{adapter gpio, @command{adapter gpio led}}.
+
This driver has these driver-specific command:
@deffn {Config Command} {ch347 vid_pid} [vid pid]+
@@ -2609,17 +2612,6 @@ and product ID will be connected.
ch347 device_desc "EasyDevKit"
@end example
@end deffn
-
-@deffn {Config Command} {ch347 activity_led} [n]gpio_number
-If specified the drive let an activity LED blink during JTAG operations.
-The number is the GPIO number of the CH347T chip. If prefixed with "n",
-then this GPIO should be low active. The example configures GPIO4 as
-low active activity LED. For the CH347T chip only GPIO3 (Pin11 / SCL),
-GPIO4 (Pin15 / ACT), GPIO5 (Pin9 / TRST) and GPIO6 (Pin2 / CTS1) are possible.
-@example
-ch347 activity_led n4
-@end example
-@end deffn
@end deffn
@deffn {Interface Driver} {cmsis-dap}
diff --git a/src/jtag/drivers/ch347.c b/src/jtag/drivers/ch347.c
index 6a848ba7c..c031ceece 100644
--- a/src/jtag/drivers/ch347.c
+++ b/src/jtag/drivers/ch347.c
@@ -48,6 +48,7 @@
#include <jtag/interface.h>
#include <jtag/commands.h>
#include <jtag/swd.h>
+#include <jtag/adapter.h>
#include <helper/time_support.h>
#include <helper/replacements.h>
#include <helper/list.h>
@@ -1805,32 +1806,6 @@ COMMAND_HANDLER(ch347_handle_device_desc_command)
return ERROR_OK;
}
-/**
- * @brief The command handler for configuring which GPIO pin is used as activity LED
- *
- * @return ERROR_OK at success; ERROR_COMMAND_SYNTAX_ERROR otherwise
- */
-COMMAND_HANDLER(ch347_handle_activity_led_command)
-{
- if (CMD_ARGC != 1)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- uint8_t gpio;
- if (CMD_ARGV[0][0] == 'n') {
- COMMAND_PARSE_NUMBER(u8, &CMD_ARGV[0][1], gpio);
- ch347_activity_led_active_high = false;
- } else {
- COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], gpio);
- ch347_activity_led_active_high = true;
- }
-
- if (gpio >= GPIO_CNT || (BIT(gpio) & USEABLE_GPIOS) == 0)
- return ERROR_COMMAND_ARGUMENT_INVALID;
-
- ch347_activity_led_gpio_pin = gpio;
- return ERROR_OK;
-}
-
static const struct command_registration ch347_subcommand_handlers[] = {
{
.name = "vid_pid",
@@ -1846,13 +1821,6 @@ static const struct command_registration ch347_subcommand_handlers[] = {
.help = "set the USB device description of the CH347 device",
.usage = "description_string",
},
- {
- .name = "activity_led",
- .handler = &ch347_handle_activity_led_command,
- .mode = COMMAND_CONFIG,
- .help = "if set this CH347 GPIO pin is the JTAG activity LED; start with n for active low output",
- .usage = "[n]gpio_number",
- },
COMMAND_REGISTRATION_DONE
};
@@ -1867,6 +1835,25 @@ static const struct command_registration ch347_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};
+/**
+ * @brief Configure which GPIO pin is used as the activity LED.
+ *
+ * Updates the global activity LED GPIO pin and polarity settings
+ * based on the provided configuration. If the given GPIO is not
+ * usable, the function returns without making changes.
+ *
+ * @param led_config Pointer to the GPIO configuration structure for the LED pin
+ */
+static void ch347_configure_activity_led(const struct adapter_gpio_config *led_config)
+{
+ uint8_t gpio = led_config->gpio_num;
+ if (gpio >= GPIO_CNT || (BIT(gpio) & USEABLE_GPIOS) == 0)
+ return;
+
+ ch347_activity_led_gpio_pin = gpio;
+ ch347_activity_led_active_high = !led_config->active_low;
+}
+
/**
* @brief CH347 Initialization function
*
@@ -1893,6 +1880,8 @@ static int ch347_init(void)
ch347.pack_size = UNSET;
+ ch347_configure_activity_led(&adapter_gpio_get_config()[ADAPTER_GPIO_IDX_LED]);
+
if (!swd_mode) {
tap_set_state(TAP_RESET);
} else {
diff --git a/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg b/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
new file mode 100644
index 000000000..30cfb5797
--- /dev/null
+++ b/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Example OpenOCD configuration file for the EasyDevKits ESP32-WROVER-E FTDI JTAG DevKit.
+#
+# For example, OpenOCD can be started for ESP32 debugging on
+#
+# openocd -f board/esp32-wrover-e-ftdi-jtag-devkit.cfg
+#
+
+# Select the FTDI JTAG driver
+adapter driver ftdi
+
+# Identify the device
+ftdi device_desc "EasyDevKit"
+ftdi vid_pid 0x0403 0x6010
+# interface 0 is JTAG; interface 1 is the uart
+ftdi channel 0
+
+# TCK, TDI, TDO, TMS: ADBUS0-3
+# activity LED: ADBUS4
+ftdi layout_init 0x0008 0x001b
+ftdi layout_signal LED -data 0x0010
+
+# Source the ESP32 configuration file
+source [find target/esp32.cfg]
+
+# ---------------------------------------------------------------------------
+# JTAG speed (in kHz)
+#
+# If you encounter DSR/DIR errors that are not caused by OpenOCD
+# attempting to read unmapped memory regions, try lowering this value.
+#
+# Recommended settings for EasyDevKits:
+# - Do not exceed 20 MHz.
+# - Best results are typically achieved at 20 MHz.
+# ---------------------------------------------------------------------------
+adapter speed 20000
diff --git a/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg b/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
new file mode 100644
index 000000000..76f1435be
--- /dev/null
+++ b/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Example OpenOCD configuration file for the EasyDevKits ESP32-WROVER-E WCH JTAG DevKit.
+#
+# For example, OpenOCD can be started for ESP32 debugging on
+#
+# openocd -f board/esp32-wrover-e-wch-jtag-devkit.cfg
+#
+
+# Select the CH347 JTAG driver
+adapter driver ch347
+
+# Identify the device
+ch347 device_desc "EasyDevKit"
+ch347 vid_pid 0x1a86 0x55dd
+
+# Configure activity LED
+# Note: The LED is active-low on GPIO4.
+adapter gpio led 4 -active-low
+
+# Source the ESP32 configuration file
+source [find target/esp32.cfg]
+
+# ---------------------------------------------------------------------------
+# JTAG speed (in kHz)
+#
+# If you encounter DSR/DIR errors that are not caused by OpenOCD
+# attempting to read unmapped memory regions, try lowering this value.
+#
+# Recommended settings for EasyDevKits:
+# - Do not exceed 30 MHz.
+# - Best results are typically achieved at 15 MHz.
+#
+# Supported frequencies (kHz):
+# 469, 938, 1875, 3750, 7500, 15000, 30000, 60000
+# ---------------------------------------------------------------------------
+adapter speed 15000
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 2 +-
doc/openocd.texi | 14 ++----
src/jtag/drivers/ch347.c | 55 +++++++++-------------
.../esp32-wrover-e-ftdi-jtag-devkit.cfg | 37 +++++++++++++++
.../easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg | 37 +++++++++++++++
5 files changed, 100 insertions(+), 45 deletions(-)
create mode 100644 tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
create mode 100644 tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
hooks/post-receive
--
Main OpenOCD repository
|