核间通信openamp 在linux内核空间

Posted 为了维护世界和平_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了核间通信openamp 在linux内核空间相关的知识,希望对你有一定的参考价值。

简介

openamp是A53和R5核通信的工具


创建r5程序生成amp_wy1.elf

创建A53程序
在工程目录下,执行

petalinux-create -t apps --template install -n  appp --enable
cp /home/tea/share/AMP_Test.elf project-spec/meta-user/recipes-apps/<app-name>/files/

将R5的程序复制到此路径下

cp /home/wy/xilinx/amp_wy1.elf  project-spec/meta-user/recipes-apps/appp/files/

修改

SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://amp_wy1.elf" 
S = "${WORKDIR}"
INSANE_SKIP_${PN} = "arch"
do_install() {
 install -d ${D}/lib/firmware
 install -m 0644 ${S}/amp_wy1.elf ${D}/lib/firmware/amp_wy1.elf
}
FILES_${PN} = "/lib/firmware/amp_wy1.elf"

内核中添加驱动
project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

/include/ "system-conf.dtsi"
/ {
        reserved-memory {
                #address-cells = <2>;
                #size-cells = <2>;
                ranges;
                rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 {
                        no-map;
                        reg = <0x0 0x3ed40000 0x0 0x4000>;
                };
                rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 {
                        no-map;
                        reg = <0x0 0x3ed44000 0x0 0x4000>;
                };
                rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 {
                        no-map;
                        reg = <0x0 0x3ed48000 0x0 0x100000>;
                };
                rproc_0_reserved: rproc@3ed00000 {
                        no-map;
                        reg = <0x0 0x3ed00000 0x0 0x40000>;
                };
        };
 
        zynqmp-rpu {
                compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
                #address-cells = <2>;
                #size-cells = <2>;
                ranges;
                core_conf = "split";
                reg = <0x0 0xFF9A0000 0x0 0x10000>;
                r5_0: r5@0 {
                        #address-cells = <2>;
                        #size-cells = <2>;
                        ranges;
                        memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>;
                        pnode-id = <0x7>;
                        mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>;
                        mbox-names = "tx", "rx";
                        tcm_0_a: tcm_0@0 {
                                reg = <0x0 0xFFE00000 0x0 0x10000>;
                                pnode-id = <0xf>;
                        };
                        tcm_0_b: tcm_0@1 {
                                reg = <0x0 0xFFE20000 0x0 0x10000>;
                                pnode-id = <0x10>;
                        };
                };
        };
        zynqmp_ipi1 {
                compatible = "xlnx,zynqmp-ipi-mailbox";
                interrupt-parent = <&gic>;
                interrupts = <0 29 4>;
                xlnx,ipi-id = <7>;
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
                /* APU<->RPU0 IPI mailbox controller */
                ipi_mailbox_rpu0: mailbox@ff990600 {
                        reg = <0xff990600 0x20>,
                 <0xff990620 0x20>,
                 <0xff9900c0 0x20>,
                 <0xff9900e0 0x20>;
                        reg-names = "local_request_region",
                 "local_response_region",
                 "remote_request_region",
                 "remote_response_region";
                        #mbox-cells = <1>;
                        xlnx,ipi-id = <1>;
                };
        };
};

petalinux-build
modprobe zynqmp_r5_remoteproc
echo amp_wy1.elf > /sys/class/remoteproc/remoteproc0/firmware
echo start > /sys/class/remoteproc/remoteproc0/state

执行echo_test可执行文件

以上是关于核间通信openamp 在linux内核空间的主要内容,如果未能解决你的问题,请参考以下文章

ThreadX内核源码分析(SMP) - 核间通信(arm)

ThreadX内核源码分析(SMP) - 核间通信(arm)

linux内核分析作业:操作系统是如何工作的进行:完成一个简单的时间片轮转多道程序内核代码

ThreadX内核源码分析(SMP) - 核间互斥(arm)

例说linux内核与应用数据通信:映射设备内核空间到用户态

ThreadX内核源码分析(SMP) - 核间互斥(arm)