Skip to content

Commit 481dcf7

Browse files
jfischer-nokartben
authored andcommitted
snippets: add USB/IP on native simulator snippet
Snippet that helps to build USB device samples with virtual device and host controllers and USBIP support. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
1 parent d22c0d2 commit 481dcf7

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

snippets/usbip-native-sim/README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. _snippet-usbip-native-sim:
2+
3+
USB/IP on Native Simulator Snippet (usbip-native-sim)
4+
#####################################################
5+
6+
.. code-block:: console
7+
8+
west build -S usbip-native-sim [...]
9+
10+
Overview
11+
********
12+
13+
This snippet allows to configure USB device samples with USB/IP support on a
14+
native simulator. When building samples with this snippet, you need to provide
15+
samples DTC overlays using the EXTRA_DTC_OVERLAY_FILE argument.
16+
17+
This snippet is experimental, the behavior may change without notice.

snippets/usbip-native-sim/snippet.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: usbip-native-sim
2+
append:
3+
EXTRA_CONF_FILE: usbip-native-sim.conf
4+
EXTRA_DTC_OVERLAY_FILE: usbip-native-sim.overlay
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CONFIG_NETWORKING=y
2+
CONFIG_NET_IPV4=y
3+
CONFIG_NET_TCP=y
4+
CONFIG_NET_SOCKETS=y
5+
6+
# Network address config
7+
CONFIG_NET_CONFIG_SETTINGS=y
8+
CONFIG_NET_CONFIG_NEED_IPV4=y
9+
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
10+
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
11+
12+
CONFIG_NET_LOG=y
13+
14+
CONFIG_USB_HOST_STACK=y
15+
CONFIG_USBH_LOG_LEVEL_WRN=y
16+
CONFIG_UHC_DRIVER_LOG_LEVEL_WRN=y
17+
CONFIG_USBIP=y
18+
CONFIG_USBIP_LOG_LEVEL_WRN=y
19+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000000
20+
CONFIG_UHC_BUF_COUNT=32
21+
CONFIG_UHC_XFER_COUNT=32
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/delete-node/ &zephyr_udc0;
8+
9+
/ {
10+
zephyr_uhc0: uhc_vrt0 {
11+
compatible = "zephyr,uhc-virtual";
12+
13+
zephyr_udc0: udc_vrt0 {
14+
compatible = "zephyr,udc-virtual";
15+
num-bidir-endpoints = <8>;
16+
maximum-speed = "high-speed";
17+
};
18+
};
19+
};

0 commit comments

Comments
 (0)