From a40c2ec79378d5231ff82f817280bca7e952ba5a Mon Sep 17 00:00:00 2001 From: hulk Date: Fri, 2 Oct 2026 23:07:55 +0800 Subject: [PATCH] =?UTF-8?q?build(vscode):=20=E6=96=B0=E5=A2=9E=20DAPLink?= =?UTF-8?q?=20=E4=B8=93=E7=94=A8=E7=83=A7=E5=BD=95=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8E=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - openocd_daplink_gd32e23x.cfg:去掉 connect_assert_srst(该选项导致 DAPLink 下 Cortex-M23 识别失败) --- .vscode/openocd_daplink_gd32e23x.cfg | 23 +++++++++++++++++++++++ .vscode/tasks.json | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .vscode/openocd_daplink_gd32e23x.cfg diff --git a/.vscode/openocd_daplink_gd32e23x.cfg b/.vscode/openocd_daplink_gd32e23x.cfg new file mode 100644 index 0000000..86534c4 --- /dev/null +++ b/.vscode/openocd_daplink_gd32e23x.cfg @@ -0,0 +1,23 @@ +# DAPLink-friendly GD32E23x flash/debug config +# Difference vs target/openocd_gdlink_gd32e23x.cfg: +# - no connect_assert_srst (breaks target examination with the current DAPLink) +adapter driver cmsis-dap +transport select swd + +source [find target/swj-dp.tcl] +source [find mem_helper.tcl] + +set _CHIPNAME gd32e23x +swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x0BF11477 +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 0x1000 -work-area-backup 0 + +flash bank $_CHIPNAME.flash gd32e23x 0x08000000 0 0 0 $_TARGETNAME + +adapter speed 1000 +reset_config srst_only srst_nogate + +cortex_m reset_config sysresetreq diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 572c001..80a3b13 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -70,6 +70,31 @@ "tooltip": "Flash MCU" } }, + { + "label": "Flash MCU (DAPLink)", + "type": "process", + "command": "${env:GD32_OPENOCD_BIN}/openocd.exe", + "args": [ + "-s", "${env:GD32_OPENOCD_SCRIPTS}", + "-f", "${workspaceFolder}/.vscode/openocd_daplink_gd32e23x.cfg", + "-c", "program Application.elf verify reset exit" + ], + "group": "build", + "problemMatcher": [], + "options": { + "cwd": "${command:cmake.buildDirectory}/Application", + "environment": { + "OPENOCD_SCRIPTS": "${env:GD32_OPENOCD_SCRIPTS}" + } + }, + "presentation": { + "clear": true + }, + "icon": { + "id": "zap", + "tooltip": "Flash MCU via DAPLink (no connect_assert_srst)" + } + }, { "label": "Reset MCU", "type": "process",