Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions src/cdtDebugAdapter/debugConfProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export class CDTDebugConfigurationProvider
| "esp32c3"
| "esp32c6"
| "esp32h2"
| "esp32p4";
| "esp32p4"
| "esp32c4"
| "esp32c5"
| "esp32c61";
// Mapping of idfTarget to corresponding CPU watchpoint numbers
const idfTargetWatchpointMap: Record<IdfTarget, number> = {
esp32: 2,
Expand All @@ -121,11 +124,14 @@ export class CDTDebugConfigurationProvider
esp32c6: 4,
esp32h2: 4,
esp32p4: 3,
esp32c4: 2,
esp32c5: 4,
esp32c61: 4,
};
config.initCommands = config.initCommands.map((cmd: string) =>
cmd.replace(
"{IDF_TARGET_CPU_WATCHPOINT_NUM}",
idfTargetWatchpointMap[idfTarget]
idfTargetWatchpointMap[idfTarget] || 2
)
);
}
Expand Down
57 changes: 31 additions & 26 deletions src/espIdf/setTarget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { Logger } from "../../logger/logger";
import { OutputChannel } from "../../logger/outputChannel";
import { selectOpenOcdConfigFiles } from "../openOcd/boardConfiguration";
import { getTargetsFromEspIdf } from "./getTargets";
import { getTargetsFromEspIdf, IdfTarget } from "./getTargets";
import { setTargetInIDF } from "./setTargetInIdf";
import { updateCurrentProfileIdfTarget } from "../../project-conf";
import { DevkitsCommand } from "./DevkitsCommand";
Expand Down Expand Up @@ -81,7 +81,7 @@ export async function setIdfTarget(
try {
const devkitsCmd = new DevkitsCommand(workspaceFolder.uri);
const scriptPath = await devkitsCmd.getScriptPath();

if (scriptPath) {
const devkitsOutput = await devkitsCmd.runDevkitsScript();
if (devkitsOutput) {
Expand Down Expand Up @@ -115,26 +115,31 @@ export async function setIdfTarget(
"Connected ESP-IDF devkit detection is skipped while debugging. You can still select a target manually."
);
}
let quickPickItems: any[] = [];
if (connectedBoards.length > 0) {
quickPickItems = [
...connectedBoards,
{ kind: QuickPickItemKind.Separator, label: "Default Boards" },
...targetsFromIdf.map((t) => ({
label: t.label,
target: t.target,
description: t.isPreview ? "Preview target" : undefined,
isConnected: false,
})),
];
} else {
quickPickItems = targetsFromIdf.map((t) => ({
label: t.label,
target: t.target,
description: t.isPreview ? "Preview target" : undefined,
isConnected: false,
}));
}
let quickPickItems: {
label: string;
idfTarget: IdfTarget;
boardInfo?: {
location: string;
config_files: string[];
};
description?: string;
isConnected?: boolean;
}[] = [];
const defaultBoards = targetsFromIdf.map((t) => ({
label: t.label,
target: t,
description: t.isPreview ? "Preview target" : undefined,
isConnected: false,
}));

quickPickItems =
connectedBoards.length > 0
? [
...connectedBoards,
{ kind: QuickPickItemKind.Separator, label: "Default Boards" },
...defaultBoards,
]
: defaultBoards;
const selectedTarget = await window.showQuickPick(quickPickItems, {
placeHolder: placeHolderMsg,
});
Expand Down Expand Up @@ -171,24 +176,24 @@ export async function setIdfTarget(
} else {
await selectOpenOcdConfigFiles(
workspaceFolder.uri,
selectedTarget.target
selectedTarget.idfTarget.target
);
}

await setTargetInIDF(workspaceFolder, selectedTarget);
await setTargetInIDF(workspaceFolder, selectedTarget.idfTarget);
const customExtraVars = readParameter(
"idf.customExtraVars",
workspaceFolder
) as { [key: string]: string };
customExtraVars["IDF_TARGET"] = selectedTarget.target;
customExtraVars["IDF_TARGET"] = selectedTarget.idfTarget.target;
await writeParameter(
"idf.customExtraVars",
customExtraVars,
configurationTarget,
workspaceFolder.uri
);
await updateCurrentProfileIdfTarget(
selectedTarget.target,
selectedTarget.idfTarget.target,
workspaceFolder.uri
);
} catch (err) {
Expand Down
5 changes: 4 additions & 1 deletion src/statusBar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
Uri,
window,
l10n,
ThemeIcon,
} from "vscode";
import { getCurrentIdfSetup } from "../versionSwitcher";
import { readParameter } from "../idfConfiguration";
Expand Down Expand Up @@ -277,7 +278,9 @@ export function updateHintsStatusBarItem(hasHints: boolean) {
statusBarItems["hints"].tooltip = l10n.t(
"ESP-IDF: Hints available. Click to view."
);
statusBarItems["hints"].backgroundColor = "statusBarItem.warningBackground";
statusBarItems["hints"].backgroundColor = new ThemeIcon(
"statusBarItem.warningBackground"
);
statusBarItems["hints"].show();
} else {
statusBarItems["hints"].hide();
Expand Down