BIF 语法和受支持的文件类型 - 2023.2 简体中文

Vitis 统一软件平台文档 嵌入式软件开发 (UG1400)

Document ID
UG1400
Release Date
2023-12-13
Version
2023.2 简体中文

BIF 文件用于指定启动镜像的每个组件(按启动顺序),并允许对每个镜像组件应用可选属性。在某些情况下,如果镜像组件在内存中不连续,即可映射到多个分区。例如,如果某个 ELF 文件具有多个非连续的可加载节,那么每个节均可作为一个独立分区。BIF 文件语法格式如下:

new_bif:
{
  id = 0x2
  id_code = 0x04ca8093
  extended_id_code = 0x01
  image
  {
      name = pmc_subsys, id = 0x1c000001
      partition
      { 
          id = 0x11, type = bootloader,
          file = /path/to/plm.elf
      }
      partition
      {
         type = pmcdata, load = 0xf2000000,
         file = /path/to/pmc_cdo.bin
      }
  }
}
注释: 以上格式仅适用于 AMD Versal™ 器件。
<image_name>:
{
	// common attributes
	[attribute1] <argument1>   
	 
	// partition attributes
	[attribute2, attribute3=<argument>] <elf>
	[attribute2, attribute3=<argument>, attibute4=<argument] <bit>
	[attribute3] <elf>
	<bin>
}  
  • <image_name> 和 {...} 分组方式将要添加到 ROM 镜像的分区内的文件用括号括起。
  • 在 {...} 括号内列出了一个或多个数据文件。
  • 每个分区数据文件的数据文件名前均可包含一组可选属性,语法为 [attribute, attribute=<argument>]
  • 属性可用于对数据文件应用某些性质。
  • 可使用“,”作为分隔符来分隔列示的多个属性。多个属性的顺序无关紧要。某些属性为单一关键字,某些为关键字等效字。
  • 如果文件并非位于当前目录内,那么还可添加指向文件名的文件路径。文件以自由格式列示,全部位于一行上(以任意空格分隔,至少含一个空格),或者位于多行上。
  • 空格将被忽略,可添加空格以保障可读性。
  • 您可使用 C 语言样式的块注释:/*...*/,或者也可使用 C++ 行注释://

以下示例 BIF 文件含额外空格和换行,以提升可读性:

<bootimage_name>:
{
	/* common attributes */
	 [attribute1] <argument1>   
	 
	/* bootloader */
	 [attribute2, 
	  attribute3, 
	  attribute4=<argument>
	] <elf>
	 
	/* pl bitstream */ 
	[
		attribute2, 
		attribute3, 
		attribute4=<argument>,
		attibute=<argument>
	] <bit>
	 
	/* another elf partition */
	[
		attribute3
	] <elf>
 
	/* bin partition */
	<bin>
}

Bootgen 支持的文件

下表列出了 Bootgen 支持的文件。

表 1. Bootgen 支持的文件
受支持的器件 扩展名 描述 注释
受所有器件支持 .bin 二进制 原始二进制文件。
.dtb 二进制 原始二进制文件。
image.gz 二进制 原始二进制文件。
.elf 可执行链接文件 (ELF) 已移除符号和头文件。
.int 寄存器初始化文件  
.nky AES 秘钥  
.pub/.pem RSA 秘钥  
.sig 签名文件 由 Bootgen 或 HSM 生成的签名文件。
Versal .rcdo CFI 文件 仅适用于 Versal 器件。
.cdo/.npi/ .rnpi CDO 文件 配置数据对象文件。仅适用于 Versal 器件。
.bin/.pdi 启动镜像 使用 Bootgen 生成的启动镜像。
Zynq 7000/Zynq UltraScale+ MPSoC/FPGA .bit/.rbt 比特流 剥离 BIT 文件头文件。