Zynq UltraScale+ MPSoC 在linux系统运行R5 裸机程序 remoteproc - R5

参考文章:
ultrascale学习笔记之remoteproc启动R5
ZYNQ UltraScale+ MPSoC Linux + ThreadX AMP玩法

Zynq UltraScale+ MPSoC包含
Cortex™-A53 处理器和 Cortex™-R5 实时处理单元 。
移植完Linux系统,在系统上同时运行A53和R5 应用程序,重点是修改R5程序的起始地址。

vitis创建A53应用程序可以参考之前的文章
R5程序可以参考下边

选择创建应用程序,选择对应的平台,命名应用程序,选择r5处理器,没有选项要先选取最下方的√,
Zynq UltraScale+ MPSoC 在linux系统运行R5 裸机程序 remoteproc - R5_第1张图片
编译程序之前,需要修改R5运行的地址,与系统的设备树设置一致

Zynq UltraScale+ MPSoC 在linux系统运行R5 裸机程序 remoteproc - R5_第2张图片
mkdir -p /lib/firmware
cp app.elf /lib/firmware
cd /lib/firmware
echo app.elf > /sys/class/remoteproc/remoteproc0/firmware
echo start > /sys/class/remoteproc/remoteproc0/state
echo stop> /sys/class/remoteproc/remoteproc0/state

如果报错如下,可以查看程序启动地址psu_r5_ddr_0_MEM_0是否修改。
[ 9865.407270] remoteproc remoteproc0: bad phdr da 0x100000 mem 0x7d80
[ 9865.413543] remoteproc remoteproc0: Failed to load program segments: -22
[ 9865.421084] remoteproc remoteproc0: Boot failed: -22
-sh: echo: write error: Invalid argument

设备树文件:

/include/ "system-conf.dtsi"
/{ 
	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;
		rproc_0_reserved: rproc@0x42000000 {
 			no-map;
 			reg = <0x0 0x42000000 0x0 0x2000000>;
 		};

		a53_r5_reserved: r5@0x64000000 {
			no-map;
			reg = <0x0 0x64000000 0x0 0x2000000>;
		};
	};

	/* Shared memory */
	shm0: shm@44080000 {
		compatible = "shm_uio";
		reg = <0x0 0x44080000 0x0 0x1000000>;
	};

	/* IPI device */
	ipi_amp: ipi@ff340000 {
		compatible = "ipi_uio";
		reg = <0x0 0xff340000 0x0 0x1000>;
		interrupt-parent = <&gic>;
		interrupts = <0 29 4>;
	};

	tcm_0a@ffe00000 {
		no-map;
		reg = <0x0 0xffe00000 0x0 0x10000>;
		phandle = <0x40>;
		status = "okay";
		compatible = "mmio-sram";
	};
	
	tcm_0b@ffe20000 {
		no-map;
		reg = <0x0 0xffe20000 0x0 0x10000>;
		phandle = <0x41>;
		status = "okay";
		compatible = "mmio-sram";
	};

	zynqmp-rpu {
 		compatible = "xlnx,zynqmp-r5-remoteproc";
		xlnx,cluster-mode = <1>;
		ranges;
		reg = <0x0 0xFF9A0000 0x0 0x10000>;
 		#address-cells = <2>;
 		#size-cells = <2>;		
 
 		r5_0: r5@0 {
			compatible = "xilinx,r5f";
			#address-cells = <2>;
 			#size-cells = <2>;
 			ranges;
			sram = <0x40 0x41>;
			memory-region = <&rproc_0_reserved>;
			power-domain = <0x7>;
 		};
	};
};
&ttc0 {
        /* compatible = "ttc"; timer@ff110000 */
        status = "okay";
};
&ttc1 {
        /* compatible = "ttc"; timer@ff120000 */
        status = "okay";
};

你可能感兴趣的:(linux,arm)