petalinux预留内存

最近在开发过程中,希望能保留一段内存不被系统使用,这样这段内存里面的数据就不会被系统程序修改。我使用的是xilinx zynqMP Soc系列的开发板,按照xilinx wiki 预留内存教程试了下。

步骤

1. 使用petalinux创建一个project

2. 修改设备树文件system-user.dtsi, 添加预留内存的设备树节点
(project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi)

3. petalinux-build

适用于 64-bit Cortex-A53 MPSoC的节点信息

reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;

reserved: buffer@0 {
no-map;
reg = <0x0 0x40000000 0x0 0x10000000>;
};
};

reserved-driver@0 {
compatible = "xlnx,reserved-memory";
memory-region = <&reserved>;
};

适用于32-bit Cortex-A9 Zynq的节点信息

reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

reserved: buffer@0x38000000 {
no-map;
reg = <0x38000000 0x08000000>;
};
};

reserved-driver@0 {
compatible = "xlnx,reserved-memory";
memory-region = <&reserved>;
};