The Zephyr project includes a tool called west, which is used to manage the combination of multiple Git repositories and versions that make up the nRF Connect SDK. The extension provides a graphical front end to west.
Initializing a west workspace¶
A new west workspace is created by using
west init. To use the command from the extension:
- Go to the Command Palette and type
nRF Connect: West Init.
- Browse to the folder where you want to initialize a west workspace.
zephyr, or a custom repository.
- Choose which version tag you want to work with.
West begins to initialize the workspace in the terminal output.
Updating a west workspace¶
west update command makes sure your west workspace state matches the state of the west manifest file. Whenever you check out a different revision in your manifest repository, you should run
west update to make sure your workspace contains the project repositories that the new revision expects.
To update a west workspace:
- Open the Command Palette and type
nRF Connect: West Update
- Choose the location of your project repository and west begins to update.
Source control for west modules¶
The extension provides a view of your west workspace and modules in VS Code's Source Control View including:
- The path to the current west manifest.
- The tag or description of the state of the repository that holds the manifest.
- A list of all the west modules grouped into:
- Changed: modules that are out of sync with the west manifest or have local file changes.
- Clean: modules that are neither out of sync nor have local changes.
- Not Cloned: modules that have not been cloned and therefore do not exist in the file system. These normally correspond to excluded filter groups in the west manifest.
- An alert symbol if the workspace is out of sync with the manifest. Clicking on the symbol runs
The extension monitors the state of any modules that are inside the VS Code workspace and updates their status when changes are made.
To trigger a status update:
- Click the refresh button on the west source control line
- Alternatively, open the Command Palette and type
nRF Connect: West Refresh.
Changing the current west manifest¶
Click on the manifest path icon located towards the top of the Source Control View. You can also open the Command Palette and type
nRF Connect: West Set Active Manifest.
Choose between either the nRF or Zephyr manifest. This option is useful for those who use upstream Zephyr and need to frequently switch between the two manifests or different versions.
Controlling the west environment¶
On macOS and Linux, the official documentation for the nRF Connect SDK suggests that you add your environment variables, such as
~/.bashrc. Unfortunately, VS Code does not pick up environment variables added to this file, even when launching VS Code from a terminal.
To get around this issue, the extension queries Bash for its environment on Linux and macOS. This executes the
~/.bashrc file, as well as any other files that run when starting Bash. If any of these files execute behavior that you do not want, either check for
$NRF_CONNECT_VSCODE in your Bash scripts, or change the
VS Code picks up environment variables set in
.profile. To disable this option while still being compatible with the terminal, move the nRF Connect SDK-specific environment variables (such as