Executing RPMsg Samples
From OMAPpedia
Contents |
[edit] Setting Up FileSystem
[edit] Android FS
[edit] Setup FS
Please refer either to the Android project page or browse through the all the Android pages to get started on Android.
The following assumes that you have a pre-built Android FS and is able to successfully boot Android 4.0 on a target device, and you could use adb.
[edit] Copy Files
- The firmware folder is at a different location in Android FS. It is typically /system/vendor/firmware. You can push a custom firmware binary after making sure the particular folder can be written to
bash$ adb root restarting adbd as root bash$ adb remount remount succeeded bash$ adb push my-custom-ducati.bin /system/vendor/firmware/ducati-m3.bin 2835 KB/s (331336 bytes in 0.114s)
- Push any sample executables to /system/bin folder.
- Push the rpmsg kernel sample modules to /system/lib folder
[edit] BusyBox
RPMsg samples can be readily executed on a small BusyBox filesystem, after configuring the udev or mdev in your FS properly. The following assumes that your Linux PC is configured to perform NFS boot, and the required options are enabled while building your kernel. See this section for details.
[edit] Configure udev/mdev
The filesystem must have one of mdev or udev to successfully load the remoteproc firmware binaries. Check the /sbin directory for one of those within your Busybox FS.
If you have trouble, check the init scripts in /etc/init.d to see if the kernel is programmed to use mdev or udev. There is a /proc entry where the path of the loader executable is written. Without this the kernel will not be able to call the firwmware loader. For example,
init.d/rcS: echo "/sbin/mdev" > /proc/sys/kernel/hotplug
[edit] Configure DebugFS
The debugfs can be auto-mounted in your Busybox filesystem. It can go anywhere, but the following examples are illustrated using /debug. Follow this procedure to have it automatically mounted:
bash$ cd <my-busybox-fs> bash$ mkdir /debug bash$ vi /etc/fstab
Add this line to the fstab file.
debugfs /debug debugfs defaults 0 0
[edit] Copy Files
- Copy any sample executables to a folder in the PATH variable (like /bin or /usr/bin), or add it to a custom folder and add the custom folder to your PATH folder.
- Copy the rpmsg kernel sample modules to any folder for using insmod or install modules for using modprobe.
[edit] Angstrom FS
Angstrom FS provides a prebuilt configured filesystem, avoiding the need to configure udev or mdev. Running RPMsg samples on Angstrom FS is very similar to running the samples on a BusyBox FS. The following assumes that your Linux PC is configured to perform NFS boot, and the required options are enabled while building your kernel.
[edit] Build FS
- A minimal udev-ready FS can be readily built from Angstrom builer by using the following options:
Base Settings:- Select the machine you want to build your rootfs image for: pandaboard Choose your image name: my-angstrom-fs Choose the complexity of the options below: simple User environment selection:- Console Only Build Me!
- Download the generated tarball onto your Linux PC, and untar it into an appropriate NFS-bootable location.
[edit] Copy Files
- You can copy the ducati firmware binary into the firmware folder, typically <my-angstrom-fs>/lib/firmware.
bash$ cp my-custom-ducati.bin <my-angstrom-fs>/lib/firmware/ducati-m3.bin
- Copy any sample executables to a folder in the PATH variable (like /bin or /usr/bin), or add it to a custom folder and add the custom folder to your PATH folder.
- Copy the rpmsg kernel sample modules to /lib/modules folder
[edit] Install RPMsg Driver
The following assumes that you have built your kernel driver as modules. If you have the rpmsg driver built-into the kernel, it is expected that the FS have all been configured properly with the firmware binaries in place. The rpmsg driver gets initialized during kernel boot, and the remote processors get loaded with the firmware binaries.
- Install the absolute necessary kernel modules - virtio_rpmsg_bus, omap_rpmsg, rpmsg_omx and rpmsg_resmgr. The following is the sample kernel traces.
[edit] Execute Samples
[edit] Kernel RPMsg Server Sample
The RPMsg Server sample is implemented as a module. It will send 100 messages. The sample requires that the ducati-m3.bin is generated using the test_omx_sysm3.xem3 or test_omx_appm3.xem3 as one of the base images.
- Execution starts when the module is loaded.
modprobe rpmsg_server_sample
or
insmod <module root in fs>/rpmsg_server_sample.ko
- Sample output here:
. . . omap-rproc omap-rproc.1: remote processor ipu is now up omap_rpmsg_mbox_callback: received echo reply from ipu ! omap_rpmsg_mbox_callback: received echo reply from ipu ! omap_rpmsg_mbox_callback: received echo reply from ipu ! omap_rpmsg_mbox_callback: received echo reply from ipu ! virtio_rpmsg_bus virtio0: creating channel rpmsg-client-sample addr 0x32 rpmsg_server_sample rpmsg0: incoming msg 1 (src: 0x32) virtio_rpmsg_bus virtio0: creating channel rpmsg-client-sample addr 0x33 virtio_rpmsg_bus virtio0: creating channel rpmsg-omx addr 0x3c rpmsg_server_sample rpmsg0: incoming msg 2 (src: 0x32) virtio_rpmsg_bus virtio1: creating channel rpmsg-client-sample addr 0x32 virtio_rpmsg_bus virtio1: creating channel rpmsg-client-sample addr 0x33 virtio_rpmsg_bus virtio1: creating channel rpmsg-omx addr 0x3c rpmsg_server_sample rpmsg0: incoming msg 3 (src: 0x32) rpmsg_server_sample rpmsg0: incoming msg 4 (src: 0x32) rpmsg_server_sample rpmsg0: incoming msg 5 (src: 0x32) rpmsg_server_sample rpmsg0: incoming msg 6 (src: 0x32) . . .
- To rerun the sample, the module needs to be removed and reinstalled (repeat step. #1)
modprobe -r rpmsg_client_sample
or
rmmod rpmsg_client_sample
[edit] Kernel RPMsg Client Sample
The RPMSG client sample is also implemented as a kernel module, and requires the same base images as the RPMsg kernel sample. It will send 100 messages.
- Execution starts when the module is loaded.
modprobe rpmsg_client_sample
or
insmod <module root in fs>/rpmsg_client_sample.ko
- Sample output here:
. . . rpmsg_dev_probe rpmsg_client_sample rpmsg1: new channel: 0x401 <-> 0x32! rpmsg_dev_probe rpmsg_client_sample rpmsg2: new channel: 0x402 <-> 0x33! rpmsg_client_sample rpmsg1: incoming msg 1 (src: 0x32) rpmsg_dev_probe rpmsg_client_sample rpmsg4: new channel: 0x401 <-> 0x32! rpmsg_dev_probe rpmsg_client_sample rpmsg5: new channel: 0x402 <-> 0x33! rpmsg_client_sample rpmsg2: incoming msg 2 (src: 0x33) rpmsg_client_sample rpmsg1: incoming msg 3 (src: 0x32) rpmsg_client_sample rpmsg4: incoming msg 4 (src: 0x32) rpmsg_client_sample rpmsg5: incoming msg 5 (src: 0x33) rpmsg_client_sample rpmsg2: incoming msg 6 (src: 0x33)
- To rerun the sample, the module needs to be removed and reinstalled (repeat step #1)
modprobe -r rpmsg_client_sample
or
rmmod rpmsg_client_sample
[edit] OMX Sample
The OMX Sample is hosted within the SYS/BIOS RPMsg tree in the src/host folder, as there is no separate tree to host user-side samples/tests. The OMX sample uses the rpmsg_omx kernel module, and a ducati-m3.bin generated using the test_omx_sysm3.xem3 or test_omx_appm3.xem3 as one of the base images.
[edit] Build
A quick README in the tree gives the basic steps for building the sample.
- For Linux, after copying the relevant files, you could build using
arm-none-linux-gnueabi-gcc omx_sample.c -o omx_sample -lpthread
- For Android, you need to either build it using an Android.mk file and build it in an existing userspace directory, or you could build within the kernel using static linkage to remove any external dependencies from Android FS.
arm-none-linux-gnueabi-gcc omx_sample.c -o omx_sample -lpthread --static
- Copy the resulting omx_sample binary to the target filesystem bin folder.
[edit] Execution
To execute the sample run the following commands, once all the rpmsg kernel modules are loaded:
# ./omx_sample [<iterations>]
Following is a sample output:
# ./omx_sample 10 omx_sample: Connected to OMX omx_sample (1): OMX_GetHandle (H264_decoder). omx_sample (1): Got omx_handle: 0x5c0ffee5 omx_sample(1): OMX_SetParameter (0x5c0ffee5) omx_sample (1): Got result 0 omx_sample (2): OMX_GetHandle (H264_decoder). omx_sample (2): Got omx_handle: 0x5c0ffee5 omx_sample(2): OMX_SetParameter (0x5c0ffee5) omx_sample (2): Got result 0 omx_sample (3): OMX_GetHandle (H264_decoder). omx_sample (3): Got omx_handle: 0x5c0ffee5 omx_sample(3): OMX_SetParameter (0x5c0ffee5) omx_sample (3): Got result 0 omx_sample (4): OMX_GetHandle (H264_decoder). omx_sample (4): Got omx_handle: 0x5c0ffee5 omx_sample(4): OMX_SetParameter (0x5c0ffee5) omx_sample (4): Got result 0 omx_sample (5): OMX_GetHandle (H264_decoder). omx_sample (5): Got omx_handle: 0x5c0ffee5 omx_sample(5): OMX_SetParameter (0x5c0ffee5) omx_sample (5): Got result 0 omx_sample (6): OMX_GetHandle (H264_decoder). omx_sample (6): Got omx_handle: 0x5c0ffee5 omx_sample(6): OMX_SetParameter (0x5c0ffee5) omx_sample (6): Got result 0 omx_sample (7): OMX_GetHandle (H264_decoder). omx_sample (7): Got omx_handle: 0x5c0ffee5 omx_sample(7): OMX_SetParameter (0x5c0ffee5) omx_sample (7): Got result 0 omx_sample (8): OMX_GetHandle (H264_decoder). omx_sample (8): Got omx_handle: 0x5c0ffee5 omx_sample(8): OMX_SetParameter (0x5c0ffee5) omx_sample (8): Got result 0 omx_sample (9): OMX_GetHandle (H264_decoder). omx_sample (9): Got omx_handle: 0x5c0ffee5 omx_sample(9): OMX_SetParameter (0x5c0ffee5) omx_sample (9): Got result 0 omx_sample (10): OMX_GetHandle (H264_decoder). omx_sample (10): Got omx_handle: 0x5c0ffee5 omx_sample(10): OMX_SetParameter (0x5c0ffee5) omx_sample (10): Got result 0 omx_sample: Closed connection to OMX!
[edit] RPMsg ResMgr Sample
RPMsg supports resource (IVA, FDIF, GPT,etc) requests from the remote processors through the rpmsg_resmgr kernel module. This sample validates the request and release of resources, and also to test any PM constraints like Latency, BandWidth or Frequency on some of these constraints.
[edit] Build
The RPMsg ResMgr Sample also leverages the same base images as the RPMsg kernel or client samples. However, the resource manager task must be enabled specifically in the SYS/BIOS RPMsg sample source code. This is currently commented out since test_omx_sysm3.xem3 is being used as the default baseimage in various product releases, and enabling the task may conflict with actual MM usecases.
To enable it, edit sysbios-rpmsg/src/ti/examples/srvmgr/test_omx.c. At the end of the file, change the #if to include start_resmgr_task().
#if CORE0 /* Run a background task to test rpmsg_resmgr service */ start_resmgr_task(); #endif
[edit] Execution
The sample is executed when rpmsg_resmgr module is installed
modprobe rpmsg_resmgr
The example output below may not be exactly what you will get. Other resources may be omitted or added, or traces may be disabled. Console output:
omap_hwmod: iva: failed to hardreset omap_device: rpres.0: new worst case activate latency 0: 255645751 omap_hwmod: iva_seq0: failed to hardreset omap_device: rpres.1: new worst case activate latency 0: 257904052 omap_hwmod: iva_seq1: failed to hardreset
Printing the trace0 output shows the following:
# cat /sys/kernel/debug/remoteproc/omap-rproc.1/trace0 CORE0 starting.. 4 resources at 0x8006a000 copyTask 50: Entered...: VirtQueue_startup: buf_addr address of 0xa0000000 received MessageQCopy_create endPt created: 50 registering rpmsg-client-sample service on 50 with HOST MessageQCopy_send: no object for endpoint: 53 copyTask 51: Entered...: MessageQCopy_create endPt created: 51 registering rpmsg-client-sample service on 51 with HOST Connecting to resmgr server ... MessageQCopy_create endPt created: 101 MessageQCopy_create endPt created: 60 serviceMgr: started on port: 60 registering rpmsg-omx service on 60 with HOST ...connected to resmgr server. Requesting IPU status -7 Requesting GPT 3 status -7 Releasing GPT 3 Requesting gpio 50 status 0 Releasing gpio 50 Requesting 5 sdma channels status 0 Releasing 5 sdma channels Requesting IVAHD status 0 Requesting IVASEQ0 status 0 Requesting IVASEQ1 status 0 Requesting SL2IF status 0 Releasing IVASEQ1 Releasing IVASEQ0 Releasing SL2IF Releasing IVAHD Requesting ISS status 0 Releasing ISS