Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,59 @@

All notable changes to the "Espressif IDF" extension will be documented in this file.

## [1.11.0](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.11.0)

## Features and enhancements

- [Add DevKits support](https://github.com/espressif/vscode-esp-idf-extension/pull/1557)
- [Add gitignore on project creation](https://github.com/espressif/vscode-esp-idf-extension/pull/1578)
- [Pre-Release branch docs](https://github.com/espressif/vscode-esp-idf-extension/pull/1599)
- [Modify event activation for file types](https://github.com/espressif/vscode-esp-idf-extension/pull/1568)
- [Add classic menuconfig in Editor Panel](https://github.com/espressif/vscode-esp-idf-extension/pull/1598)
- [Update webviews to VS Code UI Style](https://github.com/espressif/vscode-esp-idf-extension/pull/1554)
- [Allow customize Pytest glob pattern and unit test services](https://github.com/espressif/vscode-esp-idf-extension/pull/1593)
- [CLang install prompt if not installed](https://github.com/espressif/vscode-esp-idf-extension/pull/1615)
- [Allow additional files and directories for Full Clean commands](https://github.com/espressif/vscode-esp-idf-extension/pull/1613)
- [Extend JTAG flash arguments as configuration setting](https://github.com/espressif/vscode-esp-idf-extension/pull/1583)
- [Range support for downloads in Setup Wizard](https://github.com/espressif/vscode-esp-idf-extension/pull/1625)
- [Check OpenOCD is running before debug is launched](https://github.com/espressif/vscode-esp-idf-extension/pull/1638)
- [Add function names in Disassembly view](https://github.com/espressif/vscode-esp-idf-extension/pull/1634)
- [OpenOCD Hints in Hints Viewer](https://github.com/espressif/vscode-esp-idf-extension/pull/1476)
- [Add detect as default serial port option and use esptool.py to find serial port](https://github.com/espressif/vscode-esp-idf-extension/pull/1632)
- [Pre-release campaign notification](https://github.com/espressif/vscode-esp-idf-extension/pull/1643)
- [Prefer gdbinit prefix_map with fallback to prefix_map_gdbinit](https://github.com/espressif/vscode-esp-idf-extension/pull/1660)
- [AI Integration with Copilot Chat using Language Tool API](https://github.com/espressif/vscode-esp-idf-extension/pull/1621)
- [Allow customize PyPi Index URL in setup wizard](https://github.com/espressif/vscode-esp-idf-extension/pull/1692)
- [Add create empty project command](https://github.com/espressif/vscode-esp-idf-extension/pull/1698)
- [Add Unity Runner and Parser, Remove Pytest](https://github.com/espressif/vscode-esp-idf-extension/pull/1681)


### Bug Fixes

- [Update disassemble screenshot](https://github.com/espressif/vscode-esp-idf-extension/pull/1588)
- [JTAG acronym issues](https://github.com/espressif/vscode-esp-idf-extension/pull/1604)
- [Fix IDF_TARGET in multiple project configuration profiles](https://github.com/espressif/vscode-esp-idf-extension/pull/1579)
- [Fix Partial encryption in encrypted flashing](https://github.com/espressif/vscode-esp-idf-extension/pull/1373)
- [Close OpenOCD after JTAG flash end](https://github.com/espressif/vscode-esp-idf-extension/pull/1601)
- [NodeJS 20 in CI](https://github.com/espressif/vscode-esp-idf-extension/pull/1611)
- [Update build message](https://github.com/espressif/vscode-esp-idf-extension/pull/1603)
- [Fix append git and pigweed to PATH instead of prepend](https://github.com/espressif/vscode-esp-idf-extension/pull/1614)
- [Use latest in master in docs](https://github.com/espressif/vscode-esp-idf-extension/pull/1636)
- [Fix fileExists check in Setup panel](https://github.com/espressif/vscode-esp-idf-extension/pull/1609) Thanks @jonsambro !
- [Use mon program_esp instead of load for Symbol loading in debug](https://github.com/espressif/vscode-esp-idf-extension/pull/1556) Thanks @wormyrocks !
- [Move Status bar items to the left](https://github.com/espressif/vscode-esp-idf-extension/pull/1626)
- [Fix set target preview targets](https://github.com/espressif/vscode-esp-idf-extension/pull/1652)
- [Fix App trace and Heap Trace](https://github.com/espressif/vscode-esp-idf-extension/pull/1656)
- [Setup wizard misleading idf.py not found message fix](https://github.com/espressif/vscode-esp-idf-extension/pull/1642)
- [Clang and OpenOCD in PATH validation](https://github.com/espressif/vscode-esp-idf-extension/pull/1666)
- [Telemetry issues bugfixes](https://github.com/espressif/vscode-esp-idf-extension/pull/1675)
- [Fix openOCDRulesPath in addOpenOCDRules](https://github.com/espressif/vscode-esp-idf-extension/pull/1685)
- [Add contrainsts in pytest install step](https://github.com/espressif/vscode-esp-idf-extension/pull/1686)
- [Add double quoutes around gdbinit file path](https://github.com/espressif/vscode-esp-idf-extension/pull/1684)




## [1.10.1](https://github.com/espressif/vscode-esp-idf-extension/releases/tag/v1.10.1)

## Features and enhancements
Expand Down
7 changes: 7 additions & 0 deletions docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Documentation has moved to:

# [English](https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/troubleshooting.html)

# 文档已移至

# [中文](https://docs.espressif.com/projects/vscode-esp-idf-extension/zh_CN/latest/troubleshooting.html)
1 change: 1 addition & 0 deletions docs_espressif/en/debugproject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ You can modify the configuration to suit your needs. Let's describe the configur

Some additional arguments you might use are:

- ``buildFlashMonitor``: (Default: false). Build, flash and launch IDF Monitor before starting the debug session. Use ``idf.monitorDelay`` to set a delay, in milliseconds, after starting the monitor (Default is ``1000``).
- ``debugPort``: (Default: 43476) The port to launch the Eclipse CDT GDB Debug Adapter server. If not specified, it will use the default value of 43476.
- ``runOpenOCD``: (Default: true). Run extension OpenOCD Server.
- ``verifyAppBinBeforeDebug``: (Default: false) Verify that current ESP-IDF project binary is the same as binary in chip.
Expand Down
104 changes: 104 additions & 0 deletions docs_espressif/zh_CN/debugproject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,110 @@

其中 ``0x20000`` 是分区表中使用的应用程序镜像偏移量。

调试配置
--------

要配置调试会话,请打开项目的 ``.vscode/launch.json`` 文件。此文件包含调试会话的配置。默认配置如下:

.. code-block:: JSON

{
"configurations": [
{
"type": "gdbtarget",
"request": "attach",
"name": "Eclipse CDT GDB Adapter"
}
]
}

你可以根据需要修改配置。以下是配置选项的说明:

- ``type``: 调试配置的类型。应设置为 ``gdbtarget``。
- ``program``: 项目构建目录中的 ELF 文件,用于执行调试会话。可以使用命令 ``${command:espIdf.getProjectName}`` 查询扩展以查找当前构建目录的项目名称。
- ``initCommands``: 用于初始化 GDB 和目标设备的 GDB 命令。默认值为 ``["set remote hardware-watchpoint-limit IDF_TARGET_CPU_WATCHPOINT_NUM", "mon reset halt", "maintenance flush register-cache"]``。
- ``initialBreakpoint``: 当未定义 ``initCommands`` 时,此命令将在默认 ``initCommands`` 中添加指定函数名的硬件断点。例如 app_main(默认值)将在默认 initCommands 中添加 ``thb app_main``。如果设置为 ""(空字符串),则不会设置初始断点;如果未定义,则使用默认值 thb app_main。
- ``gdb``: 要使用的 GDB 可执行文件。默认情况下,"${command:espIdf.getToolchainGdb}" 将查询扩展以查找当前 ESP-IDF 项目的 IDF_TARGET(esp32、esp32c6 等)对应的 ESP-IDF 工具链 GDB。

.. note::
**IDF_TARGET_CPU_WATCHPOINT_NUM** 由扩展根据当前 ESP-IDF 项目的 ``IDF_TARGET`` (esp32、esp32c6 等)解析。

你可能使用的其他参数包括:

- ``buildFlashMonitor``: (默认值:false)。在启动调试会话之前构建、烧录并启动 IDF Monitor。使用 ``idf.monitorDelay`` 设置启动监视器后的延迟时间(以毫秒为单位,默认值为 ``1000``)。
- ``debugPort``: (默认值:43476)启动 Eclipse CDT GDB 调试适配器服务器的端口。如果未指定,将使用默认值 43476。
- ``runOpenOCD``: (默认值:true)。运行扩展 OpenOCD 服务器。
- ``verifyAppBinBeforeDebug``: (默认值:false)验证当前 ESP-IDF 项目二进制文件是否与芯片中的二进制文件相同。
- ``logFile``: 用于记录与 gdb 交互的文件的绝对路径。示例:${workspaceFolder}/gdb.log。
- ``verbose``: 生成详细的日志输出。
- ``environment``: 应用于 ESP-IDF 调试适配器的环境变量。它将替换全局环境变量和扩展使用的环境变量。

.. code-block:: JSON

{
"environment": {
"VAR": "Value"
}
}

- ``imageAndSymbols`` :

.. code-block:: JSON

{
"imageAndSymbols": {
"symbolFileName": "如果指定,则在给定(可选)偏移量处加载的符号文件",
"symbolOffset": "如果指定了 symbolFileName,则使用的偏移量",
"imageFileName": "如果指定,则在给定(可选)偏移量处加载的镜像文件",
"imageOffset": "如果指定了 imageFileName,则使用的偏移量"
}
}

- ``target``: 要附加的目标配置。指定如何连接到要调试的设备。通常 OpenOCD 将芯片作为端口 3333 上的远程目标公开。

.. code-block:: JSON

{
"target": {
"type": "要执行的目标调试类型。传递给 -target-select(默认为 remote)",
"host": "要连接的目标主机(默认为 'localhost',如果设置了 parameters 则忽略)",
"port": "要连接的目标端口(默认为 serverPortRegExp 捕获的值,如果设置了 parameters 则忽略)",
"parameters": "目标类型的目标参数。通常是类似 localhost:12345 的内容。(默认为 `${host}:${port}`)",
"connectCommands": "替换所有先前的参数,指定用于建立连接的命令数组"
}
}

下面显示了一个修改后的 launch.json 文件示例:

.. code-block:: JSON

{
"configurations": [
{
"type": "gdbtarget",
"request": "attach",
"name": "Eclipse CDT GDB Adapter",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"initCommands": [
"set remote hardware-watchpoint-limit IDF_TARGET_CPU_WATCHPOINT_NUM",
"mon reset halt",
"maintenance flush register-cache"
],
"gdb": "${command:espIdf.getToolchainGdb}",
"target": {
"connectCommands": [
"set remotetimeout 20",
"-target-select extended-remote localhost:3333"
]
}
}
]
}

虽然前面的示例明确使用了默认值,但可以根据需要进行自定义。

ESP-IDF VS Code 扩展的 package.json gdbtarget 调试器贡献中记录了其他较少使用的参数。

浏览代码、调用栈和线程
----------------------

Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,11 @@
"description": "Port for Debug Adapter server. Default: 43476",
"default": 43476
},
"buildFlashMonitor": {
"type": "boolean",
"description": "Build, Flash and Monitor the device before debugging",
"default": false
},
"runOpenOCD": {
"type": "boolean",
"description": "Run OpenOCD Server",
Expand Down Expand Up @@ -2217,6 +2222,11 @@
"description": "Port for Debug Adapter server. Default: 43476",
"default": 43476
},
"buildFlashMonitor": {
"type": "boolean",
"description": "Build, Flash and Monitor the device before debugging",
"default": false
},
"runOpenOCD": {
"type": "boolean",
"description": "Run OpenOCD Server",
Expand Down
2 changes: 1 addition & 1 deletion src/build/buildCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ export async function buildCommand(
false
);
}
continueFlag = false;
}
continueFlag = false;
return continueFlag;
}

Expand Down
127 changes: 127 additions & 0 deletions src/buildFlashMonitor/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* Project: ESP-IDF VSCode Extension
* File Created: Wednesday, 26th November 2025 10:54:44 am
* Copyright 2025 Espressif Systems (Shanghai) CO LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
CancellationToken,
commands,
env,
l10n,
Progress,
ProgressLocation,
UIKind,
Uri,
window,
} from "vscode";
import { openFolderCheck } from "../common/PreCheck";
import { NotificationMode, readParameter } from "../idfConfiguration";
import { PreCheck, shouldDisableMonitorReset } from "../utils";
import { IDFWebCommandKeys } from "../cmdTreeView/cmdStore";
import { isFlashEncryptionEnabled } from "../flash/verifyFlashEncryption";
import { ESP } from "../config";
import { IDFMonitor } from "../espIdf/monitor";
import { buildCommand } from "../build/buildCmd";
import { startFlashing } from "../flash/startFlashing";
import { createNewIdfMonitor } from "../espIdf/monitor/command";

export async function buildFlashAndMonitor(
workspaceFolderUri: Uri,
noResetMonitor?: boolean
) {
await PreCheck.perform([openFolderCheck], async () => {
const notificationMode = readParameter(
"idf.notificationMode",
workspaceFolderUri
) as string;
const currentProgressLocation =
notificationMode === NotificationMode.All ||
notificationMode === NotificationMode.Notifications
? ProgressLocation.Notification
: ProgressLocation.Window;

await window.withProgress(
{
cancellable: true,
location: currentProgressLocation,
title: l10n.t("ESP-IDF: Building project"),
},
async (
progress: Progress<{ message: string; increment: number }>,
cancelToken: CancellationToken
) => {
progress.report({ message: "Building project...", increment: 20 });
const flashType = readParameter("idf.flashType", workspaceFolderUri);
let canContinue = await buildCommand(
workspaceFolderUri,
cancelToken,
flashType
);
if (!canContinue) {
return;
}
// Re route to ESP-IDF Web extension if using Codespaces or Browser
if (env.uiKind === UIKind.Web) {
commands.executeCommand(IDFWebCommandKeys.FlashAndMonitor);
return;
}
progress.report({
message: "Flashing project into device...",
increment: 60,
});

let encryptPartitions = await isFlashEncryptionEnabled(
workspaceFolderUri
);

let partitionToUse = readParameter(
"idf.flashPartitionToUse",
workspaceFolderUri
) as ESP.BuildType;

if (
partitionToUse &&
!["app", "bootloader", "partition-table"].includes(partitionToUse)
) {
partitionToUse = undefined;
}

canContinue = await startFlashing(
workspaceFolderUri,
cancelToken,
flashType,
encryptPartitions,
partitionToUse
);
if (!canContinue) {
return;
}
progress.report({
message: "Launching monitor...",
increment: 10,
});
if (IDFMonitor.terminal) {
IDFMonitor.terminal.sendText(ESP.CTRL_RBRACKET);
}
const noReset =
typeof noResetMonitor !== "undefined"
? noResetMonitor
: await shouldDisableMonitorReset(workspaceFolderUri);
await createNewIdfMonitor(workspaceFolderUri, noReset);
}
);
});
}
25 changes: 14 additions & 11 deletions src/cdtDebugAdapter/debugConfProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { Logger } from "../logger/logger";
import { getConfigValueFromSDKConfig, getToolchainPath } from "../utils";
import { createNewIdfMonitor } from "../espIdf/monitor/command";
import { ESP } from "../config";
import { buildFlashAndMonitor } from "../buildFlashMonitor";

export class CDTDebugConfigurationProvider
implements DebugConfigurationProvider {
Expand All @@ -58,6 +59,19 @@ export class CDTDebugConfigurationProvider
}
}
}
const useMonitorWithDebug = readParameter(
"idf.launchMonitorOnDebugSession",
folder
);
if (config.buildFlashMonitor) {
await buildFlashAndMonitor(folder.uri, true);
} else if (
config.sessionID !== "core-dump.debug.session.ws" &&
config.sessionID !== "gdbstub.debug.session.ws" &&
useMonitorWithDebug
) {
await createNewIdfMonitor(folder.uri, true);
}
if (!config.program) {
const buildDirPath = readParameter("idf.buildPath", folder) as string;
const projectName = await getProjectName(buildDirPath);
Expand Down Expand Up @@ -170,17 +184,6 @@ export class CDTDebugConfigurationProvider
);
}
}
const useMonitorWithDebug = readParameter(
"idf.launchMonitorOnDebugSession",
folder
);
if (
config.sessionID !== "core-dump.debug.session.ws" &&
config.sessionID !== "gdbstub.debug.session.ws" &&
useMonitorWithDebug
) {
await createNewIdfMonitor(folder.uri, true);
}
const openOCDManager = OpenOCDManager.init();
if (
!openOCDManager.isRunning() &&
Expand Down
Loading
Loading