Git Product home page Git Product logo

genavb_tsn's Introduction

GenAVB/TSN

GenAVB/TSN is a generic AVB/TSN stack developed by NXP for NXP MCUs and MPUs. It is cross-platform, currently supporting Linux and FreeRTOS.

Supported hardware targets and configurations

This project supports several hardware targets and several different configuration modes. The table below summarizes the supported combinations, and their status for this specific release:

  • O: supported by the project and validated for this release
  • x: supported by the project, but not validated for this release
  • empty cell: unsupported combination
Compilation target Hardware target AVB endpoint TSN endpoint AVB/TSN bridge
linux i.MX6 i.MX 6Q, i.MX 6QP, i.MX 6D, i.MX 6SX x
linux i.MX6ULL i.MX 6ULL O
linux i.MX8 i.MX 8MP, i.MX 8DXL, i.MX 93 O O
linux i.MX8 i.MX 8MM O
linux LS1028 LS1028A O
freertos RT1052 i.MX RT1052 x x
freertos RT1176 i.MX RT1176 x x
freertos RT1189 M33 i.MX RT1189 x
freertos i.MX8MM A53 i.MX 8MM O O
freertos i.MX8MN A53 i.MX 8MN O O
freertos i.MX8MP A53 i.MX 8MP O O

Features

  • IEEE-802.1AS-2020 implementation, both time-aware Bridge and Endpoint support.
  • IEEE-802.1Q-2018 (Clause 35) implementation, both Bridge and Endpoint Support
  • IEEE-1722-2016 implementation, with MAAP support.
  • IEEE-1722.1-2013 implementation, with support for Milan 1.1a mode.
  • Binary protocol stacks running in standalone userspace processes.
  • Public API provided by binary library plus header files.
  • Example applications.

Repository structure

  • api: the public API
  • apps: source code and makefiles for example applications
  • avdecc: IEEE 1722.1-2013/Milan 1.1a component stack
  • avtp: IEEE 1722-2016 component stack
  • common: common code
  • configs: configuration files
  • doc: documentation
  • gptp: IEEE 802.1AS-2020 component stack
  • freertos: FreeRTOS specific code
  • linux: Linux specific code
  • maap: MAAP component code
  • public: common code shared between applications and stack
  • srp: IEEE 802.1Qat-2010 component stack

Build

GenAVB/TSN is using Cmake to generate build system.

Some preliminary configuration is required to provide path to the toolchain, staging directory and external components.

Local configuration files can be included by the build system in order to to define some variables specific to the developer environment. The local config file name is ./local_config_${target}.cmake

Build requirements

FreeRTOS

Currently GenAVB/TSN stack support only ARM gcc toolchain for FreeRTOS targets. To be able to build the stack, ARMGCC_DIR environement variable pointing to arm-gcc toolchain must be defined.

export ARMGCC_DIR=/path/to/gcc-arm-none-eabi-xxx

The local config file should define:

set(FREERTOS_SDK "/path/to/freertos_MCUXpresso_SDK" CACHE PATH "Path to MCUXpresso SDK")
set(FREERTOS_APPS "/path/to/freertos_application" CACHE PATH "Path to FreeRTOS application repository")

Linux

The Linux target is usually built using a complete toolchain, which helps setting most of the environment variables required for cross-compilation. In the case of a Yocto SDK/toolchain for example, the following command will setup $CROSS_COMPILE as well as other related environment variables:

source /path/to/yocto/toolchain/environement-setup-xxx

The local config should however define:

set(KERNELDIR "/path/to/linux_avb" CACHE PATH "Path to Linux kernel")

Build commands

Syntax is:

cmake . -B<build directory> -DTARGET=<target name> -DCONFIG=<config name>
make -C <build directory> install

The GenAVB/TSN stack also provides a couple shell functions with auto-completion to facilitate the build process. Usage is

# Setup environment, see Build paragraph above
source environment-genavb
make_genavb [target] [config_list]
clean_genavb [target]

where target and config_list are optional. If no config_list is defined, all available configurations for specified target are built. If no target is specified the default is linux_imx6. config_list is of the form: configA configB ..., with one or more members.

To generate doxygen HTML documentation:

cmake . -B<build directory> -DTARGET=<target name> -DCONFIG=<config name>
make -C <build directory> doc_doxygen

The generated documentation is available under <build_directory>/doc To install documentation under a custom path: use cmake variable -DDOC_OUTPUT_DIR=<custom absolute path>

Generated binaries

The generated binaries are installed under <build directory>/

Installing binaries to target

Linux

Copy the content of <build directory>/target/ to the root directory of the target filesystem

