RPMsg_Kernel_Client_Application

来源:互联网 发布:内容发布系统cms 编辑:程序博客网 时间:2024/06/03 21:25

http://processors.wiki.ti.com/index.php/RPMsg_Kernel_Client_Application

Contents

 [hide] 
  • 1 Introduction
  • 2 Requirements
  • 3 Build
    • 3.1 Linux client app
    • 3.2 SYS/BIOS slave app
  • 4 Run
    • 4.1 Slave-side app
    • 4.2 Linux-side app

Introduction

The page illustrates how to build and run an rpmsg Linux kernel space client to communicate with a slave processor (e.g. DSP, IPU, etc) using IPC's RPMessage module.

Generally it is recommended to perform core-to-core communication from user space, typically using MessageQ. User space is a more application-friendly environment without GPL constraints, and with fewer compatibility breaks between kernel releases. But some use cases may require kernel space IPC, so this article describes how that can be done.

Requirements

  • IPC 3.10.02 or greater
  • Linux Kernel with rpmsg and Remoteproc features enabled

Build

This section outlines how to build both the Linux kernel rpmsg client and corresponding RPMessage slave-side application.

Linux client app

Recent Linux kernel releases contain an rpmsg client sample that can be built as a module. As of Linux kernel version 3.11 or less, the rpmsg client sample build is broken and requires some manual steps to build.

The Linux-side sample module is located in the samples/rpmsg directory of the Linux kernel sources.

Edit the Makefile in the samples/rpmsg directory to include only the following line:

obj-m := rpmsg_client_sample.o

NOTE: The $(CONFIG_SAMPLE_RPMSG_CLIENT) string was replaced with m in the Makefile.

Issue the following command to build the application as a module. Replace the variables below to the appropriate location of the Linux kernel sources and the ARM's cross-compiler tools.

make -C $(KERNEL_INSTALL_DIR) M=$(KERNEL_INSTALL_DIR)/samples/rpmsg ARCH=arm CROSS_COMPILE=$(TOOLCHAIN_INSTALL_DIR)/bin/arm-none-linux-gnueabi- modules

This results with an rpmsg_client_sample.ko file located in the samples/rpmsg directory of your Linux kernel. Copy the file to your device’s file-system.

SYS/BIOS slave app 

The IPC distribution contains a corresponding RPMessage based slave application. Follow the IPC Install Guide for building the SYS/BIOS-side of IPC appropriate for your device. Once the build completes, navigate to the $(IPC_INSTALL_DIR)/packages/ti/ipc/tests/bin/<PLATFORM> directory. There you will find an ping_tasks.x<suffix> file. Copy the file to your device's file-system.

Run

This section outlines how to load and run the previous built applications.

Slave-side app

The Linux kernel's remoteproc features are used to load the slave core(s). The slave core binary(s) must be copied into the /lib/firmware directory of your device's file-system and renamed appropriately for the target device.

For DRA7XX, the files should be as follows:

dra7-dsp1-fw.xe66dra7-dsp2-fw.xe66dra7-ipu1-fw.xem4dra7-ipu2-fw.xem4

Execute the following to load the slave core(s) on your target's file-system.

target# modprobe remoteproctarget# modprobe omap_remoteproc

The slave-core application(s) are now loaded.

Linux-side app

The Linux kernel's rpmsg driver must be installed onto the running kernel assuming the driver has been built as the kernel module. To install in, execute the following on the target.

target# modprobe rpmsg_proto

The rpmsg client application is implemented as a kernel module. It's written to send/receive 100 messages from the slave core(s). To run the rpmsg client module, execute the following on the target.

 target# modprobe rpmsg_client_sample

or

target# insmod rpmsg_client_sample.ko

The output should resemble the following:

rpmsg_client_sample rpmsg0: new channel: 0x400 -> 0x32!rpmsg_client_sample rpmsg1: new channel: 0x401 -> 0x33!rpmsg_client_sample rpmsg0: incoming msg 1 (src: 0x32)rpmsg_client_sample rpmsg0: incoming msg 2 (src: 0x32)rpmsg_client_sample rpmsg0: incoming msg 3 (src: 0x32)...

To re-run the application, the module needs to be removed and re-installed (repeat step above).

 target# modprobe -r rpmsg_client_sample

or

target# rmmod rpmsg_client_sample

0 0
原创粉丝点击