Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 63 additions & 57 deletions docs/Workbench_for_Zephyr.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
2. [Software Setup](#step2)
3. [Getting Started with Workbench for Zephyr](#step3)
4. [Zephyr Environment Setup](#step4)
5. [Importing Existing Application](#step5)
6. [Building the Application](#step6)
7. [Installing OpenOCD for Programming](#step7)
8. [Flashing the Application](#step8)
5. [Install Device Libraries](#step5)
6. [Install OpenOCD for Programming](#step6)
7. [Import Existing Application](#step7)
8. [Build the Application](#step8)
9. [Flash the Application](#step9)


## 1. Introduction<a name="step1">
Expand All @@ -30,7 +31,7 @@ This guide will walk you through the essential steps to get started with Zephyr,

### Install Extension: Workbench for Zephyr

**Step 1** - After installing [Visual Studio Code](https://code.visualstudio.com/) search for "Workbench for Zephyr" in extension and install it as shown below.
**Step 1** - After installing [Visual Studio Code](https://code.visualstudio.com/) search for "Workbench for Zephyr" in extension, click on dropdown of install and select "Install Pre-Release Version" as shown below.

![](Workbench_images/extension.png)

Expand Down Expand Up @@ -73,13 +74,12 @@ This guide will walk you through the essential steps to get started with Zephyr,

**Step 2** - Refer the below images for configuring in the Create west workspace window.

- Select "Repository" for source location and copy paste the path as shown below.
- Select "Repository" for source location and copy paste the below path.

```
https://github.com/Zephyr4Microchip/zephyr.git

```
![](Workbench_images/west_workspaces_config.png)

- Refresh and choose the revision as
```
Expand All @@ -91,11 +91,15 @@ This guide will walk you through the essential steps to get started with Zephyr,
c:\developers\zephyrproject_wsg
```

![](Workbench_images/west_workspaces_config_2.png)
- Expand the "Advanced options" and uncheck "Fetch west blobs".

- Remove the "zephyrproject" in Subfolder and verify the below screen capture before hitting Import.

![](Workbench_images/west_workspaces_config.png)

- Then click on Import.

- Once the installation completes the terminal prints the below status.
- Once the installation completes, workspace will be available in "WEST WORKSPACES" as below.

![](Workbench_images/west_workspaces_installed.png)

Expand All @@ -121,93 +125,95 @@ This guide will walk you through the essential steps to get started with Zephyr,

- Then click on Import.

## 5. Importing Existing Application<a name="step5">

**Step 1** - Go to APPLICATIONS Tab and click on "Import Existing Application"

![](Workbench_images/import_application.png)
**Step 2** - Verify that the Toolchain is installed properly if its listed in TOOLCHAINS as shown below.

**Step 2** - Click on Folder icon & Choose the Sample Project as Shown below.
![](Workbench_images/toolchain_installed.png)

![](Workbench_images/import_application_1.png)
## 5. Install Device Libraries<a name="step5">

**Step 3** - Select the west workspace
**Step 1** - Right click the workspace (zephyrproject_wsg) in WEST WORKSPACES as shown below.

![](Workbench_images/import_application_2.png)
![](Workbench_images/west_blobs.png)

**Step 4** - Select the toolchain (SDK Latest version : 0.17.4)
**Step 2** - A new Terminal window would open and enter the below command to download the Device Libraries.
~~~
west blobs fetch hal_microchip

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command west blobs fetch hal_microchip is not being rendered as a code snippet in the Markdown output. Instead, it appears as ~~~west blobs fetch hal_microchip~~~. Please format it as inline code (or a code block) so users can easily copy it to the clipboard.

~~~

![](Workbench_images/import_application_3.png)
![](Workbench_images/west_blobs1.png)

**Step 5** - Select the target board
## 6. Installing OpenOCD for Programming<a name="step6">

![](Workbench_images/import_application_4.png)
### Install Custom OpenOCD support

**Step 5** - The Project will be added to the APPLICATIONS tab as shown below.
| ✅ Note : As support for these devices has not yet been merged into the OpenOCD mainline, the following step is currently required|
| :-|

![](Workbench_images/import_application_5.png)
- Download the python scripts "installOpenOCD_WSG_BZx.py" and "switchFirmware.py" from the [Workbench_images](Workbench_images/) folder to the below mentioned folder.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of keeping the Python scripts in the Workbench_images folder (which primarily contains .png image files), would it be possible to create a separate folder, for example openocd_python_scripts, either at the same level or within the documentation directory? This would keep the images and scripts organized separately. Additionally, please add direct links to these Python scripts in the documentation so users can download them easily.


```
c:\developers\zephyrproject_wsg

## 6. Building the Application<a name="step6">
```
- Click Terminal and select "New Terminal" as shown below.

- Click on Build icon as shown in the below image and then your application will be build successfully.
![](Workbench_images/install_openocd.png)

![](Workbench_images/Build.png)
- Run the install script to set up OpenOCD and its dependencies as shown below.

- Before building any Wireless Applications, download the required libraries using below steps.
```
python installOpenOCD_WSG_BZx.py
```

- **Step 1** - Right click the workspace (zephyrproject_wsg) in WEST WORKSPACES as shown below.
![](Workbench_images/installOpenOCD_WSG_BZx.png)

![](Workbench_images/west_blobs.png)
### Switching Programmer between Zephyr and MPLABx

- **Step 2** - A new Terminal window would open. Enter the below command as shown.
~~~
west blobs fetch hal_microchip
~~~
| ⚠ **Warning** |
| :- |
| - Connect your target board to your PC before running the below script.<br>- Zephyr uses **CMSIS mode**, while **MPLAB X IPE** uses **PKOB mode** of the programmer/debugger.<br>- Default configuration of fresh board is PKOB mode to support MPLABx |

@DineshArasu-Microchip DineshArasu-Microchip Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add one more warning

Warning: Ensure that only one target board is connected to your system when switching to CMSIS firmware. Connecting multiple target boards may result in the wrong device being selected.


![](Workbench_images/west_blobs1.png)
To switch programmer at any time after the initial setup, run the standalone switcher script.

```
python switchFirmware.py
```

## 7. Installing OpenOCD for Programming<a name="step7">
- Choose **1** (or **zephyr**) to switch to OpenOCD CMSIS-DAP programmer (for Zephyr development).
- Choose **2** (or **mplab**) to switch back to the default MPLAB PKOB4 programmer.

| ⚠ Warning : Connect your target board to your PC before running the script|
| ⚠ Warning : Always switch back to MPLAB PKOB4 (option 2) before using the board with MPLABX IDE/IPE.|
| :-|

- Copy & paste the python script "installOpenOCD_WSG_BZx.py" in the [Workbench_images](Workbench_images/installOpenOCD_WSG_BZx.py) folder to the below mentioned folder.
- Type **1** (or **zephyr**) to switch to CMSIS-DAP mode as shown below.

```
c:\developers\zephyrproject_wsg
![](Workbench_images/switchFirmware.png)

```
- Run the Python script as shown below.
## 7. Import Existing Application<a name="step7">

- After running the script
- Choose 1 for changing the Default MPLAB PKOB4 to OpenOCD CMSIS-DAP.
- Choose 2 for changing the OpenOCD CMSIS-DAP to Default MPLAB PKOB4.
**Step 1** - Go to APPLICATIONS Tab and click on "Add Application" as shown below.

| ⚠ Warning : **Important Note: Select 2 and switch the firmware back to PKOB4 before using with MPLABX IDE/IPE. This selection decides whether the board works for OpenOCD or MPLABx.|
| :-|
![](Workbench_images/add_application.png)

![](Workbench_images/installOpenOCD_WSG_BZx_1.png)
**Step 2** - Select the West Workspace, Toolchain, Board, Import exisiting application, Project Location as shown below and click on Create.

![](Workbench_images/installOpenOCD_WSG_BZx_2.png)
![](Workbench_images/add_application1.png)

![](Workbench_images/installOpenOCD_WSG_BZx_3.png)
## 8. Build the Application<a name="step8">

- Finally the python script will successfully switch to OpenOCD CMSIS-DAP firmware.
- Click on Build icon as shown in the below image and then your application will be built successfully.

## 8. Flashing the Application<a name="step8">
![](Workbench_images/build_app.png)

| ⚠ Warning : For PIC32CXBZ6 copy and paste (overwrite) the python script "gen_signed_hex.py" in the [Workbench_images](Workbench_images/gen_signed_hex.py) folder to "C:\developers\zephyrproject_wsg\zephyr\soc\microchip\pic32c\pic32cx_bz\bz6x\gen_signed_hex.py" folder.|
| :-|
## 9. Flash the Application<a name="step9">

- Click on Run icon as shown in the below image and then choose the "--runner openocd" for flashing the project.
- Click on Flash icon as shown in the below image and then choose the "openocd" for flashing the project.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning: Ensure that only one target board is connected to your system during Flashing. Connecting multiple target boards may result in the wrong device being selected.


![](Workbench_images/Flashing.png)
![](Workbench_images/flash_app.png)

- After Successful Flashing your terminal log look as below.

![](Workbench_images/Flashing_completed.png)
![](Workbench_images/flash_app_completed.png)

- Now you can see the application running in the target board.

Expand Down
Binary file removed docs/Workbench_images/Build.png
Binary file not shown.
Binary file removed docs/Workbench_images/Flashing.png
Binary file not shown.
Binary file added docs/Workbench_images/add_application.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Workbench_images/add_application1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Workbench_images/build_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Workbench_images/extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Workbench_images/extension_completed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Workbench_images/flash_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 0 additions & 78 deletions docs/Workbench_images/gen_signed_hex.py

This file was deleted.

Binary file modified docs/Workbench_images/host_tool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Workbench_images/host_tool_installed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Workbench_images/host_tool_status.png

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the host tools are not up to date, or if you reinstall Work Bench for Zephyr and notice that the host tools haven't been updated, click Reinstall host tools again to update them to the latest version.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/Workbench_images/import_application.png
Binary file not shown.
Binary file removed docs/Workbench_images/import_application_1.png
Binary file not shown.
Binary file removed docs/Workbench_images/import_application_2.png
Binary file not shown.
Binary file removed docs/Workbench_images/import_application_3.png
Binary file not shown.
Binary file removed docs/Workbench_images/import_application_4.png
Binary file not shown.
Binary file removed docs/Workbench_images/import_application_5.png
Binary file not shown.
Binary file added docs/Workbench_images/installOpenOCD_WSG_BZx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading