黑金zynq7100模块采用2片QspiFLash并联 + eMMC的存储方案;qspiflash储存boot.bin,eMMC存储linux系统;
在应用升级系统的关键步骤是要实现: 在Linux系统中升级qspiFlash中的boot.bin;
本文简介工作中使用的方法。
开发环境:
VMware15 + ubuntu16.04.5 + petalinux2017.4工具;
Vivado2017.4 + SDK2017.4 ;
linux-xlnx-xilinx-v2017.4内核;
设备树配置如下:
qspi: spi@e000d000 {
clock-names = "ref_clk", "pclk";
clocks = <&clkc 10>, <&clkc 43>;
compatible = "xlnx,zynq-qspi-1.0";
interrupt-parent = <&intc>;
interrupts = <0 19 4>;
reg = <0xe000d000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
/* xlnx,qspi-mode = <0x0>; 0 if single, 1 if parallel and 2 if stacked. */
is-dual = <0x1>; /* Set if parallel. Reset if single or stacked. */
num-cs = <0x1>;
spi-rx-bus-width = <0x8>;
spi-tx-bus-width = <0x8>;
flash0: flash@0 {
compatible = "n25q512a", "micron,m25p80";
reg = <0x0>;
#address-cells = <1>;
#size-cells = <1>;
spi-max-frequency = <50000000>;
partition@0x00000000 {
label = "boot";
reg = <0x0 0x500000>;
};
partition@0x00500000 {
label = "bootenv";
reg = <0x500000 0x20000>;
};
partition@0x00520000 {
label = "kernel";
reg = <0x520000 0xa80000>;
};
partition@0x00fa0000 {
label = "spare";
reg = <0xfa0000 0x0>;
};
};
};
kernel配置如下:
增加mtd驱动对qspi_flash分区支持;
Device Drivers > Memory Technology Device (MTD) support > Self-contained MTD device drivers
<*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)
根文件系统配置如下:
增加 mtd-until工具包
应用程序:
linux系统启动后 cat /proc/mtd 正确结果如下:
烧写boot.bin到qspiflash中的方法如下:
flash_erase /dev/mtd0 0 0 #// 擦出boot分区中的程序
flashcp -v BOOT.bin /dev/mtd0 #// 将boot.bin文件写入boot分区;
结果:
该方法在公司的产品中成功使用!