*

OpenAMP on i.MX8 – Yocto Linux with FreeRTOS #3

   

Build and Setup

For i.MX8MQ Yocto, Prebuilt binaries for M4 cores will available in deploy/images/ directory. This can be used for testing the RPMsg functionality in i.MX8MQ EVK.

Here we are not mentioning the yocto setup and compilation. There are well made documentations from NXP available on this subject.

For downloading the latest source code of FreeRTOS for i.MX8MQ, we have to use MCUExpresso SDK generator online tool. Below is the link:

https://mcuxpresso.nxp.com/en/select

Using this online SDK builder, we will be able to make a freeRTOS SDK with options to select the compiler (GCC/ IAR) as well as components and capabilities required in FreeRTOS.

Here we select FreeRTOS for GCC with USB and multicore communications as option.

Steps included:
  1. Downloading the FreeRTOS SDK for GCC,
  2. Download toolchain that supports FreeRTOS.

The compiler tested is gcc-arm-none-eabi-9-2019. This can be downloaded from https://launchpad.net/gcc-arm-embedded.

Toolchain setup

Create a new system environment variable and name it ARMGCC_DIR. The value of this variable should point to the Arm GCC Embedded tool chain installation path.

For this example, the path is:

$ export ARMGCC_DIR=/home/lineo/i.MX8MQ/FreeRTOS/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major

$ export PATH= $PATH:/home/lineo/i.MX8MQ/FreeRTOS/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major/bin

Building RPMSG-lite sample application

 Steps include:

  1. Change the directory to the application project directory, which has a path similar to the following:

<install_dir>/boards/boards/evkmimx8mq/multicore_examples/rpmsg_lite_str_echo_rtos/armgcc

  1. Run “./build_all.sh”

This will compile and create binaries. The binaries will be available as /home/lineo/i.MX8MQ/SDK_2.6.0_EVK-MIMX8MQ/boards/evkmimx8mq/multicore_examples/rpmsg_lite_str_echo_rtos/armgcc/release/rpmsg_lite_str_echo_rtos_imxcm4.bin

Testing

Make sure that Debug cable is connected. There will be two ttyUSB devices available. One will be for A53 and other for M4 cores.

  1. Stop at u-boot to boot the RPMsg binary in M4 core using bootaux command.
  2. Change the device tree for Linux to M4 device tree. This is already available in BSP. This is only device tree that supports RPMsg support.

             Use the following commands to set the device tree:

             $setenv fdt_file fsl-imx8mq-evk-m4.dtb

              $sav

  1. Copy the binary (rpmsg_lite_str_echo_rtos_imxcm4.bin) to boot partition of the sdcard.
  2. Use the following commands:

              $fatload mmc 1:1 0x7e0000 imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.binaries

              $dcache flush

              $bootaux 0x7e0000

                            This will boot the auxiliary core

              $boot

                            This will boot the Linux Core.

While linux boots, you could see a message as below in bootlogs (dmesg):

              “M4 is started”

  1. After booting completes use the following command to load the driver:

              $modprobe imx_rpmsg_tty

                            This will create a character device file for interaction.

  1. Use echo command to write to the file.

              $echo “this is a test” > /dev/ttyRPMSG30

                            This message will be printed at the M4 debug terminal.

NB: Most of the information (including images) are collected and consolidated from various online channels including “https://github.com/OpenAMP/” ,  NXP’s official documents, Wikipedia etc.

 - 未分類