samples/net/gptp: Move from native_posix to native_sim

* In the sample doc and shell script,
  replace native_posix references with native_sim
* Provide overlays for native_sim(_64)
* Enable native_sim in the test yaml

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-11-13 16:53:57 +01:00 committed by Carles Cufí
parent d0f554dd6a
commit 01ae8079e5
5 changed files with 27 additions and 9 deletions

View file

@ -25,7 +25,7 @@ Building and Running
********************
A good way to run this sample is to run this gPTP application inside
native_posix board as described in :ref:`networking_with_native_sim` or with
native_sim board as described in :ref:`networking_with_native_sim` or with
embedded device like NXP FRDM-K64F, Nucleo-H743-ZI, Nucleo-H745ZI-Q,
Nucleo-F767ZI or Atmel SAM-E70 Xplained. Note that gPTP is only supported for
boards that have an Ethernet port and which has support for collecting
@ -51,7 +51,7 @@ Setting up Linux Host
If you need VLAN support in your network, then the
:zephyr_file:`samples/net/vlan/vlan-setup-linux.sh` provides a script that can be
executed on the Linux host. It creates two VLANs on the Linux host and creates
routes to Zephyr. If you are using native_posix board, then
routes to Zephyr. If you are using native_sim board, then
the ``net-setup.sh`` will create VLAN setup automatically with this command:
.. code-block:: console
@ -61,9 +61,9 @@ the ``net-setup.sh`` will create VLAN setup automatically with this command:
The OpenAVNU repository at https://github.com/AVnu contains gPTP
daemon that can be run in Linux host and which can act as a grandmaster for
the IEEE 801.1AS network. Note that OpenAVNU will not work with
native_posix board as that board only supports software timestamping and
native_sim board as that board only supports software timestamping and
OpenAVNU only supports hardware timestamping. See instructions at the end
of this chapter how to run linuxptp daemon with native_posix board.
of this chapter how to run linuxptp daemon with native_sim board.
Get OpenAvnu/gPTP project sources
@ -126,7 +126,7 @@ By default gPTP in Zephyr will not print any gPTP debug messages to console.
One can enable debug prints by setting
:kconfig:option:`CONFIG_NET_GPTP_LOG_LEVEL_DBG` in the config file.
For native_posix board, use ``linuxptp`` project as that supports
For native_sim board, use ``linuxptp`` project as that supports
software timestamping.
Get linuxptp project sources
@ -150,7 +150,7 @@ Multiport Setup
If you set :kconfig:option:`CONFIG_NET_GPTP_NUM_PORTS` larger than 1, then gPTP sample
will create multiple TSN ports. This configuration is currently only supported
in native_posix board.
in native_sim board.
You need to enable the ports in the net-tools. If the number of ports is set
to 2, then give following commands to create the network interfaces in host
@ -163,7 +163,7 @@ side:
After that you can start ptp4l daemon for both interfaces. Please use two
terminals when starting ptp4l daemon. Note that you must use ptp4l as OpenAVNU
does not work with software clock available in native_posix.
does not work with software clock available in native_sim.
.. code-block:: console
@ -175,7 +175,7 @@ Compile Zephyr application.
.. zephyr-app-commands::
:zephyr-app: samples/net/gptp
:board: native_posix
:board: native_sim
:goals: build
:compact:

View file

@ -0,0 +1,8 @@
# Settings for native_posix ethernet driver
CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK=y
#CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=y
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:2a"
# Assume 1 ms accuracy for native_posix simulated clock
CONFIG_NET_GPTP_CLOCK_ACCURACY_1MS=y

View file

@ -0,0 +1,8 @@
# Settings for native_posix ethernet driver
CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK=y
#CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=y
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:2a"
# Assume 1 ms accuracy for native_posix simulated clock
CONFIG_NET_GPTP_CLOCK_ACCURACY_1MS=y

View file

@ -14,7 +14,7 @@ start_docker \
"/usr/local/sbin/ptp4l -2 -f /etc/gptp.cfg -m -q -l 6 -S -i eth0" \
|| return $?
# For native_posix gPTP run, the delay threshold needs to be huge
# For native_sim gPTP run, the delay threshold needs to be huge
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_RUN_DURATION=10" \
"-DCONFIG_NET_GPTP_NEIGHBOR_PROP_DELAY_THR=12000000"

View file

@ -13,6 +13,8 @@ tests:
- sam_e70_xplained
- native_posix
- native_posix_64
- native_sim
- native_sim_64
- nucleo_f767zi
- nucleo_h743zi
- nucleo_h745zi_q_m7