Skip to content

Commit d6e860e

Browse files
[VSC-1596] add idf.jtagFlashCommandExtraArgs to modify jtag flash behaviour (#1450)
* add idf.jtagFlashCommandExtraArgs to modify jtag flash behaviour * handle exit command
1 parent 076ffb9 commit d6e860e

10 files changed

+34
-5
lines changed

docs_espressif/en/settings.rst

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ These settings are specific to the ESP32 Chip/Board.
114114
- Forced to use ``/`` instead of ``\\`` as path separator for Win32 based OS
115115
* - **idf.svdFilePath**
116116
- SVD file absolute path to resolve chip debug peripheral tree view
117+
* - **idf.jtagFlashCommandExtraArgs**
118+
- OpenOCD JTAG flash extra arguments. Default is ["verify", "reset"].
117119

118120
This is how the extension uses them:
119121

@@ -123,6 +125,7 @@ This is how the extension uses them:
123125
4. **idf.port** (or **idf.portWin** in Windows) is used as the serial port value for the extension commands.
124126
5. **idf.openOcdDebugLevel** is the log level for OpenOCD server output from 0 to 4.
125127
6. **idf.openOcdLaunchArgs** is the launch arguments string array for OpenOCD. The resulting OpenOCD launch command looks like this: ``openocd -d${idf.openOcdDebugLevel} -f ${idf.openOcdConfigs} ${idf.openOcdLaunchArgs}``.
128+
7. **idf.jtagFlashCommandExtraArgs** is used for OpenOCD JTAG flash task. Please review `Upload application for debugging <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.html#upload-application-for-debugging>`.
126129

127130
.. note::
128131

docs_espressif/zh_CN/settings.rst

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ ESP-IDF 相关设置
112112
- 强制在 Windows 操作系统中使用 ``/`` 作为路径分隔符,而不是 ``\\``
113113
* - **idf.svdFilePath**
114114
- SVD 文件的绝对路径,用于解析芯片在调试器中的外设树视图
115+
* - **idf.jtagFlashCommandExtraArgs**
116+
- OpenOCD JTAG 闪存额外参数。默认值为 ["verify", "reset"]
115117

116118
扩展将按照以下方式使用上述设置:
117119

@@ -121,6 +123,7 @@ ESP-IDF 相关设置
121123
4. **idf.port** (Windows 系统中为 **idf.portWin**)用作扩展命令的串口值。
122124
5. **idf.openOcdDebugLevel** 是 OpenOCD 服务器输出的日志级别,范围为 0 到 4。
123125
6. **idf.openOcdLaunchArgs** 是用于配置 OpenOCD 启动的参数字符串数组。生成的 OpenOCD 启动命令格式如下:``openocd -d${idf.openOcdDebugLevel} -f ${idf.openOcdConfigs} ${idf.openOcdLaunchArgs}``。
126+
7. **idf.jtagFlashCommandExtraArgs** 用于OpenCD JTAG闪存任务。请查看 `上传待调试的应用程序 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/jtag-debugging/index.html#jtag-upload-app-debug>`.
124127

125128
.. note::
126129

package.json

+12
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,18 @@
12001200
"productId": "0x6001"
12011201
}
12021202
}
1203+
},
1204+
"idf.jtagFlashCommandExtraArgs": {
1205+
"type": "array",
1206+
"description": "%param.jtagFlashCommandExtraArgs.title%",
1207+
"scope": "resource",
1208+
"default": [
1209+
"verify",
1210+
"reset"
1211+
],
1212+
"items": {
1213+
"type": "string"
1214+
}
12031215
}
12041216
}
12051217
}

package.nls.es.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"param.exportVars": "Variables que se agregarán a las variables de entorno del sistema",
127127
"param.flashBaudRate": "Tasa de baudios de flasheo ESP-IDF",
128128
"param.gitPath.title": "Ruta del ejecutable de Git",
129+
"param.jtagFlashCommandExtraArgs.title": "Openocd JTAG Flash Argumentos adicionales",
129130
"param.launchMonitorOnDebugSession.title": "Iniciar Monitor IDF junto con la sesión de Adaptador de Depuración ESP-IDF",
130131
"param.monitorBaudRate": "Tasa de baudios de Monitor IDF ESP-IDF",
131132
"param.monitorCustomTimestampFormat": "Formato de marca de tiempo personalizado en Monitor IDF",

