QSXP/TX8P: Build and run of Multicore RPMsg-Lite demo for CM7

The Multicore RPMsg-Lite string echo project is a simple demonstration program that uses the MCUXpresso SDK software and the RPMsg-Lite library and shows how to implement the inter-core communicaton between cores of the multicore system.

It works with Linux RPMsg master peer to transfer string content back and forth. The name service handshake is performed first to create the communication channels. Next, Linux OS waits for user input to the RPMsg virtual tty. Anything which is received is sent to the CM7 core. The CM7 core sends a confirmation message via its local debug UART and echoes back the same message as an acknowledgement. The tty reader on the Linux side can get the message, and start another transaction. The demo demonstrates RPMsg’s ability to send arbitrary content back and forth.

precautions for the Linux build

The following precautions must be met to run the Multicore RPMsg-Lite demo:

  • the U-Boot must support the bootaux command

  • the Linux must provide imx_rpmsg_tty kernel module

  • the Linux device tree must support the Cortex®-M7 and reserved memory areas for communication of the two cores.

To support customers, Ka-Ro provides the distro feature copro. To add the distro feature to your build, go to your yocto build folder and open the file conf/bblayers.conf

then add these lines:

DISTRO_FEATURES:append = " copro"
KARO_BASEBOARD = "qsbase4"

please note

The baseboard definition in the example above is for the QSXP-module, mounted on a QSBASE4 eval kit. For a TX8P, a suitable baseboard would be the mainboard7. The KARO_BASEBOARD variable must be set to “mb7” in this case.

Furthermore, some special entries into the device tree are necessary. These are provided by the devicetree overlay karo-copro

To add the karo-copro overlay, the name of the copro-overlay should be added to the appropriate overlays_* variable:

setenv overlays_<baseboard> ${overlays_<baseboard>} karo-copro
saveenv
reset

Add clk_ignore_unused to the Linux boot arguments:

setenv append_bootargs debug clk_ignore_unused
saveenv

If you would like to suppress debug output replace debug by quiet in the Linux boot argument.

precautions for the CM7 firmware build

The multicore sample firmware uses a shared memory area between CA53 and CA7 for communication. Be sure that the CA7 uses the same memory area, as defined in the Linux device tree:

in board.h correct VDEV0_VRING_BASE and RESOURCE_TABLE_OFFSET:

/* Shared memory base for RPMsg communication. */
#define VDEV0_VRING_BASE      (0x81100000U)
#define RESOURCE_TABLE_OFFSET (0xFF000)

kick the CM7 coprocessor from Tightly-Coupled Memory (TCM)

Assuming the coprocessor firmware is stored in the bootfs partition, the coprocessor is booted with the following commands:

load mmc ${mmcdev}:1 ${loadaddr} rpmsg_lite_str_echo_rtos.bin
cp.b ${fileaddr} 0x7e0000 0x20000
bootaux 0x7e0000

kick the CM7 coprocessor from DRAM on a QSXP-ML81

Before the firmware is build for starting from DRAM, the linker skript must be modified according to the address buffers defined in the device tree:

/* -----------------------------------------------------------------------

Specify the memory areas

Cortex-M7 Memory map:
0x0000_0000   128kb     ITCM
0x2000_0000   128kb     DTCM
0x4000_0000   2gb       DDR Memory area

---------------------------------------------------------------------------*/

MEMORY
{
        m_interrupts          (RX)  : ORIGIN = 0x80000000, LENGTH = 0x00000400
        m_text                (RX)  : ORIGIN = 0x80000400, LENGTH = 0x001FFC00
        m_data                (RW)  : ORIGIN = 0x80200000, LENGTH = 0x00200000
        m_data2               (RW)  : ORIGIN = 0x80400000, LENGTH = 0x00C00000
}

Assuming the coprocessor firmware is stored in the bootfs partition, the coprocessor is booted with the following commands:

load mmc ${mmcdev}:1 0x80000000 rpmsg_lite_str_echo_rtos.bin
dcache flush
bootaux 0x80000000

When the CM7-core is started, it will output the message:

RPMSG String Echo FreeRTOS RTOS API Demo...

on the debug UART lpUART4.

Boot the Linux with the boot command from U-Boot. When Linux boots, and a rpmsg link will be established, the CM7-core will output:

Nameservice sent, ready for incoming messages...
Get Message From Master Side : "hello world!" [len : 12]

After Linux has booted to the end, be sure that the imx_rpmsg_tty kernel module is loaded:

modprobe imx_rpmsg_tty

you should now find a virtual device /dev/ttyRPMSG30.

You may now send strings to it, with the command:

echo <test string> > /dev/ttyRPMSG30