diff --git a/src/PlatformInformation.ts b/src/PlatformInformation.ts index 28fe7d4d5..6862c7e61 100644 --- a/src/PlatformInformation.ts +++ b/src/PlatformInformation.ts @@ -64,6 +64,17 @@ export class PlatformInformation { } } + public get fallbackPlatform(): string { + switch (this.platform) { + case "darwin": + return "macos"; + case "win32": + return this.architecture === "x86" ? "win32" : "win64"; + default: + return "linux-amd64"; + } + } + public static GetUnknownArchitecture(): string { return "Unknown"; } diff --git a/src/idfToolsManager.ts b/src/idfToolsManager.ts index ae0d1a71c..98e33c40a 100644 --- a/src/idfToolsManager.ts +++ b/src/idfToolsManager.ts @@ -81,6 +81,9 @@ export class IdfToolsManager { return ( platOverride.platforms.indexOf( this.platformInfo.platformToUse + ) !== -1 || + platOverride.platforms.indexOf( + this.platformInfo.fallbackPlatform ) !== -1 ); } @@ -140,6 +143,9 @@ export class IdfToolsManager { (Object.getOwnPropertyNames(value).indexOf( this.platformInfo.platformToUse ) > -1 || + Object.getOwnPropertyNames(value).indexOf( + this.platformInfo.fallbackPlatform + ) > -1 || Object.getOwnPropertyNames(value).indexOf("any") > -1) ); }); @@ -151,7 +157,11 @@ export class IdfToolsManager { const linkInfo = Object.getOwnPropertyNames(versions[0]).indexOf("any") > -1 ? (versions[0]["any"] as IFileInfo) - : (versions[0][this.platformInfo.platformToUse] as IFileInfo); + : Object.getOwnPropertyNames(versions[0]).indexOf( + this.platformInfo.platformToUse + ) > -1 + ? (versions[0][this.platformInfo.platformToUse] as IFileInfo) + : (versions[0][this.platformInfo.fallbackPlatform] as IFileInfo); return linkInfo; } @@ -171,6 +181,9 @@ export class IdfToolsManager { (Object.getOwnPropertyNames(value).indexOf( this.platformInfo.platformToUse ) > -1 || + Object.getOwnPropertyNames(value).indexOf( + this.platformInfo.fallbackPlatform + ) > -1 || Object.getOwnPropertyNames(value).indexOf("any") > -1) ); }); @@ -314,6 +327,9 @@ export class IdfToolsManager { return ( Object.getOwnPropertyNames(version).indexOf( this.platformInfo.platformToUse + ) > -1 || + Object.getOwnPropertyNames(version).indexOf( + this.platformInfo.fallbackPlatform ) > -1 ); }); diff --git a/src/test/suite/idfToolsManager.test.ts b/src/test/suite/idfToolsManager.test.ts index f9c5eeb27..19fba3234 100644 --- a/src/test/suite/idfToolsManager.test.ts +++ b/src/test/suite/idfToolsManager.test.ts @@ -81,6 +81,7 @@ suite("IDF Tools Manager Tests", async () => { architecture: "x86_64", platform: "darwin", platformToUse: "macos", + fallbackPlatform: "macos", }; const output = OutputChannel.init(); const idfToolsManager = new IdfToolsManager( diff --git a/src/utils.ts b/src/utils.ts index b2b77dac7..afc067bc9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -250,17 +250,16 @@ export async function setCCppPropertiesJsonCompilerPath( export function getToolchainToolName(idfTarget: string, tool: string = "gcc") { switch (idfTarget) { - case "esp32c2": - case "esp32c3": - case "esp32c6": - case "esp32h2": - return `riscv32-esp-elf-${tool}`; case "esp32": case "esp32s2": case "esp32s3": return `xtensa-${idfTarget}-elf-${tool}`; + case "esp32c2": + case "esp32c3": + case "esp32c6": + case "esp32h2": default: - return undefined; + return `riscv32-esp-elf-${tool}`; } } @@ -321,10 +320,18 @@ export function getVariableFromCMakeLists(workspacePath: string, key: string) { } export function getSDKConfigFilePath(workspacePath: vscode.Uri) { - let sdkconfigFilePath = getVariableFromCMakeLists( - workspacePath.fsPath, - "SDKCONFIG" - ); + let sdkconfigFilePath = ""; + try { + sdkconfigFilePath = getVariableFromCMakeLists( + workspacePath.fsPath, + "SDKCONFIG" + ); + } catch (error) { + const errMsg = error.message + ? error.message + : `CMakeLists.txt file doesn't exists or can't be read`; + Logger.info(errMsg, error); + } if ( sdkconfigFilePath && sdkconfigFilePath.indexOf("${CMAKE_BINARY_DIR}") !== -1 diff --git a/templates/.vscode/c_cpp_properties.json b/templates/.vscode/c_cpp_properties.json index f2a83b718..352b16776 100644 --- a/templates/.vscode/c_cpp_properties.json +++ b/templates/.vscode/c_cpp_properties.json @@ -3,8 +3,6 @@ { "name": "ESP-IDF", "compilerPath": "${default}", - "cStandard": "c11", - "cppStandard": "c++17", "includePath": [ "${config:idf.espIdfPath}/components/**", "${config:idf.espIdfPathWin}/components/**", diff --git a/testFiles/testWorkspace/.vscode/c_cpp_properties.json b/testFiles/testWorkspace/.vscode/c_cpp_properties.json index f2a83b718..352b16776 100644 --- a/testFiles/testWorkspace/.vscode/c_cpp_properties.json +++ b/testFiles/testWorkspace/.vscode/c_cpp_properties.json @@ -3,8 +3,6 @@ { "name": "ESP-IDF", "compilerPath": "${default}", - "cStandard": "c11", - "cppStandard": "c++17", "includePath": [ "${config:idf.espIdfPath}/components/**", "${config:idf.espIdfPathWin}/components/**",