This is an automated email from Gerrit.

"Felipe Moura Oliveira <[email protected]>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9662

-- gerrit

commit 009aefcd4e1d33f09129d0bff4d39104a6ac2d11
Author: Felipe Moura Oliveira <[email protected]>
Date:   Mon May 18 17:35:04 2026 -0300

    tcl: add Holtek HT32F4 (Artery AT32F423-compatible) configs
    
    The Holtek HT32F4 series uses a flash memory controller that is
    register-compatible with the Artery AT32F423. Its device IDs are
    already present in the artery flash driver, so these parts are
    programmed and debugged by the existing driver without code changes.
    
    Add target/ht32f4x.cfg and interface/htlink.cfg (Holtek e-Link32
    Pro/Lite) so the parts are discoverable, plus a note in the artery
    driver documentation.
    
    Verified on a Holtek HT32F49163 (100LQFP, DID 0x700a3240) with an
    e-Link32 Pro: flash probe, sector erase, program, verify and SWD
    debug via the in-tree artery driver.
    
    Change-Id: Ica51123f555e97765d6ea444c7ea1389da8d0abe
    Signed-off-by: Felipe Moura Oliveira <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 6538ff936b..a75c7552d0 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -6767,6 +6767,12 @@ This driver supports Artery Technology devices from the 
following series:
 @item AT32WB415
 @end itemize
 
+Some Holtek HT32F4 devices (e.g.@: the HT32F49153 and HT32F49163) use a
+flash memory controller that is register-compatible with the Artery AT32F423
+and are therefore programmed by this driver.  The
+@file{target/ht32f4x.cfg} target configuration selects it together with the
+@file{interface/htlink.cfg} configuration for the Holtek e-Link32 adapter.
+
 Devices with dual-bank flash memory are currently not supported.
 Also, access to user data in the user system data (USD) area is not supported.
 
diff --git a/tcl/interface/htlink.cfg b/tcl/interface/htlink.cfg
new file mode 100644
index 0000000000..0b841fb04f
--- /dev/null
+++ b/tcl/interface/htlink.cfg
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Holtek e-Link32 Pro/Lite in-circuit debugger/programmer
+#
+# The e-Link32 is a CMSIS-DAP class adapter. Two USB PID pairs are known:
+#   0x04d9:0x802f  e-Link32 Pro
+#   0x04d9:0x8052  e-Link32 Lite
+source [find interface/cmsis-dap.cfg]
+adapter usb vid_pid 0x04d9 0x802f 0x04d9 0x8052
+transport select swd
+adapter speed 1000
diff --git a/tcl/target/ht32f4x.cfg b/tcl/target/ht32f4x.cfg
new file mode 100644
index 0000000000..19ab93114e
--- /dev/null
+++ b/tcl/target/ht32f4x.cfg
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Holtek HT32F4 series (Cortex-M4)
+#
+# The HT32F4 flash memory controller is register-compatible with the Artery
+# AT32 FPEC, so the in-tree "artery" flash driver handles these parts. The
+# Holtek device IDs (read from DBG_IDCODE 0xE0042000) are shared with the
+# Artery AT32F423 / AT32F425 series.
+
+source [find target/swj-dp.tcl]
+
+if { [info exists CHIPNAME] } {
+       set _CHIPNAME $CHIPNAME
+} else {
+       set _CHIPNAME ht32f4x
+}
+
+if { [info exists CPUTAPID] } {
+       set _CPUTAPID $CPUTAPID
+} else {
+       set _CPUTAPID 0x2ba01477
+}
+
+if { [info exists WORKAREASIZE] } {
+       set _WORKAREASIZE $WORKAREASIZE
+} else {
+       set _WORKAREASIZE 0x2000
+}
+
+swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
+dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
+
+$_TARGETNAME configure -work-area-phys 0x20000000 \
+       -work-area-size $_WORKAREASIZE -work-area-backup 0
+
+# Flash size is auto-detected from the device ID by the artery driver.
+flash bank $_CHIPNAME.flash artery 0x08000000 0 0 0 $_TARGETNAME
+
+reset_config srst_only srst_nogate

-- 

Reply via email to