介绍
Device firmware update 介绍
DFU 表示 "Device Firmware Update",是一种用于升级 embedded devices firmware 的技术,例如 lighting fixtures、sensors 或 controllers。该 process 对 deployed devices 后续修复 bugs、改善 functionality、添加 new features,以及修补 security vulnerabilities 非常重要。
Vision DFU(Device Firmware Update)process 本质上只是向 device 发送 variable sized datastream。该 raw datastream 没有固定 structure,因此可以兼容以往 fixture DFUs。这种 flexibility 允许使用任意类型的 DFU file,更容易更新 devices,而不需要修改 file format。为了将 update data 提供给 app,使用简单的 ".bin" file。建议在 data stream 中实现 error checks。
Sample project 中包含带 error checks 的完整 example。
DFU file(".bin" file / datastream)包含更新 embedded device firmware 所需的数据。DFU file 的 structure 应确保 firmware 可以安全且有效地 update。该 structure 的一个重要部分是 header,它携带用于管理 update process 的 specific information。各 components 通常如下配合:
带 header 的 DFU binary file 组成:
- Header: Header 是 DFU file 的关键部分,包含 firmware update metadata。该 metadata 通常包括:
- Version number: 表示 firmware version,用于判断 update 是否比 device 当前 firmware 更新。
- Device identifier: 指定与 firmware compatible 的 device types,确保 update 只应用到合适 devices。
- Checksum or hash: Firmware data 的 cryptographic hash,用于在 file downloaded 或 transferred 后验证 integrity,确保没有被 tampered 或 corrupted。
- Firmware Data: 实际写入 device memory 的 binary data。它会替换现有 firmware,或修改其中部分内容以增强 functionality 或修复 issues。