Skip to content

Commit

Permalink
Merge pull request #1083 from flit/feature/rp2040
Browse files Browse the repository at this point in the history
Raspberry Pi Pico (RP2040) support
  • Loading branch information
flit authored Feb 26, 2021
2 parents 48d24a5 + 83af211 commit 8a60e35
Show file tree
Hide file tree
Showing 16 changed files with 1,319 additions and 55 deletions.
18 changes: 18 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,21 @@ the J-Link logs, but this is harmless. J-Link does not support a "none" or "unkn
</td></tr>

</table>

## Picoprobe options

These session options are available when the Picoprobe debug probe plugin is active.

<table>

<tr><th>Option Name</th><th>Type</th><th>Default</th><th>Description</th></tr>

<tr><td>picoprobe.safeswd</td>
<td>bool</td>
<td>False</td>
<td>
Use safer but slower SWD transfer function with Picoprobe.
Default is False, so possible WAIT or FAULT SWD acknowldeges and protocol errors will not be caught immediately.
</td></tr>

</table>
15 changes: 15 additions & 0 deletions pyocd/probe/cmsis_dap_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ def open(self):
self.Capability.SWJ_SEQUENCE,
self.Capability.BANKED_DP_REGISTERS,
self.Capability.APv2_ADDRESSES,
self.Capability.JTAG_SEQUENCE,
}
if self._link.has_swd_sequence:
self._caps.add(self.Capability.SWD_SEQUENCE)
if self._link.has_swo():
self._caps.add(self.Capability.SWO)
except DAPAccess.Error as exc:
Expand Down Expand Up @@ -214,6 +217,18 @@ def swj_sequence(self, length, bits):
except DAPAccess.Error as exc:
six.raise_from(self._convert_exception(exc), exc)

def swd_sequence(self, sequences):
try:
self._link.swd_sequence(sequences)
except DAPAccess.Error as exc:
six.raise_from(self._convert_exception(exc), exc)

def jtag_sequence(self, cycles, tms, read_tdo, tdi):
try:
self._link.jtag_sequence(cycles, tms, read_tdo, tdi)
except DAPAccess.Error as exc:
six.raise_from(self._convert_exception(exc), exc)

def disconnect(self):
try:
self._link.disconnect()
Expand Down
37 changes: 37 additions & 0 deletions pyocd/probe/debug_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class Capability(Enum):

## @brief whether the probe automatically handles access of banked DAP registers.
MANAGED_DPBANKSEL = 5

## @brief Whether the probe supports the swd_sequence() API.
SWD_SEQUENCE = 6

## @brief Whether the probe supports the jtag_sequence() API.
JTAG_SEQUENCE = 7

@classmethod
def get_all_connected_probes(cls, unique_id=None, is_explicit=False):
Expand Down Expand Up @@ -229,6 +235,37 @@ def swj_sequence(self, length, bits):
"""
pass

def swd_sequence(self, sequences):
"""! @brief Send a sequences of bits on the SWDIO signal.
Each sequence in the _sequences_ parameter is a tuple with 1 or 2 members in this order:
- 0: int: number of TCK cycles from 1-64
- 1: int: the SWDIO bit values to transfer. The presence of this tuple member indicates the sequence is
an output sequence; the absence means that the specified number of TCK cycles of SWDIO data will be
read and returned.
@param self
@param sequences A sequence of sequence description tuples as described above.
@return A 2-tuple of the response status, and a sequence of bytes objects, one for each input
sequence. The length of the bytes object is (<TCK-count> + 7) / 8. Bits are in LSB first order.
"""
raise NotImplementedError()

def jtag_sequence(self, cycles, tms, read_tdo, tdi):
"""! @brief Send JTAG sequence.
@param self
@param cycles Number of TCK cycles, from 1-64.
@param tms Fixed TMS value. Either 0 or 1.
@param read_tdo Boolean indicating whether TDO should be read.
@param tdi Integer with the TDI bit values to be transferred each TCK cycle. The LSB is
sent first.
@return Either an integer with TDI bit values, or None, if _read_tdo_ was false.
"""
raise NotImplementedError()

def set_clock(self, frequency):
"""! @brief Set the frequency for JTAG and SWD in Hz.
Expand Down
Loading

0 comments on commit 8a60e35

Please sign in to comment.