BootMap ========== 概述 ------ BootMap 为 SDK 启动过程提供 boot map image 配置相关功能。 底层存储 ----------- bootmap 通过调用 bootmap 相关 API 来获取已经更新 bootmap 中的 image 信息。bootmap 中存储了所有 image 的起始位置,长度,类型等信息 .. note:: bootmap 本身采用乒乓算法的存储方式,所以有掉电保护的功能,对于固定大小的 flash,bootmap 本身的存储位置是固定的,存储大小目前固定使用 8K, 两个 flash sector, 一般在 flash 倒数第二,第三个 sector 存储结构 ----------- 当前,我们假设 flash 扇区大小为 4096 字节, bootmap 结构如下图所示,括号内数字表示该部分的大小(以字节为单位)。 :: +----------------------+--------------+--------------+-------------+ | index (4) | image. no.(1)| boot type(1) | Unused (2) | 页头部 (8) +----------+-----------+-------+--------+---------+----------------+ | type (1) | Unused (3)| lma(4)| vma(4) | len(4) | area len(4) | image0 信息 (20) +------------------------------------------------------------------+ | type (1) | Unused (3)| lma(4)| vma(4) | len(4) | area len(4) | image1 信息 (20) +------------------------------------------------------------------+ | type (1) | Unused (3)| lma(4)| vma(4) | len(4) | area len(4) | image2 信息 (20) |+-----------------------------------------------------------------+ / / / / +------------------------------------------------------------------+ | image* information (20) | image n 信息 (20) +------------------------------------------------------------------+ | CRC32(4) | bootmap 校验 (4) +------------------------------------------------------------------+ 该结构存储在 bootmap 区域,每次更新后 index 减小 1,存入乒乓的另一个区域,每次取 index 小的值为最新的信息 API 介绍 ------------ .. doxygenfile:: bootmap.h