FreeRTOS

Refer to the FreeRTOS application README.

genavb_tsn's People

Contributors

ghmarwen avatar yackou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genavb_tsn's Issues

Integration with MCUXpresso, MCUXpresso VScode extension or other host debug tools

Hi.

Thanks for greatly improving the documentation! It was a very pleasant experience to go through the steps to build AVB applications targeting FreeRTOS and iMXRT1170EVK. It would be really great with some advice on how to integrate this into MCUXpresso (or the VScode plugin). Currently, I am dragging and dropping the generated .bin files onto the Mass Storage Device exposed by the companion chip on the EVK. It would be great to have the ability to flash and debug the code, use the managed linker scripts etc.

Alternatively, can you recommend some other host debug tools that enable flashing and stepping through code and interacts with GDB. I have some MCU Link and MCU Link Pro's here.

Thanks for suggestions

Not able to get clock sync working with iMXRT1170 and LinuxPTP grandmaster.

Hi.

I am using the FreeRTOS-based stack targeting iMXRT1170. I have downloaded the latest available release which is Rev4.3.0 and SDK2.11.0 here: https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/wired-communications-middleware-for-nxp-microcontrollers:WIRED-COMM-MIDDLEWARE#avb-tsn

I am able to build and flash the examples onto my board and use the shell to edit the configuration. However, I am struggling to get gPTP working properly with a linuxPTP grandmaster. I have connected an ethernet cable directly from my board into a desktop running LinuxPTP. I do not have hardware timestamping on this desktop, but it should work all the same with
software-based timestamping.

This is the print-out I am getting from the board:
genavb_dbg.txt

The first lines is due to the fact that I have updated the config from the shell, but not provided all configuration parameters.

When I turn on debug logging of fgptp, log fgptp dbg, I get the following:
fgptp_dbg.txt

Thanks for any advice

Add support for Gigabit phy/speed

Today, the speed is set to 100 Mbit/s here:

if [ "$AVB_MODE" -eq 1 ]; then
(easy to patch, but would be great if its configurable / driven by the phy mode selected)

In REALTIMEDEBUG_Rev2.5.pdf:

Attention: The PHY Delay Compensation Values in Table 64 are calibrated for 1 Gbps links. The i.MX AVB
endpoints are configured to run by default with 100 Mbps links. These compensation values should be enough to keep pDelay values under 800 ns (propagation time threshold), and therefore the port would still be declared as Capable.

Future releases shall have proper compensation values for each supported link speed.

would be great to see this changed in the next release

Better documentation of build process for iMXRT1170+FreeRTOS

Hi.

I am trying to build this project for iMXRT1170 EVK but I am not able to fully understand the documentation.

  1. What MCUXpresso SDK software should be downloaded and which versions?
    The docs points to this section:
    image
    Is MCUXpresso Config Tools required? That doesn't make sense?

The section above (not the one that is linked) seems more relevant. But what is the correct middleware?
image

You can pick between:

  1. AVB/TSN stacks

  2. GenAVB/TSN evaluation package

  3. -- Development Package

  4. What are the flags FREERTOS_SDK and FREERTOS_APPS referring to? Is it the NXP SDK? Or is it the actual FreeRTOS kernel? What are the apps?

Thanks for your help

endpoint_avb build broken for linux_imx8

I'm trying to build genavb_tsn for a imx8 target but the build fails when trying to build the kernel module avb.ko. I have a toolchain from Yocto 3.4 for imx8mpevk. Kernel is based on linux-imx version 5.10.52.

Three initial issues that comes up:

  • error: unknown type name ‘raw_rwlock_t’
  • FEC_TX_RING_SIZE and FEC_RX_RING_SIZE are not defined
  • inclusion of <linux/clk/imx-pll.h> that is not found in kernel tree
