Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit 2d14d00

Browse files
committed
add west extension that generates build and debug configurations for vscode
1 parent 9d39f27 commit 2d14d00

6 files changed

Lines changed: 274 additions & 149 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ __pycache__/
1414

1515
# docs
1616
/doc/_build*
17+
18+
.vscode/tasks.json
19+
.vscode/launch.json
20+
.vscode/c_cpp_properties.json

.vscode/tasks.json

Lines changed: 0 additions & 131 deletions
This file was deleted.

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,32 @@ command:
1313
west init -m https://github.com/IntergatedCircuits/c2usb-zephyr-examples c2usb-workspace
1414
# update Zephyr modules
1515
cd c2usb-workspace
16-
west update
17-
west patch
16+
west update && west patch
1817
```
1918

19+
## Building and running
20+
21+
To build an application, run the following command:
22+
```shell
23+
cd c2usb-zephyr-examples
24+
west build -b nrf52840dk/nrf52840 --build-dir usb-keyboard/build usb-keyboard
25+
```
26+
27+
Once you have built the application, run the following command to flash it:
28+
29+
```shell
30+
west flash --build-dir usb-keyboard/build
31+
```
32+
33+
## Software Development
34+
35+
MS Visual Studio Code is the recommended IDE for development.
36+
Open the `projects.code-workspace` file in vscode, and install the recommended extensions
37+
(better create a dedicated zephyr profile).
38+
Use `west vscode --build-dir usb-keyboard/build` to generate vscode C/C++ indexer configuration.
39+
`--build` and `--debug` additional arguments create build tasks and debug launch configurations,
40+
from a successful build.
41+
2042
## Application Index
2143

2244
### ble-keyboard
@@ -41,18 +63,3 @@ depending on the state of button 4. Button 3 controls the left mouse button.
4163
### usb-shell
4264

4365
Demonstrating USB serial port functionality with shell access to the zephyr OS.
44-
45-
## Building and running
46-
47-
To build an application, run the following command:
48-
49-
```shell
50-
cd c2usb-zephyr-examples
51-
west build -b nrf52840dk/nrf52840 usb-keyboard
52-
```
53-
54-
Once you have built the application, run the following command to flash it:
55-
56-
```shell
57-
west flash
58-
```

projects.code-workspace

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@
5353
},
5454
"extensions": {
5555
"recommendations": [
56-
"nordic-semiconductor.nrf-connect-extension-pack"
56+
"nordic-semiconductor.nrf-connect-extension-pack",
57+
"marus25.cortex-debug",
58+
"mcu-debug.peripheral-viewer",
59+
"ms-vscode.vscode-embedded-tools",
60+
"ms-vscode.vscode-serial-monitor",
61+
"thecreativedodo.usbip-connect"
5762
]
5863
}
5964
}

scripts/west-commands.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ west-commands:
44
- name: patch
55
class: WestPatch
66
help: Manage patching across zephyr ecosystem repositories
7+
- file: scripts/west_vscode.py
8+
commands:
9+
- name: vscode
10+
class: WestVsCode
11+
help: Generate VS Code configuration files for Zephyr projects

0 commit comments

Comments
 (0)