Skip to content

Commit

Permalink
[REL] Ready for v6.2.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Heng <[email protected]>
  • Loading branch information
JayHeng committed Mar 26, 2024
1 parent 8058b3e commit 708e2d4
Show file tree
Hide file tree
Showing 48 changed files with 11,809 additions and 76 deletions.
6 changes: 3 additions & 3 deletions Enable_HAB_Encryption-en-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

  首先在网站 [http://www.msys2.org/](http://www.msys2.org/) 下载msys2的安装包,根据你的系统选择合适的安装包(x86_64适用于64bit系统,i686适用于32bit系统),这里选择的是msys2-x86_64-20180531.exe,安装完成后从开始菜单里打开MSYS2 MSYS控制台。

![msys2StartMenuMysy](http://henjay724.com/image/cnblogs/nxpSecBoot_msys2StartMenuMysy.PNG)
![msys2StartMenuMysy](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_msys2StartMenuMysy.PNG)

  Execute the following four commands in sequence, and just input y when encountering ":: Proceed with installation? [Y/n]" questions. Note that you may need to close the console and reopen after the first command is executed. After successful execution of all commands, the basic configuration of MSYS2 and the installation of standard packages and gcc for compilation are completed.

Expand All @@ -42,7 +42,7 @@

  然后在网站 [https://www.openssl.org/](https://www.openssl.org/) 下载openssl的源码包,推荐选择1.0.x版本(1.1.x版本经测试有问题),这里选择的是openssl-1.0.2q.tar.gz,下载完成后将其解压放置到\NXP-MCUBootUtility\tools\openssl\目录下,从开始菜单里打开MSYS2 MinGW 32-bit控制台。

![msys2StartMenuMingw32](http://henjay724.com/image/cnblogs/nxpSecBoot_msys2StartMenuMingw32.PNG)
![msys2StartMenuMingw32](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_msys2StartMenuMingw32.PNG)

  Use the cd command to checkout to the \NXP-MCUBootUtility\tools\openssl\openssl-1.0.2q directory and execute the following three commands in sequence. Note that the second command takes a little longer time (about 10 minutes). Please be patient.

Expand All @@ -66,4 +66,4 @@

  至此NXP-MCUBootUtility的HAB加密功能也被激活了,打开NXP-MCUBootUtility软件,在Secure Boot Type里选择"HAB Encrypted Image Boot"模式试试吧。

![enableHabEncryptFunc](http://henjay724.com/image/cnblogs/nxpSecBoot_enableHabEncryptFunc.PNG)
![enableHabEncryptFunc](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_enableHabEncryptFunc.PNG)
6 changes: 3 additions & 3 deletions Enable_HAB_Signature-en-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

  首先需要从NXP官网下载 [HAB CST工具](https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL&appType=file2&location=null&DOWNLOAD_ID=null&lang_cd=en),下载前会弹出如下界面,点击'I Accept'后便可以下载到cst-3.1.0.tgz(下载于2018.12,随着时间推移,版本会有所变化)。

![agreementToDownloadCST](http://henjay724.com/image/cnblogs/nxpSecBoot_agreementToDownloadCST.PNG)
![agreementToDownloadCST](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_agreementToDownloadCST.PNG)

  This Agreement clause must be read through and agreed, This step must be done. This is one of the reasons why CST tool can not be directly put into NXP-MCUBootUtility package.

Expand All @@ -26,7 +26,7 @@

  下载到cst-3.1.0.tgz包后将其解压(需要2次解压才能看到\cst-3.1.0\cst-3.1.0\release里的内容)放在\NXP-MCUBootUtility\tools\cst\目录下即可,如下图所示:

![putCstIntoFolder](http://henjay724.com/image/cnblogs/nxpSecBoot_putCstIntoFolder.PNG)
![putCstIntoFolder](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_putCstIntoFolder.PNG)

### 4 Change the hab4_pki_tree.bat script 改动hab4_pki_tree.bat脚本
  The HAB signature certificate generation function in NXP-MCUBootUtility is implemented by calling the \NXP-MCUBootUtility\tools\cst\keys\hab4_pki_tree.bat script. You need to make the following minor changes to this script to use it for NXP-MCUBootUtility.
Expand Down Expand Up @@ -71,4 +71,4 @@ set srk_ca=%5

  至此NXP-MCUBootUtility的HAB签名功能便被激活了,打开NXP-MCUBootUtility软件,在Secure Boot Type里选择"HAB Signed Image Boot"模式试试吧。如果要继续激活NXP-MCUBootUtility软件的HAB加密功能,请继续参考 [《开启NXP-MCUBootUtility工具的HAB加密功能 - CST》](https://www.cnblogs.com/henjay724/p/10219459.html)

![enableHabSignFunc](http://henjay724.com/image/cnblogs/nxpSecBoot_enableHabSignFunc.PNG)
![](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_enableHabSignFunc.PNG)
15 changes: 11 additions & 4 deletions INTRODUCTION-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

### 一、i.MX RT启动背景
  在介绍MCUBootUtility出场之前,咱们先来聊聊i.MX RT的启动背景。众所周知,i.MX RT源自经典的i.MX6ULL平台,同i.MX处理器一样,i.MX RT也是flashless的芯片,其内部没有可供用户存储代码的非易失性存储器,因此在i.MX RT系统设计里需要为其配置一块非易失性存储器(在i.MX RT世界里,我们更喜欢称其为启动设备)。

  有了外置启动设备,代码存储的问题解决了,但随之引入了启动问题。要想从启动设备中访问代码数据,首先需要对其进行必要的配置,配置正确之后还需要从中找到正确的应用程序位置来加载启动,那么问题来了,谁负责干这些事?当然是BootROM,BootROM其实是固化在i.MX RT内部一段程序,其功能就类似于PC上的BIOS,i.MX RT上电首先运行的就是BootROM,由BootROM为i.MX RT做好启动的所有准备工作。

  翻看i.MX RT的BootROM章节,可以看到BootROM核心功能概括起来主要如下6条:

> * Support for booting from various boot devices
Expand All @@ -19,28 +21,33 @@ controller

  BootROM核心功能看起来有6条,其实主要是第1条,后面5条都是为第1条服务的,various boot devices即各种各样的启动设备,启动设备到底有多丰富?且看下图:

![NXP-MCUBootUtility_boot_device](http://henjay724.com/image/cnblogs/nxpSecBoot_Intro_bootrom_devices.PNG)
![NXP-MCUBootUtility_boot_device](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_Intro_bootrom_devices.PNG)

  从上图可以看出i.MX RT BootROM支持的启动设备真的很丰富,有通过FlexSPI接口支持的高速串行NOR、NAND Flash,有通过uSDHC接口支持的SD Card、eMMC,有通过SEMC接口支持的并行NOR、NAND Flash,甚至还有通过LPSPI接口支持的低速EEPROM、NOR Flash,真是应有尽有。

  启动设备类型这么多,是好事但也是麻烦事,BootROM为了能够同时支持这么多特性各异的启动设备,必须制定一个通用规则,这个规则就是i.MX RT Boot Data Component,即放在启动设备中的用户Application除了自身image数据外,还必须包含额外的Boot Data以供BootROM识别,那么Boot Data Component到底有哪些呢?继续看下表:

![NXP-MCUBootUtility_boot_data](http://henjay724.com/image/cnblogs/nxpSecBoot_Intro_boot_data_component.PNG)
![NXP-MCUBootUtility_boot_data](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_Intro_boot_data_component.PNG)

  上表中IVT和Boot Data是最必不可少的Component,也是用于支持众多特性各异的启动设备的关键,IVT与Boot Data合称Bootable header,包含Bootable header的Application即称为Bootable Application,启动设备中仅当存储的是Bootable Application才能够被i.MX RT BootROM正确识别和启动。

### 二、MCUBootUtility
  上一节讲完了i.MX RT启动背景,都是理论的东西,该是进入实战环节的时候了。到底如何制作一个Bootable Application?到底怎么将Bootable Application下载到指定类型启动设备中?

  其实恩智浦早为大家已经准备好一整套工具,BD file、elftosb.exe、MfgTool2.exe等,这些工具都在Flashloader包里,下面是这些工具的联合使用流程:

![NXP-MCUBootUtility_tool_flow](http://henjay724.com/image/cnblogs/nxpSecBoot_Intro_misc_tool_flow.PNG)
![NXP-MCUBootUtility_tool_flow](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_Intro_misc_tool_flow.PNG)

  首先在自己喜欢的IDE里(比如恩智浦免费提供的MCUXpresso)开发Application,开发结束之后生成可执行文件(.elf/.srec均可),将该可执行文件经过elftosb.exe转换成.sb文件(需要两次转换,第一次生成Bootable Application,第二次生成.sb文件,两次转换需要两个不同BD file),最后使用MfgTool2通过USB口将.sb文件内容下载到启动设备里。

  上述整个过程虽然涉及多个命令多步操作,但总算能够顺利完成。如果需要进一步使能HAB签名或者加密,那么需要再联合CST工具,步骤再增加一些。如果是使能BEE加密,那么得注意选对合适的BD file,一些特殊的fuse需要烧录正确,不管怎样,事情总能解决。

  但这就够了么?你有没有曾期望过有一个工具能够把上面这些事情全部包进去并且还是一个优雅的GUI?别以为这是妄想,这样的工具早已存在了,它就叫NXP-MCUBootUtility,下图是它的庐山真面目,清爽的界面,强大的功能,有了它,启动i.MX RT从未如此简单。

![NXP-MCUBootUtility_v1.1.0](http://henjay724.com/image/cnblogs/nxpSecBoot_Intro_v1.1.0_chinese.PNG)
![NXP-MCUBootUtility_v1.1.0](https://raw.githubusercontent.com/JayHeng/pzhmcu-picture/master/cnblogs/nxpSecBoot_Intro_v1.1.0_chinese.PNG)

  NXP-MCUBootUtility是一个专为恩智浦MCU安全启动而设计的工具,其特性与MCU里的BootROM功能相对应,目前主要支持i.MX RT系列MCU芯片,与NXP官方的标准安全启动配套工具集(OpenSSL, CST, sdphost, blhost, elftosb, BD, MfgTool2)相比,NXP-MCUBootUtility是一个真正的一站式工具,一个工具包含NXP官方所有配套启动工具的功能,并且是全图形用户界面操作。借助于NXP-MCUBootUtility,你可以轻松上手NXP MCU安全启动。

  NXP-MCUBootUtility主要功能如下:

> * 支持i.MXRT全系列MCU,包含i.MXRT1015、i.MXRT1021、i.MXRT1051/1052、i.MXRT1061/1062、i.MXRT1064 SIP
Expand Down
Loading

0 comments on commit 708e2d4

Please sign in to comment.