AMD Artix 7 FPGA OTA在线升级的实现

作者:付汉杰 hankf@amd.com
文章来源:博客园
测试环境
参考文档
xtp226-ac701-multiboot-c-2015-1.pdf
ug470_7series_config.pdf
xapp1247-multiboot-spi.pdf
ug952-ac701-a7-eval-bd.pdf
ug1579-microblaze-embedded-design.pdf
vitis embedded software debugging guide (ug1515)
测试单板
ac701
测试工具
vivado 2022.2
vitis 2022.2
mutliboot
ug470 reconfiguration and multiboot overview
ug470中的介绍如下
the 7 series fpgas multiboot and fallback features support updating systems in the field.bitstream images can be upgraded dynamically in the field. the fpga multiboot feature enablesswitching between images on the fly. when an error is detected during the multiboot configurationprocess, the fpga can trigger a fallback feature that ensures a known good design can be loadedinto the device.  
amd fpga支持的multiboot特性,可以使fpga先尝试启动最新的配置(bit)文件,后续称为update bit。如果最新的配置文件出错,再回退到安全的出厂版本的配置(bit)文件,后续称为golden bit。
multiboot特性有两种方式使能。第一种方式是在配置(bit)文件里嵌入iprog命令,触发multiboot特性。第二种方式是通过axi hwicap写入iprog命令,触发multiboot特性。
配置(bit)文件嵌入iprog命令
建议阅读xapp1247 的 “table 1: multiboot bitstream properties”。
multiboot bitstream properties
在工程的约束文件中,加入下列设置,会自动在配置(bit)文件中插入iprog命令。
set_property bitstream.config.configfallback enable [current_design] set_property bitstream.config.next_config_addr 0x600000 [current_design] set_property bitstream.general.compress true [current_design]  
上述约束的next_config_addr,根据实际的flash分配情况设置。
对于ac701单板,也建议添加下列约束。
set_property bitstream.config.configrate 50 [current_design] set_property bitstream.config.spi_buswidth 4 [current_design] set_property bitstream.config.extmastercclk_en div-1 [current_design] set_property bitstream.config.spi_fall_edge yes [current_design] set_property config_mode spix4 [current_design] set_property config_voltage 3.3 [current_design] set_property cfgbvs vcco [current_design]  
通过axi hwicap写入iprog命令
amd提供ip,支持通过axi总线,访问icape。
xtp226 也提供了硬件、软件设计,它支持通过axi hwicap写入iprog命令,触发fpga重新加载。
golden_iprog_spi中的golden.c, 通过读取axi gpio 0的状态,决定fpga重新加载时使用的bit文件。axi gpio 0对应到ac701上的sw2。axi gpio 0的bit-0,也就是sw2的靠角落(ds23、sw4)的开关1在1的状态(靠液晶屏、7a200t芯片侧),则加载0x400000的bit文件。axi gpio 0的bit-0为0, bit-3为1(sw2的开关4)在1的状态,则加载0x800000的bit文件。
status = gpioinputexample(xpar_axi_gpio_0_device_id, &dataread); if (status == 0) { xil_printf(gpioinput read data:0x%x, dataread);if ( (dataread & 0x00000001) == 0x00000001 ){fpga_iprog(0x00400000); // iprog to good bitstream ,must match address in .prm}if ( (dataread & 0x00000008) == 0x00000008 ){fpga_iprog(0x00800000); // iprog to cause configuration error} } else { print(gpioinput failed.); }  
对比
第一种方式,通过配置(bit)文件嵌入iprog命令,实现最简单,占用资源也最少。但是只能支持一个update bit文件。
第二种方式,通过axi hwicap写入iprog命令,在下发iprog命令前,可以任意指定flash地址,非常灵活。但是需要嵌入microblaze和axi hwicap,需要占用部分fpga资源,也需要一点软件开发。
artix fpga ota 在线升级的流程
首先分配flash的存储空间。flash里 0x0 地址存放golden bit;flash里 0x400000 地址存放 update bit;其中0x400000需要根据压缩后的bit文件大小修改。
因为生成golden bit时,使用了属性“bitstream.config.next_config_addr”, golden bit启动后会自动加载update bit。
因为生成golden/update bit时,使用了属性“bitstream.config.configfallback”, 任何bit失败后,都会自动加载golden bit。
golden bit和 update bit内部都集成microblaze、hwicap和quad spi controller,都有在线升级bit的能力。
a. microblaze通过ethernet、pcie、uart等,从外部获得新的update bit。
b. microblaze将新的update bit写入quad spi的0x400000并校验
c. microblaze写iprog命令到hwicap,重启动fpga
d. fpga使用新的update bit配置,之后update bit开始工作。
如果后来芯片断电之后再上电,update bit能直接加载update bit。


大声开麦:简述LED显示屏的故障高发与频繁维护问题
锐意进取,炫力出彩!英特尔持续耕耘锐炫显卡
最新3D打印生物体可植入体内释放受控剂量的药物
钟鼎式分样器用途广泛,是一种准确度较高的粮食分样器
NRF52833对比NRF52832低功耗蓝牙5芯片
AMD Artix 7 FPGA OTA在线升级的实现
LEDVANCE宣布将关闭美国一处工厂
中科创达打造端、边、云融合系统——TurboX边缘智能平台
美国宣布将大疆无人机列入“实体清单”
如何用万用表测量三极管的三个管脚的简单方法
Modbus TCP的设计与实现
土壤重金属快速测定仪的优势介绍
电工知识—SIMATIC S7-1500 PLC典型模拟量接线图(3)
STM32F0xx_看门狗 (独立+窗口)配置详细过程
单电源供电回路中获得正负电源的原因
论嵌入式软硬件系统如何工作
Linux服务管理及Ubuntu系统镜像设置
龙芯出手:国产机器人CPU将抛弃进口
摩托罗拉“Dinara”千万像素手机亮相
为什么需要将QML的属性导出呢