/work/git/GenAVB_TSN$ make KERNELDIR=${OECORE_TARGET_SYSROOT}/usr/src/kernel CROSS_COMPILE=${TARGET_PREFIX} STAGING_DIR=${OECORE_TARGET_SYSROOT} KBUILD_OUTPUT=${STAGING_KERNEL_BUILDDIR} target=linux_imx8 config=endpoint_avb modules
Compiling using preset CC=aarch64-poky-linux-gcc  -mcpu=cortex-a53 -march=armv8-a+crc+crypto -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/work/sdk/3.4/sysroots/cortexa53-crypto-poky-linux
install -d /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/target/usr/include/genavb/os
install -m ug+rw include/genavb/* /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/target/usr/include/genavb
install -m ug+rw include/linux/os/* /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/target/usr/include/genavb/os
install -m ug+rw build/linux_imx8/endpoint_avb/autoconf.h /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/target/usr/include/genavb
make -C build/linux_imx8/endpoint_avb/linux/modules V=0 modules MAKEFLAGS= GENAVB_INCLUDE=/work/git/GenAVB_TSN/include AUTOCONF=/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/autoconf.h CONFIG_FILE=/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/config
make[1]: Entering directory '/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules'
make -C /work/sdk/3.4/sysroots/cortexa53-crypto-poky-linux/usr/src/kernel M=`pwd` modules CROSS_COMPILE="aarch64-poky-linux-" V=0 ARCH=arm64
make[2]: Entering directory '/work/sdk/3.4/sysroots/cortexa53-crypto-poky-linux/usr/lib/modules/5.10.74-rt53+g2410d1a6a202/build'
  CC [M]  /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.o
In file included from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:29,
                 from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.c:30:
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/net_port.h:69:9: error: unknown type name ‘raw_rwlock_t’
   69 |         raw_rwlock_t lock;
      |         ^~~~~~~~~~~~
In file included from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:31,
                 from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.c:30:
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/media_clock_drv.h:62:9: error: unknown type name ‘raw_rwlock_t’
   62 |         raw_rwlock_t lock;
      |         ^~~~~~~~~~~~
In file included from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.c:30:
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:87:37: warning: "FEC_TX_RING_SIZE" is not defined, evaluates to 0 [-Wundef]
   87 | #define TX_CLEANUP_QUEUE_MIN_AVAIL (FEC_TX_RING_SIZE + TX_BEST_EFFORT_TOTAL_QUEUE_SIZE)
      |                                     ^~~~~~~~~~~~~~~~
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:88:37: note: in expansion of macro ‘TX_CLEANUP_QUEUE_MIN_AVAIL’
   88 | #define TX_CLEANUP_QUEUE_MAX_AVAIL (TX_CLEANUP_QUEUE_MIN_AVAIL + QUEUE_ENTRIES_MAX)
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:90:29: note: in expansion of macro ‘TX_CLEANUP_QUEUE_MAX_AVAIL’
   90 | #if TX_CLEANUP_QUEUE_SIZE < TX_CLEANUP_QUEUE_MAX_AVAIL
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.h:94:21: warning: "FEC_RX_RING_SIZE" is not defined, evaluates to 0 [-Wundef]
   94 | #if RX_QUEUE_SIZE < FEC_RX_RING_SIZE
      |                     ^~~~~~~~~~~~~~~~
In file included from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/media_clock_rec_pll.h:25,
                 from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/dmadrv.h:29,
                 from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/debugfs.h:23,
                 from /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.c:36:
/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/imx-pll.h:27:10: fatal error: linux/clk/imx-pll.h: No such file or directory
   27 | #include <linux/clk/imx-pll.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:280: /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules/avbdrv.o] Error 1
make[2]: *** [Makefile:1822: /work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules] Error 2
make[2]: Leaving directory '/work/sdk/3.4/sysroots/cortexa53-crypto-poky-linux/usr/lib/modules/5.10.74-rt53+g2410d1a6a202/build'
make[1]: *** [Makefile:41: modules] Error 2
make[1]: Leaving directory '/work/git/GenAVB_TSN/build/linux_imx8/endpoint_avb/linux/modules'
make: *** [Makefile.linux:22: modules] Error 2```

How can I use this stack on ls1028 endpoint port eno0??

Hi,

I checked the README file that the ls1028 board support bridge mode of AVB/TSN stack. I wonder if I can use this stack only for endpoint port on ls1028 since it has one endpoint port eno0(ENETC) which the driver is pretty much same as IMX8 endpoint port.

Thank you

Bridge time synchronization

Hello,

I tested the GenAVB/TSN stack by using the LS1028ardb-pa board.
I focus on the time synchronization for the bridge. After setting up the bridge for ls1028 as below:

root@LS1028ARDB-Ubuntu:~# brctl show
bridge name bridge id STP enabled interfaces
docker0 8000.02426c4b8d20 no
lxcbr0 8000.00163e000000 no
switch 8000.5676ebb10de9 no swp0
swp1
swp2
swp3
virbr0 8000.525400610249 yes virbr0-nic

I execute the fgptp.sh start, however, the prompt on the screen is the end-point mode, not bridge mode.
root@LS1028ARDB-Ubuntu:~# fgptp.sh start

Using ps = ps ax
Starting fgptp endpoint stack
Setting PTP priority for pid 1492 to 61
Starting phc2sys

Meanwhile, I checked the log, there is no log fgptp-br.
How to shift to bridge mode?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.