【1】 制作TF卡启动盘
? ? ? ? 1、查看TF卡分区
? ? ? ? ? ? ? ? 将TF卡插到电脑接入到Ubuntu系统中,在命令行输入以下命令:
? ? ? ? ? ? ? ? ? ? ? ? ls /dev/sd*
? ? ? ? 2、对SD卡进行格式化
? ? ? ? ? ? ? ? ? ? ? ? sudo umount /dev/sdb?
????????????????????????sudo parted -s /dev/sdb mklabel msdos
? ? ? ? ?3、对TF卡进行分区
? ? ? ? ? ? ? ? ? ? ? ? sudo sgdisk --resize-table=128 -a 1 -n 1:34:545 -c 1:fsbl1 -n 2:546:1057 -c 2:fsbl2 -n? ? ? ? ? ? ? ? ? ? ?3:1058:5153 -c 3:ssbl -n 4:5154:136225 -c 4:bootfs -n 5:136226 -c 5:rootfs -A 4:set:2 -p? ? ? ? ? ? ? ? ? ? ?/dev/sdb -g
????????????????解析:? ? ? ? ? ? ? ? ? ? ? ? ? --resize-table=128 -a 1 ? ?: 对齐 ? ? ? ? ? ? ? ? ? ? ? ?-n 1:34:545 -c 1:fsbl1 ? ? ? ? ? ? ? ? ? ? ? ? ?-n(创建分区表) 第一个:34(起始块):545(终止块) -c(分区命名) 1:fsbl1(分区名) ? ? ? ? ? ? ? ? ?? ? ? -n 2:546:1057 -c 2:fsbl2? ? ? ? ? ? ? ? ? ? ? ? ?-n 3:1058:5153 -c 3:ssbl? ? ? ? ? ? ? ? ? ? ?? ? -n 4:5154:136225 -c 4:bootfs? ? ? ? ? ? ? ? ? ? ?? ? -n 5:136226 -c 5:rootfs ? ?到TF卡的剩余的空间都属于rootfs? ? ? ? ? ? ? ? ? ? ?? ? -A 4:set:2 ?: 设置分区表的属性 ? ? ? ? ? ? ? ? ? ?? ? -p /dev/sdb -g : 打印分区表 ? ? ? ? ? ? ? ? ? ? ? ? flash按照块进行访问,一块是512字节
? ? ? ? ??4、下载u-boot-spl.stm32到sdb1和sdb2,下载u-boot.img到sdb3? ? ? ? ? ? ? ? ? ?
????????????????????????sudo dd if=u-boot-spl.stm32 of=/dev/sdb1 conv=fdatasync
????????????????????????sudo dd if=u-boot-spl.stm32 of=/dev/sdb2 conv=fdatasync
????????????????????????sudo dd if=u-boot.img of=/dev/sdb3 conv=fdatasync
????????????????????????????????if ---> input file
????????????????????????????????of ---> output file
????????????????????????????????conv=fdatasync : 数据对齐
? ? ? ? ????5、设置开发板的启动方式,设置为通过SD卡启动
? ? ? ? ? ? ? ? ? ? ?启动方式通过板子上的拨码开关调节? ?
? ? ? ? ????6、将TF卡插到开发板上,开发板上电重启,板子能正常启动则TF启动盘制作完成。
【2】启动过程中的错误解析
? ? ? ? ? ?现象1、
U-Boot SPL 2021.04 (Jun 30 2021 - 10:38:51 +0800) stpmic1_pmic stpmic@33: stpmic1_read: failed to read register x : 32stpmic1_pmic stpmic@33: stpmic1_read: failed to read register x : 24RAM: DDR3-DDR3L 32bits 533000kHz stpmic1_pmic stpmic@33: stpmic1_read: failed to read register x : 39ddr power init failed
resetting ...
????????????????
? ? ? ? 通过对上述错误信息分析,可知电源管理单元PMIC有问题,可能是DK1和FSMP1A的电源管理单元存在差异,下一步对比两者的电源管理单元电路图
????????通过对比发现DK1公版的电源管理使用了一个I2C的电源管理芯片,FSMP1A则采用的是独立电源供电,使用了不同信号的电源管理芯片。接下来对差异部分进行修改。
? ? ? ? 找到stm32mp15xx-fsmp1x.dtsi文件,去掉i2c4的节点
245 &i2c4 {
246 pinctrl-names = "default", "sleep";
247 pinctrl-0 = <&i2c4_pins_a>;
248 pinctrl-1 = <&i2c4_sleep_pins_a>;
249 i2c-scl-rising-time-ns = <185>;
250 i2c-scl-falling-time-ns = <20>;
251 clock-frequency = <400000>;
252 status = "okay";
此处省略n多行
418 watchdog {
419 compatible = "st,stpmic1-wdt";
420 status = "disabled";
421 };
422 };
423 };
? ? ? ? ? ? ? 去掉cpu的节点
135 &cpu0{
136 cpu-supply = <&vddcore>;
137 };
138
139 &cpu1{
140 cpu-supply = <&vddcore>;
141 };
? ? ? ?????????找到arch/arm/dts/stm32mp157a-fsmp1a-u-boot.dtsi, 去掉以下节点
68 &pmic {
69 u-boot,dm-pre-reloc;
70 };
? ? ? ? ? ? ? ? 找到stm32mp15xx-fsmp1x.dtsi文件,在vin节点下添加电源节点信息
vin: vin {
compatible = "regulator-fixed";
regulator-name = "vin";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
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;
};
????????通过make menuconfig 配置uboot源码去掉PMIC的配置选项,按空格将方括号内*号去掉:
? ? ? ? Device Drivers --->
? ? ? ? ? ? ? ? ? ? ?Power --->
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[ ] Enable support for STMicroelectronics STPMIC1 PMIC
????????重新编译进行测试
? ? ? ? 现象2、
U-Boot SPL 2021.04 (Jun 30 2021 - 13:44:26 +0800)
RAM: DDR3-DDR3L 32bits 533000kHz
DDR invalid size : 0x4, expected 0x40000000
DRAM init failed: -22
### ERROR ### Please RESET the board ###
?????????上面显示DRAM初始化失败,对比DK1公版和FSMP1A开发板的DDR3内存的电路原理图,发现原理图一致,有可能设备树文件没有被编译
? ? ? ? 在dts目录下修改Makefile 文件,添加如下信息
43 arch-dtbs:
echo $(DEVICE_TREE) # 需要添加的内容,DEVICE_TREE:指定设备树的变量
44 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
????????重新执行make all 进行编译,在打印的信息中可以看到以下信息:
?echo stm32mp157c-ev1
????????stm32mp157c-ev1
?????????通过打印信息可知,编译u-boot源码是将ev1板子的设备树追加到了u-boot.img的后边, ?? ?并没有将自己的fsmp1a对应的设备树编译到u-boot.img的后边。
? ? ? ? 解决方法:
????????第一种:make DEVICE_TREE=stm32mp157a-fsmp1a all ?在编译是指定设备树对应的文件 ? ? ? ? 第二种:通过make menuconfig进行配置,设置默认的设备树为stm32mp157a-fsmp1a ? ? ? ? ? ? ? ? ? ? ? ? Device Tree Control ?---> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (stm32mp157a-fsmp1a) Default Device Tree for DT control ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (回车之后可以进行修改:推荐使用这种方式)。 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?直接执行make all就可以进行编译。?????????
????????编译出现以下错误信息:
???dts/Makefile:34: recipe for target 'arch/arm/dts/stm32mp157a-fsmp1a.dtb' failed
?????????没有生成.dtb文件。设备树文件的编译也是通过arch/arm/dts目录下的Makefile文件进行管理的,修改Makefile文件,添加对fsmp1a设备树文件编译的信息。 ?? ? 987? ? ? ?988 dtb-$(CONFIG_STM32MP15x) += \ ? ? ?989 ? ? stm32mp157a-dk1.dtb \ ? ? ?990 ? ? stm32mp157a-fsmp1a.dtb \ ? ? ?# 在此处添加编译fsmp1a设备树的信息? ? ? ?991 ? ? stm32mp157a-avenger96.dtb \
?????????make all 编译,成功,再次对u-boot进行测试
?????????现象3
U-Boot SPL 2021.04 (Jun 30 2021 - 15:08:11 +0800)
RAM: DDR3-DDR3L 16bits 533000kHz
WDT: Started with servicing (32s timeout)
MMC: no card present
spl: mmc init failed with error: -123
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
?????????对以上错误进行分析,发现是MMC驱动相关的错误,FSMP1A的开发板支持TF卡(16G)和EMMC(4G)的存储芯片,DK1公板只支持TF卡,而我们启动的方式采用的是TF卡启动,?因此启动失败的原因可能是TF卡的驱动有问题。
????????通过对DK1和FSMP1A原理图的分析,可知,SD卡都接到了SDMMC1的控制器,只是引脚不一致,?因此需要修改stm32mp15xx-fsmp1x.dtsi设备树头文件中的sdmmc1对应的节点。
408 &sdmmc1 {
409 pinctrl-names = "default", "opendrain", "sleep";
410 pinctrl-0 = <&sdmmc1_b4_pins_a>;
411 pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
412 pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
# 这里需要修改
413 cd-gpios = <&gpioh 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
414 disable-wp;
415 st,neg-edge;
416 bus-width = <4>;
417 vmmc-supply = <&v3v3>;
418 status = "okay";
419 };
?????????重新进行编译,重新下载进行测试
? ? ? ? 现象4、
stm32-vrefbuf vrefbuf@50025000: stm32 vrefbuf timed out: -110
adc@0: can't enable vdd-supply!single shot failed for adc@0[18]!
?????????错误原因: DK1公板在启动u-boot时,ADC会检查供电电流,如果不足3A就会报错。而fsmp1a板子没有涉及这个功能,因此需要将u-boot源码对对电流检查的代码关闭。
????????解决办法: ? ?? ?????????make menuconfig? ? ?? ??? ?????????Command line interface ?--->? ? ? ? ? ?????????????????? ?Device access commands ?--->? ? ? ? ? ?? ??????????????????? ?# 去掉*? ? ?? ??? ??? ? ????????????????? ?[ ] adc - Access Analog to Digital Converters info and data ? ?? ??????????? ?Device Drivers ?---> ? ?? ??? ??????????? ?# 去掉*? ? ?? ??? ??? ?????????[ ] Enable ADC drivers using Driver Model?
????????重新进行编译,重新下载进行测试?
|