步骤
1. 对源码进行解压
tar -xvf tf-a-stm32mp-2.2.r2-r0.tar.gz
2. 将补丁文件全打上
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
3. 配置交叉编译工具链,在TF-A顶层目录下打开Makefile.sdk文件修改,搜索cross_compile,然后进行相应的修改
4. 复制设备树
- 进入到 tf-a 源码目录,添加设备树文件
cp fdts/stm32mp15xx-dkx.dtsi fdts/stm32mp15xx-fsmp1x.dtsi
cp fdts/stm32mp157a-dk1.dts fdts/stm32mp157a-fsmp1a.dts
- 再在顶层目录下修改Makefile.sdk中的TFA_DEVICETREE配置项,加上 stm32mp157a-fsmp1a
- 以及修改 fdts/stm32mp157a-fsmp1a.dts中的头文件将
#include "stm32mp15xx-dkx.dtsi"改为#include "stm32mp15xx-fsmp1x.dtsi"
5. 编译
执行如下指令编译:
time make -j4 -f ../Makefile.sdk TFA_DEVICETREE=stm32mp157a-fsmp1a all
6. 查找镜像文件
- 进入镜像文件的下载目录:
cd ../build/trusted/
- 生成了相应的文件
7. 测试
- 执行如下指令烧写 u-boot到TF卡中
sudo dd if=tf-a-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb1 conv=fdatasync
sudo dd if=tf-a-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb2 conv=fdatasync
sudo dd if=u-boot-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb3 conv=fdatasync
- 将TF卡插入开发板中,上电后出现错误提示
8. 修改设备树电源配置
- 将原有的DK1相关电源配置删除
- 修改 fdts/stm32mp15xx-fsmp1x.dtsi 文件
- 将文件中 i2c4 节点相关内容整体删除,并将cpu0和cpu1相关内容删除
- 添加固定电源配置
- 根节点末尾位置添加如下内容
v3v3: regulator-3p3v { compatible = "regulator-fixed"; regulator-name = "v3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; regulator-boot-on; }; v1v8_audio: regulator-v1v8-audio { compatible = "regulator-fixed"; regulator-name = "v1v8_audio"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-always-on; regulator-boot-on; }; v3v3_hdmi: regulator-v3v3-hdmi { compatible = "regulator-fixed"; regulator-name = "v3v3_hdmi"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; regulator-boot-on; }; v1v2_hdmi: regulator-v1v2-hdmi { compatible = "regulator-fixed"; regulator-name = "v1v2_hdmi"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-always-on; regulator-boot-on; }; vdd: regulator-vdd { compatible = "regulator-fixed"; regulator-name = "vdd"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; regulator-boot-on; }; vdd_usb: regulator-vdd-usb { compatible = "regulator-fixed"; regulator-name = "vdd_usb"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; regulator-boot-on; };
- 根节点末尾位置添加如下内容