Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add input for select custom openocd board #830

Merged
merged 1 commit into from
Nov 7, 2022
Merged
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
17 changes: 13 additions & 4 deletions src/espIdf/openOcd/boardConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Project: ESP-IDF VSCode Extension
* File Created: Friday, 8th January 2021 5:34:24 pm
* Copyright 2021 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.
Expand Down Expand Up @@ -49,7 +49,7 @@ export const defaultBoards = [
} as IdfBoard,
{
name: "ESP32-S3 chip (via builtin USB-JTAG)",
description: "ESP32-S3 used with ESP-PROG board",
description: "ESP32-S3 debugging via builtin USB-JTAG",
target: "esp32s3",
configFiles: ["board/esp32s3-builtin.cfg"],
} as IdfBoard,
Expand Down Expand Up @@ -104,6 +104,15 @@ export async function getBoards(openOcdScriptsPath: string = "") {
configFiles: b.config_files,
} as IdfBoard;
});
const tmpS3Board = {
name: "ESP32-S3 chip (via builtin USB-JTAG)",
description: "ESP32-S3 debugging via builtin USB-JTAG",
target: "esp32s3",
configFiles: ["board/esp32s3-builtin.cfg"],
} as IdfBoard;
if (espBoards.findIndex((b) => b.name === tmpS3Board.name) === -1) {
espBoards.push(tmpS3Board);
}
const emptyBoard = {
name: "Custom board",
description: "No board selected",
Expand Down
9 changes: 9 additions & 0 deletions src/espIdf/setTarget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ export async function setIdfTarget(placeHolderMsg: string) {
`ESP-IDF board not selected. Remember to set the configuration files for OpenOCD with idf.openOcdConfigs`
);
} else if (selectedBoard && selectedBoard.target) {
if (selectedBoard.label.indexOf("Custom board") !== -1) {
const inputBoard = await window.showInputBox({
placeHolder: "Enter comma separated configuration files",
value: selectedBoard.target.join(","),
});
if (inputBoard) {
selectedBoard.target = inputBoard.split(",");
}
}
await writeParameter(
"idf.openOcdConfigs",
selectedBoard.target,
Expand Down
11 changes: 11 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,17 @@ export async function activate(context: vscode.ExtensionContext) {
if (!selectedBoard) {
return;
}

if (selectedBoard.target.name.indexOf("Custom board") !== -1) {
const inputBoard = await vscode.window.showInputBox({
placeHolder: "Enter comma separated configuration files",
value: selectedBoard.target.configFiles.join(","),
});
if (inputBoard) {
selectedBoard.target.configFiles = inputBoard.split(",");
}
}

const target = idfConf.readParameter("idf.saveScope");
if (
!PreCheck.isWorkspaceFolderOpen() &&
Expand Down