Advertisement

Quick Links

HRPNUG
Harpoon User's Guide
Rev. 2.2 — 16 December 2022
Document information
Information
Content
Keywords
i.MX 8M device family, Arm Cortex-A53 processor (Armv8-A architecture),
RTOS, Linux, hardware partitioning, Jailhouse hypervisor, NXP Linux Yocto,
Zephyr RTOS, FreeRTOS, MCUXpresso SDK
Abstract
This document presents the Harpoon release 2.2 for i.MX 8M device family,
using the Arm Cortex-A53 processor (Armv8-A architecture).
User guide

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the HRPNUG and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for NXP Semiconductors HRPNUG

  • Page 1 HRPNUG Harpoon User's Guide Rev. 2.2 — 16 December 2022 User guide Document information Information Content Keywords i.MX 8M device family, Arm Cortex-A53 processor (Armv8-A architecture), RTOS, Linux, hardware partitioning, Jailhouse hypervisor, NXP Linux Yocto, Zephyr RTOS, FreeRTOS, MCUXpresso SDK Abstract This document presents the Harpoon release 2.2 for i.MX 8M device family,...
  • Page 2: Overview

    HRPNUG NXP Semiconductors Harpoon User's Guide Overview This document presents the Harpoon release 2.2 for i.MX 8M device family, using the Arm Cortex-A53 processor (Armv8-A architecture). Harpoon provides an environment for developing real-time demanding applications on an RTOS running on one (or several) Cortex-A core(s) in parallel of a Linux distribution, leveraging the 64-bit Arm architecture for higher performance.
  • Page 3: Hardware Resource Partitioning

    HRPNUG NXP Semiconductors Harpoon User's Guide Figure 1. Harpoon solution architecture The i.MX 8M box shows the hardware partitioning between Jailhouse cells. The boxes in dark orange (group 1) show the main hardware blocks allocated to the Linux OS. The boxes in blue (group 3) show the main hardware blocks allocated to the RTOS.
  • Page 4: Building Harpoon Yocto Images

    HRPNUG NXP Semiconductors Harpoon User's Guide • CPU cores assigned to the cell • Interrupt lines assigned to the cell • Memory regions assigned to the cell • Virtual PCI devices used for communication between cells There is also a root cell configuration that describes the hardware prior to the hardware partitioning.
  • Page 5: I.mx Yocto

    HRPNUG NXP Semiconductors Harpoon User's Guide 2.1 i.MX Yocto To build this release, fetch its Yocto manifest and get the meta-layers: $ mkdir yocto $ cd yocto $ repo init -u https://github.com/nxp-imx/imx-manifest -b imx- linux-kirkstone -m imx-5.15.71-2.2.0_harpoon-v2.xml $ repo sync Then, prepare the environment with the following command: $ DISTRO=fsl-imx-xwayland MACHINE=<machine>...
  • Page 6 HRPNUG NXP Semiconductors Harpoon User's Guide Figure 2. i.MX 8M Mini EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i- mx-8m-mini-applications-processor:8MMINILPD4-EVK Figure 3. i.MX 8M Nano EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i- mx-8m-nano-applications-processor:8MNANOD4-EVK.
  • Page 7: Audio Use Case Hardware

    HRPNUG NXP Semiconductors Harpoon User's Guide Figure 4. i.MX 8M Plus EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/i-mx-8m-plus-evaluation- kit-enabling-power-measurement:8MPLUSLPD4-PEVK. 3.2 Audio use case hardware Harpoon audio application uses the I2S HiFiBerry audio card DAC+ ADC Pro.
  • Page 8 HRPNUG NXP Semiconductors Harpoon User's Guide Table 1. EVK - HiFiBerry transposition ...continued HiFiBerry Function I2C SDA I2C SCK I2S TX I2S clock I2S word select for RX and TX I2S RX Figure 6. Handmade transposer A complete setup, with a handmade transposer to respect above pinout, is shown as follows.
  • Page 9 HRPNUG NXP Semiconductors Harpoon User's Guide Figure 7. i.MX 8M Mini EVK with HiFiBerry audio card The audio card has both an ADC (PCM1863) to record audio and a DAC (PCM5122) for audio playback. Record is done through the audio jack (connector highlighted in 1 in the following figure) and playback is done through the RCA connectors (highlighted in 2).
  • Page 10: Industrial Use Case Hardware

    HRPNUG NXP Semiconductors Harpoon User's Guide Both the PCM1863 and PCM5122 use i.MX I2S5. The I2S5 is the I2S clock master. Two oscillators (one for sampling frequencies multiple of 44,100 Hz, one for sampling frequencies multiple of 48,000 Hz) are present on the HiFiBerry card, and controlled by PCM5122 GPIOs.
  • Page 11 HRPNUG NXP Semiconductors Harpoon User's Guide Figure 10. LS1028A AVB/TSN network bridge Note: For more information to order the board, see https://www.nxp.com/design/qoriq- developer-resources/layerscape-ls1028a-reference-design-board:LS1028ARDB. The LS1028A RDB is used as a TSN bridge/switch in a TSN network to demonstrate the TSN Ethernet use case running from the inmate cell.
  • Page 12: Running Harpoon Reference Applications

    HRPNUG NXP Semiconductors Harpoon User's Guide Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation- kit:MIMXRT1170-EVK. The RT1170 is used as a TSN endpoint in a TSN network, exchanging packets with the i.MX 8MP board. Running Harpoon Reference Applications 4.1 Basic setup...
  • Page 13: Audio Application

    HRPNUG NXP Semiconductors Harpoon User's Guide • For i.MX 8M Plus (audio AVB): u-boot => setenv jh_root_dtb imx8mp-evk-harpoon-avb.dtb u-boot => run jh_mmcboot • For i.MX 8M Plus (industrial or rt_latency): u-boot => setenv jh_root_dtb imx8mp-evk-harpoon-industrial.dtb u-boot => run jh_mmcboot Note: This configuration is not persistent after a reboot.
  • Page 14: Starting The Audio Application With Jailhouse

    HRPNUG NXP Semiconductors Harpoon User's Guide • Basic pipeline framework for audio processing • 44100, 48000, 88200, 96000, 176400, and 192000 Hz sample frequencies • Audio processing period with 2, 4, 8, 16, or 32 frames • Audio processing in 64bit float format •...
  • Page 15: Audio Latency In Loopback Mode

    HRPNUG NXP Semiconductors Harpoon User's Guide 5 - SMP audio pipeline stop running audio mode Audio pipeline options: -a <pipeline_id> audio pipeline id (default 0) audio pipeline dump Audio element options: -a <pipeline_id> audio pipeline id (default 0) audio element dump -e <element_id>...
  • Page 16: Playing Dtmf

    HRPNUG NXP Semiconductors Harpoon User's Guide 4.3.4.1 Playing DTMF To start DTMF playback with default parameters (48000 Hz sampling rate): # harpoon_ctrl audio -r 0 The DTMF is played both to the Hifiberry RCA outputs as well as the onboard jack.
  • Page 17 HRPNUG NXP Semiconductors Harpoon User's Guide Audio pipeline with multiple sources/sinks and a routing element Figure 12. Audio pipeline When running the audio pipeline, the routes can be configured dynamically with the harpoon_ctrl command. This command uses source and sink indices to connect elements.
  • Page 18: Playing An Avb Audio Pipeline

    HRPNUG NXP Semiconductors Harpoon User's Guide codec) while a DTMF sequence is played on the left channel of SAI5's output and a 440 Hz sine wave on the right channel of SAI5's output (i.e., HiFiBerry's output): # harpoon_ctrl audio -r 3...
  • Page 19 HRPNUG NXP Semiconductors Harpoon User's Guide Table 5. Indices of source elements Index Source element Comment Sine wave, 440 Hz Software generated source SAI5, left channel Hardware source SAI5, right channel Hardware source SAI3, left channel Hardware source SAI3, right channel...
  • Page 20 HRPNUG NXP Semiconductors Harpoon User's Guide AVB Talker (blue box) connected to the AVB Listener (orange box) through Ethernet. Figure 14. AVB Audio setup 4.3.4.4.2 AVB Talker configuration The default AVB script needs to be modified to configure operations of the Talker entity as using a custom Media Application.
  • Page 21 HRPNUG NXP Semiconductors Harpoon User's Guide talker_mediaX.raw in the /home/media repository, with X being the stream number. Therefore, before executing the multi-stream application, some symbolic links needs to be created in the /home/media directory for associating the talker_mediaX.raw names; here is an example for stream #0: # cd /home/media # ln -s sample1_for_aaf.raw talker_media0.raw...
  • Page 22 HRPNUG NXP Semiconductors Harpoon User's Guide 4.3.4.4.4 AVB stream connection This section describes how to use AVDECC events to configure the stream output of the Talker to the input of the Listener. To do so, we may use the GenAVB AVDECC controller...
  • Page 23 HRPNUG NXP Semiconductors Harpoon User's Guide Entity ID = 0x49f070f840000 Model ID = 0x49f0000090001 Capabilities = 0x708 Association ID = 0x0 MAC address= 00:04:9F:07:0F:84 Local MAC address= 00:04:9F:07:0F:84 Talker: sources = 8 capabilities = 0x4801 Stream 0: name = Stream output 0...
  • Page 24 HRPNUG NXP Semiconductors Harpoon User's Guide current_format = 0x0205021800806000 ( AAF 2chans 24/32bits 48000Hz 6samples/packet ) Stream 6: name = Stream input 6 interface index = 0 number of formats = 1 flags = 0x6 current_format = 0x0205021800806000 ( AAF 2chans 24/32bits...
  • Page 25: Playing An Smp Full Audio Pipeline

    HRPNUG NXP Semiconductors Harpoon User's Guide To disconnect a stream, use the command: # genavb-controller-app -d <talker_entity_id> <talker_unique_id> <listener_entity_id> <listener_unique_id> In the below example, the Listener's stream #0 is connected to the Talker’s stream #0: # genavb-controller-app -c 0x49f070f840000 0 0x49fddee100000 0...
  • Page 26: Industrial Application

    HRPNUG NXP Semiconductors Harpoon User's Guide Figure 15. SMP Audio Pipeline with two threads and CPU cores To run the Zephyr audio SMP pipeline application, the following command can be run to generate an appropriate configuration file: # harpoon_set_configuration.sh zephyr audio_smp Note: Avoid changing the configuration while the Harpoon service is running (silent failure when restarting the service).
  • Page 27: Starting The Industrial Application

    HRPNUG NXP Semiconductors Harpoon User's Guide /usr/share/harpoon/inmates/freertos/industrial_rpmsg.bin FreeRTOS binary of RPMSG based control channel Note: In the current release, the RPMsg based control channel is only supported under FreeRTOS on i.MX 8M Mini EVK. This application contains several use cases that can be started and stopped via the Harpoon Linux user space application, namely harpoon_ctrl/ harpoon_ctrl_rpmsg.
  • Page 28: Running The Industrial Application: Examples

    HRPNUG NXP Semiconductors Harpoon User's Guide The configuration file is stored under /etc/harpoon/harpoon.conf and the harpoon systemd service uses it to start Jailhouse and the industrial application: # systemctl start harpoon Once the harpoon service has been started, harpoon_ctrl/harpoon_ctrl_rpmsg is used to start or stop the industrial features with optional parameters.
  • Page 29: Ethernet Through Mcuxpresso Sdk Api

    HRPNUG NXP Semiconductors Harpoon User's Guide Type this command to start receiving CAN FD data on board B: # harpoon_ctrl can -n 1 -r 2 Type this command on board A to start transferring data: # harpoon_ctrl can -n 0 -r 2 4.4.3.2 Ethernet through MCUXpresso SDK API...
  • Page 30 HRPNUG NXP Semiconductors Harpoon User's Guide 0x0120: 2122 2324 2526 2728 292a 2b2c 2d2e 2f30 !"#$%&'()*+,-./0 0x0130: 3132 3334 3536 3738 393a 3b3c 3d3e 3f40 123456789:;<=>?@ 0x0140: 4142 4344 4546 4748 494a 4b4c 4d4e 4f50 ABCDEFGHIJKLMNOP 0x0150: 5152 5354 5556 5758 595a 5b5c 5d5e 5f60 QRSTUVWXYZ[\]^_` 0x0160: 6162 6364 6566 6768 696a 6b6c 6d6e 6f70 abcdefghijklmnop 0x0170: 7172 7374 7576 7778 797a 7b7c 7d7e 7f80 qrstuvwxyz{|}~..
  • Page 31: Ethernet With Genavb/Tsn Stack

    HRPNUG NXP Semiconductors Harpoon User's Guide INFO: ethernet_sdk_enet_run : PHY setup was finalized INFO: ethernet_sdk_enet_run : 30 frames ----> will be sent in 3 queues, and frames will be received in 3 queues. INFO: ethernet_sdk_enet_run : The frames transmitted from the...
  • Page 32 HRPNUG NXP Semiconductors Harpoon User's Guide 4.4.3.3.2 Setup preparation One of the TSN endpoint needs to be configured as “controller” and the other one as “IO device”. Both endpoints are connected to the TSN bridge. 4.4.3.3.2.1 i.MX RT1170 TSN Endpoint - IO Device (Optional) If using an i.MX RT1170 as the IO device, first flash the latest GenAVB/TSN Endpoint...
  • Page 33 HRPNUG NXP Semiconductors Harpoon User's Guide • Pdelay (propagation delay), Link status, AS capability and Port Role are printed for each port. Port(0): domain(0, 0): Role: Master Link: Up asCapable: Yes neighborGptpCapable: Yes delayMechanism: P2P Port(0): Propagation delay (ns): 334.29...
  • Page 34 HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.000000000 stack-freertos hw_timer_register : hw_timer(C06000C8) of clock id: 1 registered INIT 0.000000000 stack-freertos hw_timer_register : hw_timer(C0600110) of clock id: 1 registered INFO 0.000000000 stack-freertos hw_avb_timer_register_device : dev(C06003D0) , ref clock 24000000 Hz, min delay cycles 240 INFO 0.000000000 stack-freertos...
  • Page 35 HRPNUG NXP Semiconductors Harpoon User's Guide 0.000000000 stack-freertos _os_clock_init : clock ID: 12 has no hw clock 0.000000000 stack-freertos _os_clock_init : clock ID: 13 has no hw clock INIT 0.000000000 stack-freertos _os_clock_init : clock ID: 14 success, flags: 4 0.000000000 stack-freertos _os_clock_init...
  • Page 36 HRPNUG NXP Semiconductors Harpoon User's Guide INFO 0.000000000 stack-freertos timer_system_create : os_timer(C06585A0), queue: 0 INFO 0.000000000 stack-freertos os_timer_create : os_timer(C06585A0), queue: C06583A0 INIT 0.000000000 management mac_service_init : mac(C06585D8) done INIT 0.000000000 management management_init : management(C0658550) done INIT 0.000000000 stack-freertos management_task...
  • Page 37 HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.000000000 gptp gptp_instance_init : Configuring Port(0) (C0663B30) domain(0, 0) delayMechanism(P2P) INIT 0.000000000 gptp gptp_port_init_timers : Port(0) INFO 0.000000000 stack-freertos timer_system_create : os_timer(C0665668), queue: 0 INFO 0.000000000 stack-freertos os_timer_create : os_timer(C0665668), queue: C0659FA0 INFO 0.000000000 stack-freertos timer_system_create...
  • Page 38 HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.000000000 gptp gptp_instance_init : Configuring Port(0) (C0664AB0) domain(1, -1) delayMechanism(COMMON_P2P) INIT 0.000000000 gptp gptp_port_init_timers : Port(0) INFO 0.000000000 stack-freertos timer_system_create : os_timer(C0665A10), queue: 0 INFO 0.000000000 stack-freertos os_timer_create : os_timer(C0665A10), queue: C0659FA0 INFO 0.000000000 stack-freertos timer_system_create...
  • Page 39 HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.159357387 stack-freertos ipc_rx_init : ipc(C06039C8, C066B5E0) success INIT 0.159357387 stack-freertos ipc_tx_init : ipc(C0603898, C066B780) success INFO 0.159357387 stack-freertos __net_rx_init : socket(C066B920) INFO 0.159357387 stack-freertos __net_tx_init : socket(C066BB40) port_id(0) INIT 0.159357387 stack-freertos ipc_rx_init : ipc(C06014F8, C066BF00) success INIT 0.159357387 stack-freertos ipc_tx_init...
  • Page 40 HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.159357387 srp msrp_init : msrp(C066ABB8) done INIT 0.159357387 stack-freertos ipc_rx_init : ipc(C0601C18, C066C470) success INIT 0.159357387 stack-freertos ipc_tx_init : ipc(C0601D48, C066C610) success INIT 0.159357387 stack-freertos ipc_tx_init : ipc(C0601E78, C066C7B0) success INIT 0.159357387 srp...
  • Page 41 HRPNUG NXP Semiconductors Harpoon User's Guide INFO 0 app cyclic_task_init : cyclic task type: 0, id: 0 INFO 0 app cyclic_task_init : task params INFO 0 app cyclic_task_init : task_period_ns : 100000 INFO 0 app cyclic_task_init task_period_offset_ns : 0 INFO...
  • Page 42: Rt_Latency Application

    HRPNUG NXP Semiconductors Harpoon User's Guide To stop the Ethernet use case (to eventually restart it), the previous run must be stopped with the following command: # harpoon_ctrl ethernet -s 4.5 rt_latency application The rt_latency application is a simple benchmark application for real-time OS that...
  • Page 43 HRPNUG NXP Semiconductors Harpoon User's Guide Once the Harpoon service has been started, the following rt_latency trace is shown in the terminal emulator connected to the other serial port: Harpoon v2.1.0 main_task: running After booting, the rt_latency application waits for commands to be received.
  • Page 44 HRPNUG NXP Semiconductors Harpoon User's Guide n_slot 21 slot_size 200 0 0 0 0 0 499 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 stats(C06016C0) irq to sched (ns) min 2916 mean 3265 max 6125...
  • Page 45: Known Issues

    HRPNUG NXP Semiconductors Harpoon User's Guide Table 9. Real-time latencies measured on i.MX 8M Plus/Zephyr (in ns) Description i.MX 8M Plus IRQ Latency (ns) i.MX 8M Plus Task Latency (ns) Average Stddev Average Stddev 4,583 2,153 2,875 2,947 7,916 190,931 system...
  • Page 46: Manual Build

    HRPNUG NXP Semiconductors Harpoon User's Guide are required to build FreeRTOS based applications and repositories zephyr hal_nxp are required to build Zephyr based applications. Additionally, repository GenAVB_TSN is needed to build the industrial application. The west tool is used to fetch those repositories, along with harpoon-apps Git tree.
  • Page 47: Building Zephyr Based Applications

    HRPNUG NXP Semiconductors Harpoon User's Guide • RTOS_APP is audio, industrial or rt_latency. • BOARD is evkmimx8mm for i.MX 8M Mini, evkmimx8mn for i.MX 8M Nano, evkmimx8mp for i.MX 8M Plus. • Build artefacts are available in the directory ddr_release/.
  • Page 48: Starting An Rtos Application With Jailhouse

    HRPNUG NXP Semiconductors Harpoon User's Guide When the toolchain is installed, different cross-compile variables must be set. This is done by sourcing script environment-setup-cortexa53-crypto-poky-linux. For example with default installation path: $ . /opt/fsl-imx-xwayland/5.15-kirkstone/environment-setup- armv8a-poky-linux The Harpoon control application can then be built: $ cd harpoon-apps/ctrl $ ./build_ctrl.sh...
  • Page 49: Source File Creation

    HRPNUG NXP Semiconductors Harpoon User's Guide The DAC and ADC on the HiFiBerry card are controlled by the audio application. Control is done through I2C3 and data throughput through SAI5. 6.4.2 Source file creation This chapter gives some information on how to develop an application for Harpoon by using the audio application as an example.
  • Page 50: Board Specific Code

    HRPNUG NXP Semiconductors Harpoon User's Guide │ │ ├── codec_config.h │ │ ├── pin_mux.h │ │ ├── sai_clock_config.h │ │ └── sai_config.h │ ├── pipeline_config.c │ ├── play_pipeline.c │ ├── sai_drv.c │ └── sai_drv.h ├── freertos │ ├── boards │...
  • Page 51: Controlling Application From Linux Side

    HRPNUG NXP Semiconductors Harpoon User's Guide Table 11. Board specific code ...continued app_mmu.h Device memory to map with MMU (includes SAI and I2C). sai_clock_ Configuration of Audio PLLs, Audiomix (for i.MX 8M Plus) and SAI clocks. config.c Define configuration of each SAI instance.
  • Page 52: Revision History

    HRPNUG NXP Semiconductors Harpoon User's Guide 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  • Page 53: Legal Information

    NXP Semiconductors. In the event that customer uses the product for design-in and use in In no event shall NXP Semiconductors be liable for any indirect, incidental, automotive applications to automotive specifications and standards, punitive, special or consequential damages (including - without limitation - customer (a) shall use the product without NXP Semiconductors’...
  • Page 54: Table Of Contents

    Please be aware that important notices concerning this document and the product(s) described herein, have been included in section 'Legal information'. © 2022 NXP B.V. All rights reserved. For more information, please visit: http://www.nxp.com Date of release: 16 December 2022 Document identifier: HRPNUG...

Table of Contents