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.
This document is based on the following releases:
Download releases at i.MX Software.
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:
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).
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
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.
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.
"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)."
could you please upload the guide. how to make a ram bootable image ?
You can download the SDK source code and documentation at Welcome | MCUXpresso SDK Builder and follow the Getting Started Guide.
You can also refer to How to build and flash a bootable image for Cortex-M4 on i.MX 7ULP - i.MXDev Blog . This document refers to an old SDK version but the procedure is pretty similar to the latest ones.
Hi Vanessa Maegima ,
Will you please tell me. How we can achieve the same procedure for IMX8QM-MEK with Android 9 Automotive.
It should be a similar procedure but I have not tested Android Auto myself.
I intend to take a look in the following weeks.
Thank you Vanessa Maegima
is it the same procedure for i.MX8MM EVK? i made the changes to BoardConfig.mk to add the kernel objects, but it wont show up in /vendor/lib/modules
It should be a similar procedure for 8MM as well, but for iMX8* the M4 bin should be embedded in the boot image through imx-mkimage.Regarding the linux modules, please try the same with the imx_rpmsg_pingpong module.
could you provide me the procedure to embed the M4 bin image for iMX8MM? Also, don't i need to change the dtb image to support M4 to test this out? if so, that change is needed in BOARD_PREBUILT_DTBOIMAGE flag in BoardConfig.mk?
Is there a way to boot the iMX 8 Nano evaluation board cores with FreeRTOS(M7) and Andorid OS(A53) separately?
Sorry, just checked and there's no M4 target in imx-mkimage for 8MM.
Indeed you have to change your dtb file to the rpmsg one.
To load M4 bin in the boot, you can add Uboot commands to load your binary from a FAT partition as described in the SDK Getting Started:
Add the commands above to imx8mm_evk_android.h\configs\include - uboot-imx - i.MX U-Boot and make sure you copy your M4 bin to a FAT partition of the output image in evk_8mm.mk.
I have not tested this procedure on iMX8* targets.
Please refer to the SDK Getting Started Guide for all the supported ways to boot the M7 core.
Ok thanks, I have a couple of questions
1. Should I boot an image of an RTOS on the M7 architecture before running the demo SDK?
2. Also if the above is not true, the SDK says to just boot the device, use IAR IDE(build) and JLink debugger to check the output of a demo application, hello world. The Jlink debugger does not detect the board, though the Putty terminal detects it. What do you propose the issue for the same is?
No need, the demo SDK already includes the RTOS code.
If Putty recognizes the devide, please try the Uboot approach to boot the M7 core instead of IAR's method.
Thanks for your help. I will try running it through Uboot. I appreciate your help