Skip to content

Commit f624486

Browse files
jfischer-nokartben
authored andcommitted
samples: dap: use new USB device stack and new DAP backend USB
Rework the sample to use the new USB device stack and the new DAP backend and align the sample with the WebUSB sample which has a similar BOS descriptor. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
1 parent 53c33ab commit f624486

File tree

8 files changed

+280
-346
lines changed

8 files changed

+280
-346
lines changed

samples/subsys/dap/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ cmake_minimum_required(VERSION 3.20.0)
55
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
66
project(dap)
77

8+
include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake)
89
FILE(GLOB app_sources src/*.c)
910
target_sources(app PRIVATE ${app_sources})

samples/subsys/dap/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2023 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Source common USB sample options used to initialize new experimental USB
5+
# device stack. The scope of these options is limited to USB samples in project
6+
# tree, you cannot use them in your own application.
7+
source "samples/subsys/usb/common/Kconfig.sample_usbd"
8+
9+
source "Kconfig.zephyr"

samples/subsys/dap/README.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Overview
77
********
88

99
This sample app demonstrates use of a SWDP interface driver and CMSIS DAP
10-
controller through USB Bulk interface.
10+
controller through DAP USB backend.
1111

1212
Requirements
1313
************
@@ -21,8 +21,6 @@ e.g. if the SWD connections are multiplexed.
2121
Building and Running
2222
********************
2323

24-
In order for our debug adapter to be recognized by pyOCD we need to change
25-
Zephyr's VID/PID to IDs known to pyOCD, this is up to the user.
2624
The following commands build and flash DAP sample.
2725

2826
.. zephyr-app-commands::

samples/subsys/dap/prj.conf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1+
CONFIG_USB_DEVICE_STACK_NEXT=y
2+
CONFIG_SAMPLE_USBD_PRODUCT="Zephyr CMSIS-DAP"
3+
CONFIG_SAMPLE_USBD_PID=0x0204
4+
CONFIG_SAMPLE_USBD_20_EXTENSION_DESC=y
5+
16
CONFIG_STDOUT_CONSOLE=y
2-
CONFIG_USB_DEVICE_STACK=y
3-
CONFIG_USB_DEVICE_BOS=y
47
CONFIG_SERIAL=y
5-
CONFIG_USB_DEVICE_PRODUCT="Zephyr CMSIS-DAP"
6-
CONFIG_USB_DEVICE_PID=0x0204
78
CONFIG_UART_INTERRUPT_DRIVEN=y
89
CONFIG_UART_LINE_CTRL=y
9-
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
1010

1111
CONFIG_LOG=y
12+
CONFIG_LOG_DEFAULT_LEVEL=2
1213

13-
CONFIG_USB_DRIVER_LOG_LEVEL_INF=y
14-
CONFIG_USB_DEVICE_LOG_LEVEL_INF=y
1514
CONFIG_DAP_LOG_LEVEL_INF=y
1615
CONFIG_DP_DRIVER_LOG_LEVEL_INF=y
1716
CONFIG_DAP=y
17+
CONFIG_DAP_BACKEND_USB=y
1818
CONFIG_GPIO=y
19-
CONFIG_NET_BUF=y

samples/subsys/dap/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tests:
55
build_only: true
66
depends_on:
77
- arduino_gpio
8-
- usb_device
8+
- usbd
99
platform_allow:
1010
- nrf52840dk/nrf52840
1111
- frdm_k64f

0 commit comments

Comments
 (0)