package.nls.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"param.exportVars": "Variables to be added to system environment variables",
127127
"param.flashBaudRate": "ESP-IDF flash baud rate",
128128
"param.gitPath.title": "Git executable path",
129+
"param.jtagFlashCommandExtraArgs.title": "OpenOCD JTAG flash extra arguments",
129130
"param.launchMonitorOnDebugSession.title": "Start IDF monitor along with ESP-IDF Debug Adapter session",
130131
"param.monitorBaudRate": "ESP-IDF monitor baud rate",
131132
"param.monitorCustomTimestampFormat": "Custom timestamp format in IDF monitor",

package.nls.pt.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"param.exportVars": "Variáveis ​​a serem adicionadas às variáveis ​​de ambiente do sistema",
127127
"param.flashBaudRate": "Taxa de transmissão de flash ESP-IDF",
128128
"param.gitPath.title": "Caminho executável do Git",
129+
"param.jtagFlashCommandExtraArgs.title": "Argumentos extras do Openocd JTAG Flash",
129130
"param.launchMonitorOnDebugSession.title": "Inicie o IDF Monitor junto com a sessão do adaptador de depuração ESP-IDF",
130131
"param.monitorBaudRate": "Taxa de transmissão do monitor ESP-IDF",
131132
"param.monitorCustomTimestampFormat": "Formato de carimbo de data/hora personalizado no IDF Monitor",

package.nls.ru.json

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
"param.espRainmakerPath": "Путь до фреймворка ESP-Rainmaker (RMAKER_PATH)",
126126
"param.exportVars": "Переменные, добавляемые к переменным системного окружения",
127127
"param.flashBaudRate": "Скорость прошивки ESP-IDF",
128+
"param.jtagFlashCommandExtraArgs.title": "Openocd jtag flash дополнительные аргументы",
128129
"param.gitPath.title": "Путь к исполняемому файлу Git",
129130
"param.launchMonitorOnDebugSession.title": "Запуск монитора IDF вместе с сессией Адаптера Отладки ESP-IDF",
130131
"param.monitorBaudRate": "Скорость передачи данных монитора ESP-IDF",

package.nls.zh-CN.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"param.exportVars": "要添加到系统环境变量中的变量",
127127
"param.flashBaudRate": "ESP-IDF 烧录速率",
128128
"param.gitPath.title": "Git 可执行文件的路径",
129+
"param.jtagFlashCommandExtraArgs.title": "openocd jtag flash额外参数",
129130
"param.launchMonitorOnDebugSession.title": "在 ESP-IDF 调试适配器会话中启动 IDF 监视器",
130131
"param.monitorBaudRate": "ESP-IDF 监视器的波特率值",
131132
"param.monitorCustomTimestampFormat": "在 IDF 监视器中自定义时间戳格式",

src/flash/jtag.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* Project: ESP-IDF VSCode Extension
33
* File Created: Tuesday, 29th September 2020 11:05:15 pm
44
* Copyright 2020 Espressif Systems (Shanghai) CO LTD
5-
*
5+
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
9-
*
9+
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,9 @@ export class JTAGFlash {
3131
.toString()
3232
.replace(TCLClient.DELIMITER, "")
3333
.trim();
34+
if (response === "" && args.some((arg) => arg.includes("exit"))) {
35+
resolve(response);
36+
}
3437
if (response !== "0") {
3538
return reject(
3639
`Failed to flash the device (JTag), please try again [got response: '${response}', expecting: '0']`

src/flash/jtagCmd.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export async function jtagFlashCommand(workspace: Uri) {
5959
workspace
6060
);
6161
let buildPath = readParameter("idf.buildPath", workspace) as string;
62+
let openOCDJTagFlashArguments = readParameter(
63+
"idf.jtagFlashCommandExtraArgs",
64+
workspace
65+
) as string[];
6266
const customTask = new CustomTask(workspace);
6367
if (forceUNIXPathSeparator === true) {
6468
buildPath = buildPath.replace(/\\/g, "/");
@@ -70,8 +74,7 @@ export async function jtagFlashCommand(workspace: Uri) {
7074
"program_esp_bins",
7175
buildPath,
7276
"flasher_args.json",
73-
"verify",
74-
"reset"
77+
...openOCDJTagFlashArguments
7578
);
7679
await customTask.addCustomTask(CustomTaskType.PostFlash);
7780
await customTask.runTasks(CustomTaskType.PostFlash);

0 commit comments

Comments
 (0)