Skip to content

Commit 0853654

Browse files
committed
Support workspace trust and modification settings
VSCode v1.56+ changed how modifications made by the workspace are handled. There is a setting for enabling modificaitons from the workspace, but this is planned to be deprecated in favor of the workspace trust system. Update the readme with images and instructions for enabling both of these features. When workspace trust takes over, the workspace modification setting can be removed and the setup should still work with minimal effort. This should be a cleaner way to overwrite the Path variable for the integrated terminal without having to create a custom terminal profile. A custom terminal profile is an option, but I still would need to enable workspace trust to set it as the default. So the choice has been made to stick with the terminal.integrated.env setting for overwriting the path variable in case users want to create custom profiles, as the environment variables set here should persist across all profiles and terminal sessions.
1 parent a0c2faa commit 0853654

File tree

5 files changed

+81
-65
lines changed

5 files changed

+81
-65
lines changed

MaximLP/Inject/.vscode/settings.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
{
22
"terminal.integrated.env.windows": {
3-
"Path":"${env:Path}${config:MAXIM_PATH}\\Toolchain\\bin;${config:MAXIM_PATH}\\Toolchain\\msys\\1.0\\bin;"
3+
"Path":"${env:Path};${config:MAXIM_PATH}\\Toolchain\\bin;${config:MAXIM_PATH}\\Toolchain\\msys\\1.0\\bin;"
44
},
55

6-
"MAXIM_PATH":"C:\\Maxim",//<-- This is the root installation directory of the Maxim LP Micros Toolchain. Change this if you used a non-default installation location.
6+
"MAXIM_PATH":"C:\\Maxim",
77

8-
"target":"MAX32665",/*<-- Change to the correct target micro.
9-
Options :
10-
MAX3263x
11-
MAX32520
12-
MAX32600
13-
MAX32620
14-
MAX32625
15-
MAX32650
16-
MAX32660
17-
MAX32665-MAX32668 (Set MAX32665 if you are using of these)
18-
*/
8+
"target":"MAX32665"
199

2010
}
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
{
22
"terminal.integrated.env.windows": {
3-
"Path":"${env:Path}${config:MAXIM_PATH}\\Toolchain\\bin;${config:MAXIM_PATH}\\Toolchain\\msys\\1.0\\bin;"
3+
"Path":"${env:Path};${config:MAXIM_PATH}\\Toolchain\\bin;${config:MAXIM_PATH}\\Toolchain\\msys\\1.0\\bin;"
44
},
55

6-
"MAXIM_PATH":"C:\\Maxim",//<-- This is the root installation directory of the Maxim LP Micros Toolchain. Change this if you used a non-default installation location.
6+
"MAXIM_PATH":"C:\\Maxim",
77

8-
"target":"MAX32665",/*<-- Change to the correct target micro.
9-
Options :
10-
MAX3263x
11-
MAX32520
12-
MAX32600
13-
MAX32620
14-
MAX32625
15-
MAX32650
16-
MAX32660
17-
MAX32665-MAX32668 (Set MAX32665 if you are using of these)
18-
*/
8+
"target":"MAX32665"
199

2010
}

MaximSDK/Inject/.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"terminal.integrated.env.windows": {
3-
"Path":"${env:Path}${config:MAXIM_PATH}\\Tools\\MinGW\\msys\\1.0\\bin;${config:MAXIM_PATH}\\Tools\\OpenOCD;${config:MAXIM_PATH}\\Tools\\GNUTools\\bin;"
3+
"Path":"${env:Path};${config:MAXIM_PATH}\\Tools\\MinGW\\msys\\1.0\\bin;${config:MAXIM_PATH}\\Tools\\OpenOCD;${config:MAXIM_PATH}\\Tools\\GNUTools\\bin;"
44
},
55

66
"MAXIM_PATH":"C:\\MaximSDK", //<-- This is the root installation directory of the Maxim Micros Toolchain. Change this if you used a non-default installation location.

