Using Cortex-M4 SDK to communicate with Cortex-A7 Android BSP on i.MX 7ULP-EVK

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Cortex-M4 SDK to communicate with Cortex-A7 Android BSP on i.MX 7ULP-EVK

Using Cortex-M4 SDK to communicate with Cortex-A7 Android BSP on i.MX 7ULP-EVK

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:

BoardAndroid BSPMCUXpresso SDK
imx7ulp-evkAndroid O8.1.0 for i.MX 7ULP GASDK2.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.

Labels (1)
Comments

"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 ?

Hi ducan.duan@vantrontech.com‌,

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.


Thanks,

Vanessa

Hi Vanessa Maegima ,

Will you please tell me. How we can achieve the same procedure for IMX8QM-MEK with Android 9 Automotive.

Regards,

Vinoth S,

Hi vinothkumars‌,

It should be a similar procedure but I have not tested Android Auto myself.

I intend to take a look in the following weeks.

Thanks,

Vanessa

Thank you Vanessa Maegima

Vinoth S,

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?

Hi Siva,

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:

Screenshot from 2020-08-21 09-56-54.png

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.

Thanks,
Vanessa

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?

1. Should I boot an image of an RTOS on the M7 architecture before running the demo SDK?

No need, the demo SDK already includes the RTOS code.

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?

If Putty recognizes the devide, please try the Uboot approach to boot the M7 core instead of IAR's method.

Thanks,
Vanessa

Thanks for your help. I will try running it through Uboot. I appreciate your help

Thanks,

Anurag

Version history
Revision #:
2 of 2
Last update:
3 weeks ago
Updated by:
 
Contributors