This document shows how to run the multicore communication examples from MCUXpresso SDK while running the Android BSP on Cortex-A7 on i.MX 7ULP-EVK.
Though this document is focused on the multicore demos, similar procedures can be applied to run any other demo in the SDK.
1. Source code
This document is based on the following releases:
| Board | Android BSP | MCUXpresso SDK |
|---|
| imx7ulp-evk | Android O8.1.0 for i.MX 7ULP GA | SDK2.4 for i.MX 7ULP GA |
Download releases at i.MX Software.
2. Building the Cortex-M4 SDK
There are at least two multicore demos in the SDK package, rpmsg_lite_pingpong_rtos and rpmsg_lite_str_echo_rtos. They are located at:
<SDK_2.4.0_EVK-MCIMX7ULP_dir>/boards/evkmcimx7ulp/multicore_examples/
Build the rpmsg_lite_str_echo_rtos demo according to the SDK Getting Started Guide. Remember to also follow the Chapter 6, Step 4 of the document to generate the ram bootable image (sdk20-app.img).
3. Building the Android BSP
3.1. RPMsg kernel module
Before building the BSP, add the following line to the BoardConfig.mk file (<android_build_dir>/device/fsl/evk_7ulp/BoardConfig.mk):
BOARD_VENDOR_KERNEL_MODULES += \
$(KERNEL_OUT)/drivers/net/wireless/qcacld-2.0/wlan.ko \
+ $(KERNEL_OUT)/drivers/rpmsg/imx_rpmsg_tty.ko
3.2. Cortex-M4 image
Copy the SDK image file (sdk20-app.img) to the following directory in the Android source code:
$ cp <SDK_2.4.0_EVK-MCIMX7ULP_dir>/tools/imgutil/evkmcimx7ulp/sdk20-app.img \
<android_build_dir>/vendor/nxp/fsl-proprietary/mcu-sdk/7ulp/sdk20-app.img
Change the BoardConfig.mk file accordingly:
# Copy prebuilt M4 demo image:
PRODUCT_COPY_FILES += \
- vendor/nxp/fsl-proprietary/mcu-sdk/7ulp/imx7ulp_m4_demo.img:imx7ulp_m4_demo.img
+ vendor/nxp/fsl-proprietary/mcu-sdk/7ulp/sdk20-app.img:imx7ulp_m4_demo.img
After these changes, build and flash Android as described in the BSP User's Guide.
4. Enabling the multicore communication
While booting, the SoC automatically loads the Cortex-M4 image.
After complete booting, install the imx_rpmsg_tty.ko module to create the multicore communication channel:
$ su
$ insmod vendor/lib/modules/imx_rpmsg_tty.ko
To send messages from Cortex-A7 to Cortex-M4, use the /dev/ttyRPMSG* channel:
$ echo "MESSAGE" > /dev/ttyRPMSG*
/dev/ttyRPMSG* refers to the RPMsg device created on the board, so change the number accordingly.
Cortex-M4 will echo all messages received from Cortex-A7.
This is a simple example on how to communicate different cores on i.MX using Android but it can be used as a starting point for Android multicore applications.