Skip to content

Commit 3a51a7c

Browse files
committed
boards: microchip: pic32cm_jh01_cpro: Add PyOCD runner support
Add PyOCD runner support to enable flashing and programming the pic32cm_jh01_cpro board using the PyOCD tool. Signed-off-by: Arunprasath P <[email protected]>
1 parent c8d9103 commit 3a51a7c

File tree

2 files changed

+62
-10
lines changed

2 files changed

+62
-10
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Copyright (c) 2025 Microchip Technology Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
board_runner_args(pyocd "--target=pic32cm5164jh01100" "--frequency=4000")
45
board_runner_args(jlink "--device=PIC32CM5164JH" "--speed=4000")
56

7+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
68
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/microchip/pic32c/pic32cm_jh01_cpro/doc/index.rst

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,60 @@ Programming & Debugging
4242

4343
.. zephyr:board-supported-runners::
4444
45-
Flash Using J-Link
46-
==================
45+
Setting Up the Debug Interface
46+
==============================
47+
48+
PyOCD Setup
49+
===========
50+
51+
1. Install Device Pack
52+
53+
Add support for the PIC32CM family devices using the following command:
54+
55+
.. code-block:: console
56+
57+
pyocd pack install pic32cm
58+
59+
2. Verify Device Support
60+
61+
Confirm that the target is recognized:
62+
63+
.. code-block:: console
64+
65+
pyocd list --targets
66+
67+
You should see an entry similar to:
68+
69+
.. code-block:: text
70+
71+
pic32cm5164jh01100 Microchip PIC32CM5164JH01100 PIC32CM-JH pack
4772
48-
To flash the board using the J-Link debugger, follow the steps below:
73+
74+
3. Connect the Board
75+
76+
Connect the DEBUG USB port on the board to your host machine to **power up the board**.
77+
78+
79+
J-Link Setup
80+
============
4981

5082
1. Install J-Link Software
5183

52-
- Download and install the `J-Link software`_ tools from Segger.
53-
- Make sure the installed J-Link executables (e.g., ``JLink``, ``JLinkGDBServer``)
54-
are available in your system's PATH.
84+
Download and install the `J-Link software`_ tools from Segger.
85+
Make sure the installed J-Link executables (e.g., ``JLink``, ``JLinkGDBServer``)
86+
are available in your system's PATH.
5587

5688
2. Connect the Board
5789

5890
- Connect the `J32 Debug Probe`_ to the board's **CORTEX DEBUG** header.
5991
- Connect the other end of the J32 Debug Probe to your **host machine (PC)** via USB.
6092
- Connect the DEBUG USB port on the board to your host machine to **power up the board**.
6193

62-
3. Build the Application
94+
95+
Building and Flashing the Application
96+
=====================================
97+
98+
1. Build the Application
6399

64100
You can build a sample Zephyr application, such as **Blinky**, using the ``west`` tool.
65101
Run the following commands from your Zephyr workspace:
@@ -70,17 +106,31 @@ To flash the board using the J-Link debugger, follow the steps below:
70106
71107
This will build the Blinky application for the ``pic32cm_jh01_cpro`` board.
72108

73-
4. Flash the Device
109+
2. Flash the Device
74110

75111
Once the build completes, flash the firmware using:
76112

77113
.. code-block:: console
78114
79115
west flash
80116
81-
This uses the default ``jlink`` runner to flash the application to the board.
117+
By default, this command uses the PyOCD runner to program the device.
118+
119+
If both J-Link and PyOCD debuggers are connected, you can explicitly select the desired runner as shown below:
120+
121+
.. code-block:: console
122+
123+
west flash --runner jlink
124+
125+
or
126+
127+
.. code-block:: console
128+
129+
west flash --runner pyocd
130+
131+
This ensures the application is flashed using the respective connected interface.
82132

83-
5. Observe the Result
133+
3. Observe the Result
84134

85135
After flashing, **LED0** on the board should start **blinking**, indicating that the
86136
application is running successfully.

0 commit comments

Comments
 (0)