Skip to content

Commit

Permalink
Merge pull request #993 from flit/feature/update_known_cmsis_dap_prob…
Browse files Browse the repository at this point in the history
…e_list

Update list of known CMSIS-DAP probes
  • Loading branch information
flit committed Nov 8, 2020
1 parent 80dcd91 commit 799885f
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ Requirements
- macOS, Linux, or Windows 7 or newer
- Microcontroller with an Arm Cortex-M CPU
- Supported debug probe
- [CMSIS-DAP](http://www.keil.com/pack/doc/CMSIS/DAP/html/index.html) v1 (HID),
such as:
- An on-board debug probe using [DAPLink](https://os.mbed.com/handbook/DAPLink) firmware.
- [CMSIS-DAP](http://www.keil.com/pack/doc/CMSIS/DAP/html/index.html) v1 (HID), such as:
- An on-board or standalone debug probe using [DAPLink](https://os.mbed.com/handbook/DAPLink) firmware.
- NXP LPC-LinkII
- [CMSIS-DAP](http://www.keil.com/pack/doc/CMSIS/DAP/html/index.html) v2 (WinUSB),
such as:
- NXP MCU-Link
- Atmel-ICE
- [CMSIS-DAP](http://www.keil.com/pack/doc/CMSIS/DAP/html/index.html) v2 (WinUSB), such as:
- [DAPLink](https://os.mbed.com/handbook/DAPLink) firmware version 0254 or newer.
- Cypress KitProg3
- Cypress KitProg3 or MiniProg4
- Keil ULINKplus
- SEGGER J-Link (experimental)
- STLinkV2 or STLinkV3, either on-board or the standalone versions.
Expand Down
35 changes: 29 additions & 6 deletions pyocd/probe/pydapaccess/interface/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pyOCD debugger
# Copyright (c) 2019 Arm Limited
# Copyright (c) 2019-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -30,16 +30,39 @@

CMSIS_DAP_HID_USAGE_PAGE = 0xff00

# Various known USB VID/PID values.
ARM_DAPLINK_ID = (0x0d28, 0x0204)
KEIL_ULINKPLUS_ID = (0xc251, 0x2750)
NXP_LPCLINK2_ID = (0x1fc9, 0x0090)
# Known USB VID/PID pairs.
ARM_DAPLINK_ID = (0x0d28, 0x0204) # Arm DAPLink firmware
ATMEL_ICE_ID = (0x03eb, 0x2141) # Atmel-ICE
CYPRESS_KITPROG1_2_ID = (0x04b4, 0xf138) # Cypress KitProg1, KitProg2 in CMSIS-DAP mode
CYPRESS_MINIPROG4_BULK_ID = (0x04b4, 0xf151) # Cypress MiniProg4 bulk
CYPRESS_MINIPROG4_HID_ID = (0x04b4, 0xf152) # Cypress MiniProg4 HID
CYPRESS_KITPROG3_HID_ID = (0x04b4, 0xf154) # Cypress KitProg3 HID
CYPRESS_KITPROG3_BULKD_ID = (0x04b4, 0xf155) # Cypress KitProg3 bulk
CYPRESS_KITPROG3_BULK_2_UART_ID = (0x04b4, 0xf166) # Cypress KitProg3 bulk with 2x UART
KEIL_ULINKPLUS_ID = (0xc251, 0x2750) # Keil ULINKplus
NXP_LPCLINK2_ID = (0x1fc9, 0x0090) # NXP LPC-LinkII
NXP_MCULINK_ID = (0x1fc9, 0x0143) # NXP MCU-Link

## List of VID/PID pairs for known CMSIS-DAP USB devices.
KNOWN_CMSIS_DAP_IDS = [
ARM_DAPLINK_ID,
ATMEL_ICE_ID,
CYPRESS_KITPROG1_2_ID,
CYPRESS_MINIPROG4_BULK_ID,
CYPRESS_MINIPROG4_HID_ID,
CYPRESS_KITPROG3_HID_ID,
CYPRESS_KITPROG3_BULKD_ID,
CYPRESS_KITPROG3_BULK_2_UART_ID,
KEIL_ULINKPLUS_ID,
NXP_LPCLINK2_ID,
NXP_MCULINK_ID,
]

## List of VID/PID pairs for CMSIS-DAP probes that have multiple HID interfaces that must be
# filtered by usage page. Currently these are only NXP probes.
CMSIS_DAP_IDS_TO_FILTER_BY_USAGE_PAGE = [
NXP_LPCLINK2_ID,
NXP_MCULINK_ID,
]

def is_known_cmsis_dap_vid_pid(vid, pid):
Expand Down Expand Up @@ -75,7 +98,7 @@ def filter_device_by_usage_page(vid, pid, usage_page):
@retval True Skip the device.
@retval False The device is valid.
"""
return ((vid, pid) == NXP_LPCLINK2_ID) \
return ((vid, pid) in CMSIS_DAP_IDS_TO_FILTER_BY_USAGE_PAGE) \
and (usage_page != CMSIS_DAP_HID_USAGE_PAGE)

def check_ep(interface, ep_index, ep_dir, ep_type):
Expand Down
26 changes: 26 additions & 0 deletions udev/50-cmsis-dap.rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 04b4:f138 Cypress KitProg1/KitProg2 CMSIS-DAP mode
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f138", MODE:="666"

# 04b4:f151 Cypress MiniProg4 CMSIS-DAPv2 Bulk + I2C/SPI/UART
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f151", MODE:="666"

# 04b4:f152 Cypress MiniProg4 CMSIS-DAPv1 HID + I2C/SPI/UART
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f152", MODE:="666"

# 04b4:f154 Cypress KitProg3 CMSIS-DAPv1 HID + I2C/SPI/UART
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f154", MODE:="666"

# 04b4:f155 Cypress KitProg3 CMSIS-DAPv2 Bulk + I2C/SPI/UART
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f155", MODE:="666"

# 04b4:f166 Cypress KitProg3 CMSIS-DAPv2 Bulk + 2xUART
SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f166", MODE:="666"

# 0d28:0204 DAPLink
SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE:="666"

Expand All @@ -7,5 +25,13 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="c251", ATTR{idProduct}=="2750", MODE:="666"
# 1fc9:0090 NXP LPC-LinkII
SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", ATTR{idProduct}=="0090", MODE:="666"

# 1fc9:0143 NXP MCU-Link
SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", ATTR{idProduct}=="0143", MODE:="666"

# 03eb:2141 Atmel-ICE CMSIS-DAP
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2141", MODE:="666"

# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
12 changes: 8 additions & 4 deletions udev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ discouraged.

The following debug probes are supported:

- Cypress KitProg1/KitProg2 in CMSIS-DAP mode
- Cypress KitProg3
- Cypress MiniProg4
- DAPLink
- STLinkV2
- STLinkV2-1
- STLinkV3
- Keil ULINKplus
- NXP LPC-LinkII
- NXP MCU-Link


To install, copy the rules files in this directory to `/etc/udev/rules.d/` on Ubuntu:
Expand All @@ -38,9 +42,9 @@ $ sudo udevadm control --reload
$ sudo udevadm trigger
```

By default, the rules provide open access to the debug probes for all users. If you share your Linux
system with other users, or just don't like the idea of write permission for everybody, you can
replace `MODE:="0666"` with `OWNER:="yourusername"` to create the device owned by you, or with
`GROUP:="somegroupname"` and mange access using standard Unix groups.
By default, the rules provide open access to the debug probes for all users (0666 permissions).
If you share your Linux system with other users, or just don't like the idea of write permission
for everybody, you can replace `MODE:="0666"` with `OWNER:="yourusername"` to create the device
owned by you, or with `GROUP:="somegroupname"` and mange access using standard Unix groups.

_Note: STLink rules provided courtesy of STMicroelectronics._

0 comments on commit 799885f

Please sign in to comment.