@@ -6,7 +6,6 @@ import Logger, { LoggerSource } from "../../logger.mjs";
6
6
import { unknownErrorToString } from "../errorHelper.mjs" ;
7
7
import { extensionName } from "../../commands/command.mjs" ;
8
8
import { commands , Uri , window , workspace } from "vscode" ;
9
- import { CURRENT_WGET_VERSION } from "../sharedConstants.mjs" ;
10
9
import type { VersionBundle } from "../versionBundles.mjs" ;
11
10
import { HOME_VAR } from "../../settings.mjs" ;
12
11
import { TextEncoder } from "util" ;
@@ -34,6 +33,7 @@ import {
34
33
GET_WEST_PATH ,
35
34
GET_ZEPHYR_WORKSPACE_PATH ,
36
35
} from "../../commands/cmdIds.mjs" ;
36
+ import { getZephyrSDKVersion , getZephyrVersion } from "../setupZephyr.mjs" ;
37
37
38
38
// Kconfig snippets
39
39
const shellWifiKconfig : string = `CONFIG_WIFI_LOG_LEVEL_ERR=y
@@ -96,28 +96,49 @@ async function generateVSCodeConfig(
96
96
return false ;
97
97
}
98
98
99
+ const zephyrVersion = await getZephyrVersion ( ) ;
100
+ if ( zephyrVersion === undefined ) {
101
+ Logger . error ( LoggerSource . projectZephyr , "Failed to get Zephyr version" ) ;
102
+ void window . showErrorMessage (
103
+ "Failed to detect the currently installed Zephyr version. Please delete `~/.pico-sdk/zephyr_workspace` and try again."
104
+ ) ;
105
+
106
+ return false ;
107
+ }
108
+
109
+ const zephyrSdkVersion = await getZephyrSDKVersion ( zephyrVersion ) ;
110
+ if ( zephyrSdkVersion === undefined ) {
111
+ Logger . error (
112
+ LoggerSource . projectZephyr ,
113
+ "Failed to get Zephyr SDK version"
114
+ ) ;
115
+ void window . showErrorMessage (
116
+ "Failed to detect the currently installed Zephyr SDK version. Please delete `~/.pico-sdk/zephyr_workspace` and try again."
117
+ ) ;
118
+
119
+ return false ;
120
+ }
121
+
99
122
const cppProperties = {
100
123
version : 4 ,
101
124
configurations : [
102
125
{
103
126
name : "Zephyr" ,
104
127
intelliSenseMode : "linux-gcc-arm" ,
105
- compilerPath :
106
- // TODO: maybe move into command (the part before the executable) / test if not .exe works on win32
107
- "${userHome}/.pico-sdk/zephyr_workspace/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc" ,
128
+ compilerPath : `\${userHome}/.pico-sdk/zephyr_workspace/zephyr-sdk-${ zephyrSdkVersion } /arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc` ,
108
129
includePath : [
109
130
"${workspaceFolder}/**" ,
110
131
"${workspaceFolder}/build/zephyr/include" ,
111
- " ${userHome}/.pico-sdk/zephyr_workspace/zephyr/include" ,
112
- " ${userHome}/.pico-sdk/zephyr_workspace/zephyr/modules/cmsis_6" ,
113
- " ${userHome}/.pico-sdk/zephyr_workspace/zephyr/modules/hal_infineon" ,
114
- " ${userHome}/.pico-sdk/zephyr_workspace/zephyr/modules/hal_rpi_pico" ,
132
+ `\ ${userHome}/.pico-sdk/zephyr_workspace/zephyr- ${ zephyrVersion } /include` ,
133
+ `\ ${userHome}/.pico-sdk/zephyr_workspace/zephyr- ${ zephyrVersion } /modules/cmsis_6` ,
134
+ `\ ${userHome}/.pico-sdk/zephyr_workspace/zephyr- ${ zephyrVersion } /modules/hal_infineon` ,
135
+ `\ ${userHome}/.pico-sdk/zephyr_workspace/zephyr- ${ zephyrVersion } /modules/hal_rpi_pico` ,
115
136
] ,
116
137
compileCommands : "${workspaceFolder}/build/compile_commands.json" ,
117
138
cppStandard : "gnu++20" ,
118
139
cStandard : "gnu17" ,
119
140
forcedInclude : [
120
- " ${userHome}/.pico-sdk/zephyr_workspace/zephyr/include/zephyr/devicetree.h" ,
141
+ `\ ${userHome}/.pico-sdk/zephyr_workspace/zephyr- ${ zephyrVersion } /include/zephyr/devicetree.h` ,
121
142
"${workspaceFolder}/build/zephyr/include/generated/zephyr/autoconf.h" ,
122
143
"${workspaceFolder}/build/zephyr/include/generated/zephyr/version.h" ,
123
144
] ,
@@ -183,7 +204,7 @@ async function generateVSCodeConfig(
183
204
"terminal.integrated.env.windows" : {
184
205
// remove gperf and dtc for now
185
206
// \${env:USERPROFILE}/.pico-sdk/dtc/${CURRENT_DTC_VERSION}/bin;\${env:USERPROFILE}/.pico-sdk/gperf/${CURRENT_GPERF_VERSION}
186
- Path : `\${env:USERPROFILE}/.pico-sdk/wget/ ${ CURRENT_WGET_VERSION } ;\${env:USERPROFILE}/.pico-sdk/ 7zip;\${env:Path};` ,
207
+ Path : `\${env:USERPROFILE}/.pico-sdk/7zip;\${env:Path};` ,
187
208
} ,
188
209
"terminal.integrated.env.osx" : {
189
210
PATH : "${env:PATH}:" ,
0 commit comments