f"set(sdkVersion {params['sdkVersion']})\n"
f"set(toolchainVersion {params['toolchainVersion']})\n"
f"set(picotoolVersion {params['picotoolVersion']})\n"
- f"include({cmakeIncPath()})\n"
+ f"set(picoVscode {cmakeIncPath()})\n"
+ "if (EXISTS ${picoVscode})\n"
+ " include(${picoVscode})\n"
+ "endif()\n"
"# ====================================================================================\n"
)
"gdbTarget": "localhost:3333",
"gdbPath": "${{command:raspberry-pi-pico.getGDBPath}}",
"device": "${{command:raspberry-pi-pico.getChipUppercase}}",
- "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd"
+ "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd",
"runToEntryPoint": "main",
// Give restart the same functionality as runToEntryPoint - main
"postRestartCommands": [
import { homedir } from "os";
import which from "which";
import { compareLtMajor } from "./semverUtil.mjs";
- import { picotoolVersion } from "../webview/newProjectPanel.mjs";
- import { CMAKE_DO_NOT_EDIT_HEADER_PREFIX } from "../extension.mjs";
import { buildCMakeIncPath } from "./download.mjs";
+ export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX =
+ // eslint-disable-next-line max-len
+ "== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==";
+
export async function getPythonPath(): Promise<string> {
const settings = Settings.getInstance();
if (settings === undefined) {
folder: Uri,
newSDKVersion: string,
newToolchainVersion: string,
+ newPicotoolVersion: string,
reconfigure: boolean = true
): Promise<boolean> {
// TODO: support for scaning for seperate locations of the CMakeLists.txt file in the project
"endif()\n" +
`set(sdkVersion ${newSDKVersion})\n` +
`set(toolchainVersion ${newToolchainVersion})\n` +
- `set(picotoolVersion ${picotoolVersion})\n` +
+ `set(picotoolVersion ${newPicotoolVersion})\n` +
- `include(${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` +
+ `set(picoVscode ${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` +
+ "if (EXISTS ${picoVscode})\n" +
+ " include(${picoVscode})\n" +
+ "endif()\n" +
// eslint-disable-next-line max-len
"# ===================================================================================="
);
* Extracts the sdk and toolchain versions from the CMakeLists.txt file.
*
* @param cmakeFilePath The path to the CMakeLists.txt file.
- * @returns An tupple with the [sdk, toolchain] versions or null if the file could not
+ * @returns An tupple with the [sdk, toolchain, picotool] versions or null if the file could not
* be read or the versions could not be extracted.
*/
export async function cmakeGetSelectedToolchainAndSDKVersions(
}
Logger.log("Updating extension lines in CMake file");
- await cmakeUpdateSDK(folder, versionMatch[1], versionMatch2[1]);
+ await cmakeUpdateSDK(
+ folder, versionMatch[1], versionMatch2[1], versionMatch[1]
+ );
Logger.log("Extension lines updated");
- return [versionMatch[1], versionMatch2[1], picotoolVersion];
+ return [versionMatch[1], versionMatch2[1], versionMatch[1]];
} else {
return null;
}