Skip to content

Build_and_run_example

Ray Chang edited this page Mar 12, 2021 · 20 revisions

Example 1: Build and run hello_world example

Build hello_world application:

First, ensure you export the environment variable ARMGCC_DIR which is pointed to directory of tool chain.

cd freertos-tn/boards/${board_name}/demo_apps/hello_world/armgcc/
/build_release.sh

Copy binary file to 1st FAT partition of eMMC:

( Please refer to Use UMS to Update kernel and resize partition )

cp ./release/hello_world.bin ${FAT partation}

Run hello_world example

In u-boot prompt:

Choose to load dts with cortex-m4 support.

setenv fdt_file imx8mq-pico-pi-m4.dtb
setenv m4image hello_world.bin
run m4boot

Choose to load dts with cortex-m7 support.

setenv fdt_file imx8mp-edm-g-wb-rpmsg.dtb
setenv m7image hello_world.bin
run m7boot

You should see the following output from debug console: m4_example_helloworld_result.png

Example 2: Build and run rpmsg_lite_str_echo_rtos example

Build rpmsg_lite_str_echo_rtos application:

First, ensure you export the environment variable ARMGCC_DIR which is pointed to directory of tool chain.

cd freertos-tn/boards/${board_name}/multicore_examples/rpmsg_lite_str_echo_rtos/linux_remote/armgcc
./build_release.sh

Copy binary file to 1st FAT partition of eMMC:

( Please refer to Use UMS to Update kernel and resize partition )

cp ./release/rpmsg_lite_str_echo_rtos_imxcm4.bin ${FAT partation}

Run rpmsg_lite_str_echo_rtos example

In u-boot prompt:

Choose to load dts with cortex-m4 support.

setenv fdt_file imx8mq-pico-pi-m4.dtb
setenv m4image rpmsg_lite_str_echo_rtos_imxcm4.bin
run m4boot
boot

Choose to load dts with cortex-m7 support.

setenv fdt_file imx8mp-edm-g-wb-rpmsg.dtb
setenv m7image rpmsg_lite_str_echo_rtos.bin
run m7boot

In Yocto prompt:

modprobe imx_rpmsg_tty
echo "this is a test" > /dev/ttyRPMSG30

You should see the following output from debug console: m4_example_strecho_result.png

Example 3: Build and run rpmsg_lite_pingpong_rtos example

Build rpmsg_lite_pingpong_rtos application:

First, ensure you export the environment variable ARMGCC_DIR which is pointed to directory of tool chain.

cd freertos-tn/boards/${board_name}/multicore_examples/rpmsg_lite_pingpong_rtos/linux_remote/armgcc
./build_release.sh

Copy binary file to 1st FAT partition of eMMC:

( Please refer to Use UMS to Update kernel and resize partition )

cp ./release/rpmsg_lite_pingpong_rtos_linux_remote.bin ${FAT partation}

Run rpmsg_lite_pingpong_rtos example

In u-boot prompt:

Choose to load dts with cortex-m4 support.

setenv fdt_file imx8mq-pico-pi-m4.dtb
setenv m4image rpmsg_lite_pingpong_rtos_linux_remote.bin
run m4boot
boot

Choose to load dts with cortex-m7 support.

setenv fdt_file imx8mp-edm-g-wb-rpmsg.dtb
setenv m7image rpmsg_lite_pingpong_rtos_linux_remote.bin
run m7boot

In Yocto prompt:

modprobe imx_rpmsg_pingpong

You should see the following output from debug console: m4_example_pingpong_result.png

Troubleshooting:

Check kernel message to ensure if the RPMSG driver is initialized properly.

# dmesg
[    0.428890] imx rpmsg driver is registered.
[    0.440127] imx8mq-pinctrl 30330000.iomuxc: initialized IMX pinctrl driver
[    0.454069] MU is ready for cross core communication!
[    0.458000] virtio_rpmsg_bus virtio0: rpmsg host is online

If there is no information about RPMSG driver, check if you load the correct device tree for M4.