How to Establish Shared Memory Communication Between Cortex-M7 and Cortex-A53 on Verdin iMX8MP

Hello,

I’m currently working on the Verdin iMX8M Plus V1.1E module and have successfully run the hello_world demo from the MCUXpresso SDK for the Cortex-M7 core. I’m able to see the expected UART output on the UART_4 console, which confirms the M7 core is up and running properly.

As the next step, I would like to establish communication between the Cortex-M7 and the Cortex-A53 (Linux) using shared memory.

I have a few questions regarding this:

  1. What is the recommended method or example project for implementing shared memory-based communication between M7 and A53 on Verdin iMX8MP?
  • Is RPMsg the preferred way?
  • Is there any support in the MCUXpresso SDK or Yocto BSP for this?
  1. How can I configure and reserve a region of memory to be used as shared memory between the A53 and M7?
  • Do I need to modify the device tree or U-Boot environment?
  • Any example of how to reserve memory for M7 firmware and shared memory?
  1. Are there any ready-to-use examples (like rpmsg_lite or rpmsg_lite_str_echo) that I can build and run on the M7 side from the MCUXpresso SDK that demonstrate shared memory communication?
  2. What drivers or user-space tools are available on the Linux side to communicate with the M7 via RPMsg or other shared memory mechanisms?

Any guidance, sample code, or links to documentation would be greatly appreciated.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello,

Thank you for your detailed questions! Here are comprehensive answers to your points regarding inter-core (Cortex-M7 ↔ Cortex-A53) communication on the Verdin iMX8M Plus:


1. Recommended Method for Shared Memory Communication (M7 ↔ A53)

RPMsg is the recommended method for communication between Cortex-M7 (running FreeRTOS or bare-metal from MCUXpresso SDK) and Cortex-A53 (running Linux) on the Verdin iMX8M Plus. RPMsg leverages a shared memory region transparently, simplifying message-passing for inter-core communication.

  • MCUXpresso SDK provides ready-to-use RPMsg examples.
  • Yocto BSP for Toradex (with Torizon or Reference Images) includes kernel support and user-space tools for RPMsg.

More details and examples here:


2. Configuring and Reserving Shared Memory

You typically do not need to manually modify the device tree or U-Boot for standard RPMsg communication. The memory layout is managed by the SoC’s architecture and system firmware.

  • Device tree overlay: For standard operation, enable the overlay:

    verdin-imx8mm_hmp_overlay.dtbo
    

    This overlay ensures the correct resources (including memory regions) are reserved for both the Cortex-M7 and RPMsg communication.

  • Automatic base address: Shared memory for RPMsg is automatically configured. For RPMsg-Lite, the base in provided examples is 0xb8000000.

  • If you need to modify reserved memory (for custom use-cases beyond RPMsg), you would do so in the device tree under the reserved-memory node. However, this is not needed for default RPMsg communication.

Documentation on setting up memory for M7 firmware and shared memory:


3. Ready-to-Use Examples (rpmsg_lite) from the MCUXpresso SDK

Yes, there are ready-to-use examples in the MCUXpresso SDK, under the multicore_examples directory:

  • RPMsg TTY Example:
    Path: ./boards/evkmimx8mp/multicore_examples/rpmsg_lite_str_echo_rtos

    • Demonstrates message-passing with the Linux side via /dev/ttyRPMSG30.
  • RPMsg Ping-Pong Example:
    Path: ./boards/evkmimx8mp/multicore_examples/rpmsg_lite_pingpong_rtos

    • Shows request-response style communication with the Linux kernel’s imx_rpmsg_pingpong module.

Build instructions and environment setup:


4. Linux Side: Drivers and User-space Tools

On the Linux side, you interact with the RPMsg framework using kernel modules and device nodes:

  • Kernel Modules:

    • Load with:
      sudo modprobe imx_rpmsg_tty
      
    • This will create a device node: /dev/ttyRPMSG30
  • User-space Communication:

    • Use standard tools (cat, echo, or custom programs) to communicate via /dev/ttyRPMSG30.
    • For more complex communication, the generic RPMsg character device framework may be used as well.

Check if the RPMsg driver is loaded:

dmesg | grep -i rpmsg

Further details on Linux-side operation:


Summary:

  • Use RPMsg as provided by MCUXpresso SDK for M7 ↔ A53 communication.
  • No extra memory reservation is needed for standard RPMsg; just enable the HMP device tree overlay.
  • MCUXpresso SDK offers sample projects (rpmsg_lite_str_echo_rtos, rpmsg_lite_pingpong_rtos).
  • On Linux, use imx_rpmsg_tty and /dev/ttyRPMSG30 for user-space messaging.

If you need any step-by-step guides on building or running these examples, let me know!

Best regards,
Toradex AI Assistant.

Hi @prem0919!

The Toradex AI answer is a good starting point. Were you able to test one of its suggestions?

I would recommend checking the verdin-imx8mp_hmp_overlay.dts overlay, which defines some memory regions used in the communication between Cortex A and Cortex M.

Regarding examples, you could use and test the examples provided by the MCUXpresso (as the AI said).

Feel free to ask if you face any doubts or issues.

Best regards.