如何解决无法在 Petalinux2020.2 上预留内存?
我正在使用 petalinux2020.2 和 RFSOC、zcu111 板构建一个项目,对于我的应用程序,我需要从 petalinux 保留一部分内存以用于 DMA,在 FPGA 的可编程逻辑上实现。 我尝试遵循 this tutorial,但在启动时出现错误。
以内核恐慌终止,如下所示: 我尝试使用 petalinux-config 命令修改内存大小,将内存大小设置为 0x70000000,但没有帮助。
此处显示了设备树的条目:
/include/ "system-conf.dtsi"
/{
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
reserved: buffer@0 {
no-map;
reg = <0x0 0x70000000 0x0 0x10000000>;
};
};
reserved-driver@0 {
compatible = "xlnx,reserved-memory";
memory-region = <&reserved>;
};
};
我怎样才能做到这一点?
解决方法
我在 Zynq-7020 板上运行 PetaLinux 2018.1,可以成功为我的 DMA 操作保留内存。虽然不是您的确切设置,但它应该足够相似。您需要调整内存地址以适合您的系统。
我正在使用 DMA API“shared-dma-pool”属性。这样我的设备驱动程序将使用我的保留空间而不是默认的 CMA 池。
另外,请注意,在将 vmalloc=512M 语句添加到 bootargs 之前,我在保留内存时遇到了问题。虽然我只为 DMA 保留了 256MB,I needed to vmalloc a larger value(在我的情况下是两倍)来让事情工作。
我的设备树条目:
/include/ "system-conf.dtsi"
/ {
chosen {
bootargs = "console=ttyPS0,115200 earlyprintk vmalloc=512M";
stdout-path = "serial0:115200n8";
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
dma_reserved: buffer@30000000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x30000000 0x10000000>;
};
};
//Required properties:
// - dmas: a list of <[DMA device phandle] [Channel ID]> pairs,// where Channel ID is (if both channels are enabled):
// '0' for write/tx channel
// '1' for read/rx channel
// If only one channel is enabled,either tx or rx:
// Channel ID is '0'.
// - dma-names: a list of DMA channel names,one per "dmas" entry
dma_proxy@0 {
compatible ="xlnx,dma_proxy";
dmas = <&axi_dma_0 0;
dma-names = "dma1";
memory-region = <&dma_reserved>;
};
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。