MaximSDK/New_Project/.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"terminal.integrated.env.windows": {
3-
"Path":"${env:Path}${config:MAXIM_PATH}\\Tools\\MinGW\\msys\\1.0\\bin;${config:MAXIM_PATH}\\Tools\\OpenOCD;${config:MAXIM_PATH}\\Tools\\GNUTools\\bin;"
3+
"Path":"${env:Path};${config:MAXIM_PATH}\\Tools\\MinGW\\msys\\1.0\\bin;${config:MAXIM_PATH}\\Tools\\OpenOCD;${config:MAXIM_PATH}\\Tools\\GNUTools\\bin;"
44
},
55

66
"MAXIM_PATH":"C:\\MaximSDK", //<-- This is the root installation directory of the Maxim Micros Toolchain. Change this if you used a non-default installation location.

readme.md

Lines changed: 73 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a [Visual Studio Code](https://code.visualstudio.com/)-based development
55

66

77
# Requirements
8-
Before getting started, ensure that you have installed all of the dependencies below :
8+
**Before getting started, ensure that you have installed all of the dependencies below** :
99
* [Visual Studio Code](https://code.visualstudio.com/)
1010
* [Maxim Micros SDK](https://www.maximintegrated.com/content/maximintegrated/en/design/software-description.html/swpart=SFW0010820A) (If you are using any of the micros below)
1111
* MAX32520
@@ -23,11 +23,43 @@ Before getting started, ensure that you have installed all of the dependencies b
2323
* MAX32650
2424
* MAX32660
2525
* MAX32665-MAX32668
26-
* [C/C++ VSCode Extension](https://github.com/microsoft/vscode-cpptools) (This can be installed from within VSCode via the extension manager. Search for ms-vscode.cpptools)
26+
* [C/C++ VSCode Extension](https://github.com/microsoft/vscode-cpptools) (This can be installed from within VSCode via the extension manager. Search for `ms-vscode.cpptools`)
2727

2828

2929
# Setup
30-
This VS Code environment can be injected into any workspace by copying the correct `.vscode` folder and `Makefile` into the root directory of the workspace. You can create a new project from scratch by injecting into an empty directory (Option 1), injecting into a project with existing source code (Option 2), or starting with one of the pre-made project frameworks (Option 3).
30+
This VS Code workspace modifies environment variables of the integrated terminal. **Before proceeding, please enable workspace trust and workspace modifications, and then restart VSCode.** Open your settings with `File > Preferences > Settings`.
31+
32+
Workspace trust can be enabled with the `security.workspace.trust` settings, as shown below.
33+
34+
<section align="center">
35+
36+
![Workspace Trust Settings Image](img\workspaceTrust.JPG)
37+
38+
</section>
39+
40+
Additionally, workspace modifications must be enabled via the `terminal.integrated.allowWorkspaceConfiguration` setting, as shown below.
41+
42+
<section align="center">
43+
44+
![Workspace Modification Setting Image](img\workspaceModification.JPG)
45+
46+
</section>
47+
48+
When opening workspaces and folders for the first time VSCode will now prompt for trust, as shown below. This can be enabled/disabled with the `security.workspace.trust.startupPrompt` settings option.
49+
50+
<section align="center">
51+
52+
![Workspace Trust Prompt Image](img\workspaceTrustPrompt.JPG)
53+
54+
</section>
55+
56+
The .JSON source files within the .vscode folders of this repo contain all of the modifications made by this workspace. Mainly, a few directories are appended to the system Path variable used by the integrated terminal to make the toolchain accessible from the command line.
57+
58+
# Project Setup
59+
Projects can be created by:
60+
* (Option 1) Injecting the workspace into an empty directory to create a new project.
61+
* (Option 2) Injecting the workspace into a directory with existing source code to integrate into an existing project.
62+
* (Option 3) Starting with a pre-made example project.
3163

3264
## Option 1 - Creating a New Project
3365
1. Download the latest correct version of this repo from the [Releases](https://github.com/MaximIntegratedTechSupport/VSCode-Maxim/releases) page for your SDK and extract it to an accessible location.
@@ -46,17 +78,13 @@ This VS Code environment can be injected into any workspace by copying the corre
4678

4779
6. Browse to the root directory of the workspace folder created in step 2.
4880

49-
7. Launch a new terminal with `Terminal > New Terminal`.
50-
51-
8. VS Code will prompt 'Do you allow this workspace to modify your terminal shell?' Click `Allow` and restart VS Code.
52-
53-
9. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
81+
7. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
5482

55-
10. Set the `"target"` variable to the correct microcontroller you are using.
83+
8. Set the `"target"` variable to the correct microcontroller you are using. See [Changing the Target Microcontroller](#Changing-the-Target-Microcontroller) for value strings.
5684

57-
11. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
85+
9. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
5886

59-
12. That's it! See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Makefile Configuration](#Makefile-Configuration) for details on adding source code to the project.
87+
10. That's it! See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Build System Configuration](#Build-System-Configuration) for deeper configuration options such as adding source files, configuring intellisense paths, etc.
6088

6189
## Option 2 - Injecting into an Existing Project
6290
1. Download the latest correct version of this repo from the [Releases](https://github.com/MaximIntegratedTechSupport/VSCode-Maxim/releases) page for your SDK and extract it to an accessible location.
@@ -82,19 +110,15 @@ This VS Code environment can be injected into any workspace by copying the corre
82110

83111
6. Browse to the root directory of the workspace folder located in step 2.
84112

85-
7. Launch a new terminal with `Terminal > New Terminal`.
113+
7. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
86114

87-
8. VS Code will prompt 'Do you allow this workspace to modify your terminal shell?' Click `Allow` and restart VS Code.
115+
8. Set the `"target"` variable to the correct microcontroller you are using. See [Changing the Target Microcontroller](#Changing-the-Target-Microcontroller) for value strings.
88116

89-
9. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
117+
9. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
90118

91-
10. Set the `"target"` variable to the correct microcontroller you are using.
119+
10. The VS Code environment is now injected, but you will need to do some additional configuration of the Makefile to add in your existing source code to the build process. See [Adding Source Files](#Adding-Source-Files) for more details on this.
92120

93-
11. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
94-
95-
12. The VS Code environment is now injected, but you will need to do some additional configuration of the Makefile to add in your existing source code to the build process. See [Adding Source Files](#Adding-Source-Files) for more details on this.
96-
97-
13. See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Makefile Configuration](#Makefile-Configuration) for additional configuration options.
121+
11. See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Build System Configuration](#Build-System-Configuration) for deeper configuration options such as adding source files, configuring intellisense paths, etc.
98122

99123
## Option 3 - Starting with a Pre-Made Project
100124
1. Download the latest correct version of this repo from the [Releases](https://github.com/MaximIntegratedTechSupport/VSCode-Maxim/releases) page for your SDK and extract it to an accessible location.
@@ -107,22 +131,18 @@ This VS Code environment can be injected into any workspace by copying the corre
107131

108132
5. Browse to the root directory of the extracted framework project from step 2.
109133

110-
6. Launch a new terminal with `Terminal > New Terminal`.
111-
112-
7. VS Code will prompt 'Do you allow this workspace to modify your terminal shell?' Click `Allow` and restart VS Code.
134+
6. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
113135

114-
8. From within VS Code, open the `settings.json` file located in the `.vscode` folder.
136+
7. Set the `"target"` variable to the correct microcontroller you are using. See [Changing the Target Microcontroller](#Changing-the-Target-Microcontroller) for value strings.
115137

116-
9. Set the `"target"` variable to the correct microcontroller you are using.
138+
8. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
117139

118-
10. (Optional) Set the `MAXIM_PATH` variable to to the root directory of your toolchain installation. This is only necessary if you used a non-default installation location.
119-
120-
11. That's it! See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Project Configuration](#Project-Configuration) for details on configuring the project.
140+
9. That's it! See [Testing the Setup](#Testing-the-Setup) below to verify everything is working properly, [Usage](#Usage) for using the VS Code environment, and [Build System Configuration](#Build-System-Configuration) for deeper configuration options such as adding source files, configuring intellisense paths, etc.
121141

122142
## Testing the Setup
123143
After injecting with Option 1 or Option 2, your toolchain should be accessible from the terminal. To test that everything is working properly :
124144

125-
* Navigate to the open `TERMINAL` tab on the bottom of the VS Code application. If a terminal is not open, you can open a new terminal with `Terminal > New Terminal` or (Ctrl+Shift+`). You should be able to run the following commands to retrieve version numbers successfully from within the terminal :
145+
* Navigate to the open `TERMINAL` tab on the bottom of the VS Code application. If a terminal is not open, you can open a new terminal with `Terminal > New Terminal` or (Ctrl+Shift+`). The following commands to retrieve version numbers should be able to be run successfully from within the terminal :
126146

127147
* `make -v`
128148
* `openocd -v`
@@ -159,7 +179,7 @@ The Debugger can be launched with `Run > Start Debugging`, with the shortcut `F5
159179
* When a debugging session is launched, the Build task will be launched automatically. A successful build must be completed before debugging.
160180

161181

162-
# Project Configuration
182+
# Build System Configuration
163183

164184
## Configuring the Makefile
165185
The Makefile is the core file for the build system. All configuration tasks such as adding source files to the build, setting compiler flags, and linking libraries are handled via the Makefile. The [GNU Make Manual](https://www.gnu.org/software/make/manual/html_node/index.html) is a good one to have on hand.
@@ -181,22 +201,38 @@ The Makefile is the core file for the build system. All configuration tasks suc
181201
### Optimization Level
182202
* The optimization level that the compiler uses can be set by changing the `MXC_OPTIMIZE_CFLAGS` variable. See [GCC Optimization Options](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html) for more details on available optimization levels. For example, disable optimization with `MXC_OPTIMIZE_CFLAGS = -O0`
183203

184-
## VS Code Settings
185-
### Setting Include Paths for Intellisense
204+
## Setting Include Paths for Intellisense
186205
VS Code's intellisense engine must be told where to find the header files for your source code. By default, include paths have been added for Maxim's perpiheral drivers, and all of the sub-directories of the workspace will be searched for header files. If VS Code throws an error on an `#include` statement (and the file exists), then an include path is most likely missing.
187206

188207
To add additional include paths :
189208
1. Open the `\.vscode\c_cpp_properties.json` file.
190209

191210
2. Add the include path(s) to the `configurations > includePath` list.
192211

193-
### Changing the Target Microcontroller
212+
## Changing the Target Microcontroller
194213
1. Open the `\.vscode\settings.json` file.
195214

196215
2. Change the `"target"` variable to the correct value for your microcontroller.
197-
198-
## Known Issues
199-
### 'An Exception Occurred' on Main
216+
Options for the LP Micros SDK are:
217+
* "MAX3263x"
218+
* "MAX32520"
219+
* "MAX32600"
220+
* "MAX32620"
221+
* "MAX32625"
222+
* "MAX32650"
223+
* "MAX32660"
224+
* "MAX32665" (for MAX32665-MAX32668)
225+
226+
and options for the Maxim Micros SDK are:
227+
* "MAX32520"
228+
* "MAX32570"
229+
* "MAX32655"
230+
* "MAX32670"
231+
* "MAX32675"
232+
* "MAX78000"
233+
234+
# Known Issues
235+
## 'An Exception Occurred' on Main
200236
There is a known issue when debugging where a false exception is thrown on main when the debugger is started. A temporary workaround can be used to get rid of this false exception message - set a breakpoint on main.
201237

202-
This issue does not affect the functionality of the environment.
238+
This issue does not affect the functionality of the debugger.

0 commit comments

Comments
 (0)