一些NXP官方源码和升级包来源
重点必看文档
# AN14105: Understanding SECO Secure Storage and Non-Volatile Memory Management
https://docs.nxp.com/bundle/AN14105/page/topics/introduction.html
# SCFW---NXP提供的压缩包
https://www.nxp.com/webapp/Download?colCode=L5.4.47_2.2.0_SCFWKIT-
1.6.0&appType=license
# Arm Trusted Firmware (ATF)---github源码
Git clone https://github.com/nxp-imx/imx-atf
# U-Boot---github源码
Git clone https://github.com/nxp-imx/uboot-imx
# imx-mkimage---github源码
Git clone https://github.com/nxp-imx/imx-mkimage
# Linux Kernel---github源码
Git clone https://github.com/nxp-imx/linux-imx
# SECO img烧写包,NXP提供的压缩包
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.8.1.bin
# 参考代码, 包含官方测试代码
https://github.com/nxp-imx/imx-seco-libs.git
问题描述
在使用官方提供的 imx-seco-libs 编译之后,运行 hsm_test程序, 发送0xe0 指令,返回0x0429的错误码,日志输出 “nvm manager failed to start”, hsm_test 程序运行结束;
1:硬件架构分析
SCU有一个单独的CM4内核,通过SSI Bus和用户的A35CPU进行数据交互;
参考《i.MX 8QuadXPlus and 8DualXPlus_datesheet.pdf》–2.1 Block Diagram;
2:软件数据传输流程分析
根据"seco_mu.c"说明, 用户操作 /dev/seco_mux_chx,内部seco_mu.c和mailbox.c的检测之后,再经过 MUX 传输给 SECO;
3:nam manager分析
由下图可看出,nvm manager 是在 用户空间的 Cortex A/M 内核区间操作的,通过MU和SECO进行通讯,可以传输NVM 存储的 keystore数据;
参考《an14105-3_Keystores.pdf》–Key management
4: 0x0429错误码分析
参考《hsm_api_document.pdf》-- 5.1 Error codes
0x04--SAB_INVALID_PARAM_RATING;0x29--SAB_FAILURE_STATUS
参考 imx-secure-enclave 里面的定义,也有 0x0429 的错误码描述;
根据前面的 “2:软件数据传输流程分析”,可以判断 0x0429 是SECO里面返回的数据;
5:查看SECO版本信息
查看uboot日志, SECO-FW的commit信息,版本信息输入 seco info 查看
# uboot log
- SCFW b821f957, SECO-FW 7aeb8423, IMX-MKIMAGE 8947fea3, ATF bb49570
>$ seco info
SECO FW Version = Version 3.8.1, Commit 7aeb8423
ADM Lifecycle = 32
SNVS State = 15
Lifecycle = 0x0020
Monotonic = 0x0000
最终将设备里面的 SECO 版本从 3.7.1更换为 3.8.1 之后,解决0x0429的报错问题
# 异常版本
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.7.1.bin
# 正常版本
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.8.1.bin