• 正文
  • 相關(guān)推薦
申請入駐 產(chǎn)業(yè)圖譜

米爾STM32MP25x開發(fā)板Bring Up培訓(xùn)課程(中)

03/01 08:21
831
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論

2.修改設(shè)備樹

查看生成的Bring up工程空文件的設(shè)備樹,CA35的設(shè)備樹文件夾,其他的是M33核的工程資料。

我們可以看到生成的設(shè)備樹文件如下:

myir@myir-vm:/mnt/hgfs/ShareWorkspace/stm32mp25x-bringup/Bringup/CA35/DeviceTree/Bringup$ tree -l
.
├── kernel
│ ├── stm32mp257d-bringup-mx.dts
│ └── stm32mp257d-bringup-mx-resmem.dtsi
├── optee-os
│ ├── stm32mp257d-bringup-mx.dts
│ ├── stm32mp257d-bringup-mx-rcc.dtsi
│ ├── stm32mp257d-bringup-mx-resmem.dtsi
│ └── stm32mp257d-bringup-mx-rif.dtsi
├── tf-a
│ ├── stm32mp257d-bringup-mx.dts
│ ├── stm32mp257d-bringup-mx-fw-config.dts
│ ├── stm32mp257d-bringup-mx-rcc.dtsi
│ └── stm32mp25-mx.dtsi
└── u-boot
├── stm32mp257d-bringup-mx.dts
├── stm32mp257d-bringup-mx-resmem.dtsi
└── stm32mp257d-bringup-mx-u-boot.dtsi

4 directories, 13 files

以上的設(shè)備樹已經(jīng)配置了大部分內(nèi)容的工程,但是工程是還無法全部啟動,我們需要先把設(shè)備樹同步到相應(yīng)的BSP代碼中。

stm32mp25x-BringUp-bsp.tar.gz已拷貝并解壓到虛擬機(jī):/home/myir。

注:windows和ubuntu之間目錄共享

myir@myir-vm:~/stm32mp25x-BringUp-bsp$ tree -L 2
.
├── Bringup
│ ├── Bringup.ioc
│ ├── CA35
│ ├── CM33
│ ├── Common
│ └── Drivers
├── build
├── FIP_artifacts
│ ├── arm-trusted-firmware
│ ├── fip
│ ├── flash-all.sh
│ ├── FlashLayout_emmc_stm32mp25x-bringup-mx.tsv
│ ├── flash.sh
│ ├── optee
│ └── u-boot
├── myir-st-optee
│ ├── fiptool-stm32mp│ ├── Makefile.sdk
│ ├── myir-st-external-dt
│ ├── myir-st-optee
│ └── README
├── myir-st-tfa
│ ├── fiptool-stm32mp
│ ├── Makefile.sdk
│ └── tf-a-myir
├── myir-st-uboot
│ ├── fiptool-stm32mp
│ ├── Makefile.sdk│
└── u-boot-myir
└── stm32mp-ddr-phy-A2022.11-r0
├── README.HOW_TO.txt
└── stm32mp-ddr-phy-A2022.11
19 directories, 13 files

在“虛擬機(jī)設(shè)置”選項(xiàng)中設(shè)置完成后, 啟動虛擬機(jī)執(zhí)行如下命令進(jìn)行掛載:

myir@myir-vm# sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

sudo 密碼為:123456

在虛擬機(jī)的/mnt/hgfs目錄下已經(jīng)成功掛載上共享的目錄,如未掛載上,可以重新啟動下虛擬機(jī)。

/home/myir/目錄為我這邊虛擬機(jī)的目錄,實(shí)際目錄以自己本機(jī)為準(zhǔn)。

tf-a設(shè)備樹軟鏈接:

myir@myir-vm:/mnt/hgfs/ShareWorkspace# ln -s /mnt/hgfs/ShareWorkspace/Bringup/CA35/DeviceTree/bringup/tf-a/* /home/myir/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir/fdts/

Optee-os設(shè)備樹stm32mp257d-bringup-mx.dts和stm32mp257d-bringup-mx-rcc.dtsi軟鏈接:

myir@myir-vm:/mnt/hgfs/ShareWorkspace# ln -s /mnt/hgfs/ShareWorkspace/Bringup/CA35/DeviceTree/bringup/optee-os/stm32mp257d-bringup-mx.dts /home/myir/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee/core/arch/arm/dts/
root@myir-vm:/mnt/hgfs/ShareWorkspace# ln -s /mnt/hgfs/ShareWorkspace/Bringup/CA35/DeviceTree/bringup/optee-os/stm32mp257d-bringup-mx-rcc.dtsi /home/myir/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee/core/arch/arm/dts/

Optee-os設(shè)備樹stm32mp257d-bringup-mx-resmem.dtsi和stm32mp257d-bringup-mx-rif.dtsi直接使用SourceCode壓縮包Optee-os目錄中的文件,可通過軟鏈接或者拷貝的方式放到stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee/core/arch/arm/dts/目錄下。

Uboot設(shè)備樹軟鏈接:

myir@myir-vm:/mnt/hgfs/ShareWorkspace# ln -s /mnt/hgfs/ShareWorkspace/Bringup/CA35/DeviceTree/bringup/u-boot/* /home/myir/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir/arch/arm/dts/

Kernel設(shè)備樹軟鏈接:

Note:STM32CubeMX的規(guī)則是先生成Kernel的dts,然后將生成的dts文件拷貝到u-boot目錄下,也就是說u-boot的設(shè)備樹stm32mp257d-bringup-mx.dts是從kernel目錄拷貝過來的,所以在U-Boot階段修改設(shè)備樹,添加User code時(shí),請同步修改kernel的設(shè)備樹或者將修改好的設(shè)備樹拷貝到Kernel目錄,防止下次使用CubeMX生成設(shè)備樹的時(shí)候,u-boot部分的修改被kernel未修改的設(shè)備樹覆蓋。

2.1.配置和編譯TF-A

需要手動添加TF-A階段的串口配置的user code.使用文本編輯工具打開生成的 打開 TF-A 設(shè)備樹(BringupCA35DeviceTreeBringuptf-astm32mp257d-bringup-mx.dts)

添加頭文件

/*?USER?CODE?BEGIN?includes?*/
#include?"stm32mp25xf.dtsi"
#include?"stm32mp25-pinctrl.dtsi"
/*?USER?CODE?END?includes?*/

在“USER CODE BEGIN root”位置添加“chosen”和“aliases”節(jié)點(diǎn)

:/* USER CODE BEGIN root */
aliases {
serial0 = &usart2;};
chosen {
stdout-path = "serial0:115200n8";
};
/* USER CODE END root */

增加PMIC配置

&i2c7{
pinctrl-names = "default";
pinctrl-0 = <&i2c7_pins_mx>;
status = "okay";
/* USER CODE BEGIN i2c7 */
pmic2: stpmic@33 {
compatible = "st,stpmic2";
reg = <0x33>;
status = "okay";
regulators {
compatible = "st,stpmic2-regulators";
vddcpu: buck1 {
regulator-name = "vddcpu";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <910000>;
regulator-always-on;
};
vddcore: buck2 {
regulator-name = "vddcore";
regulator-min-microvolt = <820000>;
regulator-max-microvolt = <820000>;
regulator-always-on;
};
vddgpu: buck3 {
regulator-name = "vddgpu";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <900000>;
regulator-always-on;
};
vddio_pmic: buck4 {regulator-name = "vddio_pmic";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
v1v8: buck5
{regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;};
vdd2_ddr: buck6 {
regulator-name = "vdd2_ddr";
regulator-min-microvolt = <1100000>
;regulator-max-microvolt = <1100000>;
};
v3v3: buck7 {
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdda1v8_aon: ldo1 {
regulator-name = "vdda1v8_aon";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
vdd_emmc: ldo2 {
regulator-name = "vdd_emmc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd1_ddr: ldo3 {
regulator-name = "vdd1_ddr";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-enable-ramp-delay = <1000>;
};
vdd3v3_usb: ldo4 {
regulator-name = "vdd3v3_usb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
v5v_hdmi: ldo5 {
regulator-name = "v5v_hdmi";
regulator-min-microvolt = <2000000>;
regulator-max-microvolt = <2000000>;
};
vdd_sdcard: ldo7 {
regulator-name = "vdd_sdcard";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vddio_sdcard: ldo8 {
regulator-name = "vddio_sdcard";
st,regulator-bypass-microvolt = <3300000>;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
};
};
/* USER CODE END i2c7 *
/};
&ddr{
status = "okay";
/* USER CODE BEGIN ddr */
vdd1-supply = <&vdd1_ddr>;
vdd2-supply = <&vdd2_ddr>;
vddq-supply = <&vdd2_ddr>;
/* USER CODE END ddr */
};

使用文本編輯工具打開生成的 打開TF-A設(shè)備樹(BringupCA35DeviceTreeBringuptf-astm32mp257d-bringup-mx-fw-config.dts)

本次配置不涉及防火墻內(nèi)容,因此屏蔽如下內(nèi)容:

/* st-mem-firewall {
bl31_context: bl31-context@81ff0000 {
reg = <0x0 0x81ff0000 0x0 0x10000>;
st,protreg = <RISAFPROT(RISAF_REG_ID(7), 0, 0, 0, RIF_NSEC, RIF_ENC_DIS, RIF_BREN_EN)>;
};
op_tee: op-tee@82000000 {
reg = <0x0 0x82000000 0x0 0x2000000>;
st,protreg = <RISAFPROT(RISAF_REG_ID(8), 0, 0, 0, RIF_NSEC, RIF_ENC_DIS, RIF_BREN_EN)>;
};
};
*/
新增如下內(nèi)容:

/* USER CODE BEGIN root */
dtb-registry {
soc_fw-config {
load-address = <0x0 0x81fc0000>;
max-size = <0x40000>;
};
tos_fw {
load-address = <0x0 0x82000000>;
max-size = <0x2000000>;
};
};
st-mem-firewall {
bl31_context: bl31-context@81fc0000 {
reg = <0x0 0x81fc0000 0x0 0x40000>;
st,protreg = <RISAFPROT(RISAF_REG_ID(7), RIF_CID0_BF|RIF_CID1_BF, RIF_CID0_BF|RIF_CID1_BF, 0, RIF_SEC, RIF_ENC_DIS, RIF_BREN_EN)>;
};
op_tee: op-tee@82000000 {reg = <0x0 0x82000000 0x0 0x2000000>;
st,protreg = <RISAFPROT(RISAF_REG_ID(8), RIF_CID0_BF|RIF_CID1_BF, RIF_CID0_BF|RIF_CID1_BF, 0, RIF_SEC, RIF_ENC_DIS, RIF_BREN_EN)>;
};
};
/* USER CODE END root */

以上已完成配置,就可以進(jìn)行TF-A的單獨(dú)編譯。

myir@myir-vm: cd /home/myir/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir$ source /opt/st/myd-ld25x/4.2.4-snapshot/environment-setup-cortexa35-ostl-linux
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir$ export FIP_DEPLOYDIR_ROOT=../../FIP_artifacts
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir$ export FWDDR_DIR=../../stm32mp-ddr-phy-A2022.11-r0/stm32mp-ddr-phy-A2022.11
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir$ make -f $PWD/../Makefile.sdk DEPLOYDIR=$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware TF_A_CONFIG="optee-emmc usb" TF_A_DEVICETREE=stm32mp257d-bringup-mx ELF_DEBUG_ENABLE='1' stm32 metadata

注:已將上述TF-A單獨(dú)編譯的命令存放在/home/myir/stm32mp25x-BringUp-bsp/myir-st-tfa/tf-a-myir/build.sh

編譯完成:

2.2.配置與編譯Optee-OS

現(xiàn)在進(jìn)行OP-TEE的配置編譯,首先需要在設(shè)備樹中添加串口UART以及PWR相關(guān)的配置:

串口部分配置:

在之前STM32CubeMX配置串口的過程中,UART的配置是沒辦法在OP-TEE中使能的,也就是說OP-TEE的設(shè)備樹中沒有任何關(guān)于串口的配置,包括UART節(jié)點(diǎn)以及引腳,這些都需要我們手動添加上去:

(BringupCA35DeviceTreeBringupoptee-osstm32mp257d-bringup-mx.dts)

/* USER CODE BEGIN includes */
#include "stm32mp25-pinctrl.dtsi"
#include <dt-bindings/mfd/st,stpmic2.h>
#include <dt-bindings/regulator/st,stm32mp25-regulator.h>
#include <dt-bindings/reset/stm32mp25-resets.h>
#include <dt-bindings/soc/stm32mp-provisioning.h>
#include <dt-bindings/tamper/st,stm32mp25-tamp.h>
#include "stm32mp25xf.dtsi"
/* USER CODE END includes */

/* USER CODE BEGIN root */
aliases {
serial0 = &usart2;
};
chosen {
stdout-path = "serial0:115200n8"
;};

shadow-prov {
compatible?=?"st,provisioning";
hconf1_prov?{
nvmem-cells = <&hconf1_otp>;
st,shadow-value?=?<0x00008DB6>;
};
};

/* USER CODE END root */
&rcc{
status = "okay";
/* USER CODE BEGIN rcc */
st,c1msrd = <2>;
st,clk_opp
{st,ck_cpu1 {
cfg_1 {
hz = <1000000000>;
st,clksrc = <0>;
st,pll = <&pll1_cfg_1000Mhz>;};
cfg_2 {hz = <600000000>;
st,clksrc = <0>
;st,pll = <&pll2_cfg_600Mhz>;
};
};
};
/* USER CODE END rcc */
};

添加pin腳定義

/* USER CODE BEGIN addons */
&usart2 {
pinctrl-names = "default";
pinctrl-0 = <&usart2_pins_a>;
status = "okay";
};
/* USER CODE BEGIN addons */

使用是PMIC,那么VDD_CPU的配置需要包含在PMIC中,所以同樣的建議copy?tf-a里的配置,增加到I2C7的設(shè)備樹里。

&i2c7{s
tatus = "okay";
/* USER CODE BEGIN i2c7 */
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c7_pins_a>;
pinctrl-1 = <&i2c7_sleep_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;
pmic2: stpmic2@33 {
compatible = "st,stpmic2";
reg = <0x33>;
st,wakeup-pin-number = <1>;
st,pmic-it-id = <IT_PKEY_FA IT_PKEY_RI>;
st,notif-it-id = <0 1>;
status = "okay";
regulators {
compatible = "st,stpmic2-regulators";
ldo1-supply = <&vddio_pmic>;
vddcpu: buck1 {
regulator-name = "vddcpu";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <910000>;
regulator-always-on;
st,pwrctrl-sel = <2>;
st,pwrctrl-enable;
default {
regulator-off-in-suspend;
};
lplv {
regulator-off-in-suspend;
};
standby {
regulator-off-in-suspend;
};
off {
regulator-off-in-suspend;
};
};
vddcore: buck2 {
regulator-name = "vddcore";
regulator-min-microvolt = <820000>;
regulator-max-microvolt = <820000>;
regulator-always-on;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
regulator-suspend-microvolt = <820000>;
};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <670000>;
};
standby {
regulator-off-in-suspend;
};
off {
regulator-off-in-suspend;
};
};
vddgpu_pmic: buck3 {
regulator-name = "vddgpu_pmic";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <900000>;
regulator-over-current-protection;
};
vddio_pmic: buck4 {
regulator-name = "vddio_pmic";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
st,mask-reset;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
standby {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
off {
/* ToDo: switch to LP */
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
};
v1v8: buck5 {
regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>
;};
standby {
regulator-off-in-suspend;
};
off {
regulator-off-in-suspend;
};
};
vdd2_ddr: buck6 {
regulator-name = "vdd2_ddr";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;//
regulator-pull-down;st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1100000>;
};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1100000>;
};
standby {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1100000>;
};
off {
regulator-off-in-suspend;
};
};
v3v3: buck7 {
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-over-current-protection;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
standby {
regulator-off-in-suspend;
};
off {
regulator-off-in-suspend;
};
};
vdda1v8_aon: ldo1 {
regulator-name = "vdda1v8_aon";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
st,alternate-input-source;
st,mask-reset;};
vdd_emmc: ldo2 {
regulator-name = "vdd_emmc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-over-current-protection;
st,pwrctrl-sel = <3>;
st,pwrctrl-reset;
};
vdd1_ddr: ldo3 {
regulator-name = "vdd1_ddr";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;};
lplv {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
standby {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
off {
regulator-off-in-suspend;
};
};
vdd3v3_usb: ldo4 {
regulator-name = "vdd3v3_usb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-over-current-protection;
};
v5v_hdmi: ldo5 {
regulator-name = "v5v_hdmi";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
st,regulator-bypass-microvolt = <5000000>;
st,pwrctrl-sel = <0>;
st,pwrctrl-enable;}
;v5v_vconn: ldo6 {
regulator-name = "v5v_vconn";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
st,regulator-bypass-microvolt = <5000000>;
st,pwrctrl-sel = <0>;
st,pwrctrl-reset;
};
vdd_sdcard: ldo7 {
regulator-name = "vdd_sdcard";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-over-current-protection;
st,regulator-bypass-microvolt = <3300000>;
st,pwrctrl-sel = <3>;
st,pwrctrl-reset;};
vddio_sdcard: ldo8 {
regulator-name = "vddio_sdcard";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-over-current-protection;
st,regulator-bypass-microvolt = <3300000>;
st,pwrctrl-sel = <3>;
st,pwrctrl-reset;
};
vref_ddr:
refddr {
regulator-name = "vref_ddr";
regulator-always-on;
st,pwrctrl-sel = <1>;
st,pwrctrl-enable;
default {
regulator-on-in-suspend;
};
lplv {regulator-on-in-suspend;
};
standby {
regulator-on-in-suspend;
};
off {
regulator-off-in-suspend;
};
};
};
};
};
/* USER CODE END i2c7 */}
;

增加CPU電源配置

/* USER CODE BEGIN addons */
&pwr {
pinctrl-names = "default";
pinctrl-0 = <&wakeup_pins>;
status = "okay";
vdd33ucpd: vdd33ucpd {
status = "okay";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vdd33ucpd-supply = <&vdd3v3_usb>;
regulator-always-on;
};
vdda18adc: vdda18adc {
status = "okay";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
vdda18adc-supply = <&v1v8>;
regulator-always-on;
}
;vddgpu:
vddgpu {status = "okay";
vddgpu-supply = <&vddgpu_pmic>;
};
vddio1: vddio1 {
status = "okay";
regulator-min-microvolt = <3300000>;r
egulator-max-microvolt = <3300000>;
vddio1-supply = <&vddio_sdcard>;
};
vddio2: vddio2 {
status = "okay";
vddio2-supply = <&v1v8>
;regulator-always-on;
};
vddio3:
vddio3 {
status = "okay";
vddio3-supply = <&vddio_pmic>;
regulator-always-on
;};
vddio4: vddio4 {
status = "okay";
vddio4-supply = <&vddio_pmic>;
regulator-always-on;
};
vddio: vddio {
status = "okay";
vdd-supply = <&vddio_pmic>;
};
};
&cpu0 {
cpu-supply = <&vddcpu>;};
&scmi_regu {
scmi_vddcore: voltd-vddcore {
reg = <VOLTD_SCMI_STPMIC2_BUCK2>;
voltd-supply = <&vddcore>;
};
scmi_v1v8: voltd-v1v8 {
reg = <VOLTD_SCMI_STPMIC2_BUCK5>;
voltd-supply = <&v1v8>;
};
scmi_v3v3: voltd-v3v3 {
reg = <VOLTD_SCMI_STPMIC2_BUCK7>;
voltd-supply = <&v3v3>;
};
scmi_vdd_emmc: voltd-vdd-emmc {
reg = <VOLTD_SCMI_STPMIC2_LDO2>;
voltd-supply = <&vdd_emmc>
;};
scmi_vdd3v3_usb: voltd-vdd3v3-usb {
reg = <VOLTD_SCMI_STPMIC2_LDO4>;
voltd-supply = <&vdd3v3_usb>;
};
scmi_vdd_sdcard: voltd-vdd_sdcard {
reg = <VOLTD_SCMI_STPMIC2_LDO7>;
voltd-supply = <&vdd_sdcard>;
};
};
/* USER CODE END addons */

/* USER CODE BEGIN addons */
&risaf2 {
status = "disabled";};
&risaf5 {
status = "disabled";
};
&rtc {
status = "okay";
};
&tamp {
wakeup-source;
wakeup-parent = <&exti2>;
st,tamp-passive-precharge = <2>;
st,tamp-passive-nb-sample = <4>;
st,tamp-passive-sample-clk-div = <16384>
;/* Tamper button */
tamp_button: tamp-passive@1 {
status = "disabled";
reg = <EXT_TAMPER_1 0>;
pinctrl-0 = <&tamp_in1_pin_a>
;st,tamp-mode = <TAMPER_POTENTIAL_MODE>;
};
};
/* USER CODE END addons */

在上一章節(jié)中提到stm32mp257d-bringup-mx-resmem.dtsi和stm32mp257d-bringup-mx-rif.dtsi直接使用SourceCode壓縮包Optee-os目錄中的文件,如果還未拷貝,需要將其通過軟鏈接或者拷貝的方式放到stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee/core/arch/arm/dts/目錄下。

編譯Optee
myir@myir-vm: cd /home/myir/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee$ source /opt/st/myd-ld25x/4.2.4-snapshot/environment-setup-cortexa35-ostl-linux
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee$ export FIP_DEPLOYDIR_ROOT=../../FIP_artifacts
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee$ export FWDDR_DIR=../../stm32mp-ddr-phy-A2022.11-r0/stm32mp-ddr-phy-A2022.11
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee$ make -f $PWD/../Makefile.sdk DEPLOYDIR=$FIP_DEPLOYDIR_ROOT/optee CFG_EMBED_DTB_SOURCE_FILE=stm32mp257d-bringup-mx optee

注:已將上述Optee單獨(dú)編譯的命令存放在/home/myir/stm32mp25x-BringUp-bsp/myir-st-optee/myir-st-optee/build.sh

可以看到已經(jīng)生成了bin文件

2.3.配置和編譯Uboot

已同樣的方式進(jìn)行手動添加uboot的設(shè)備樹的一些配置,使用編輯工具打開uboot下的(BringupCA35DeviceTreeBringupu-bootstm32mp257d-bringup-mx.dts)

/* USER CODE BEGIN root */
aliases {
serial0 = &usart2;
};
chosen {
stdout-path = "serial0:115200n8";
};
/* USER CODE END root */

需要增加eMMC的配置

&sdmmc2{
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc2_pins_mx>;
pinctrl-1 = <&sdmmc2_opendrain_pins_mx>;
pinctrl-2 = <&sdmmc2_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN sdmmc2 */
non-removable;
no-sd;
no-sdio;
st,neg-edge;
bus-width = <8>;
vmmc-supply = <&scmi_vdd_emmc>
;vqmmc-supply = <&scmi_vddio2>;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
/* USER CODE END sdmmc2 */
};

添加USB配置,后續(xù)用于刷機(jī)

/* USER CODE BEGIN addons */
&usb2_phy1{
status = "okay";
/* USER CODE BEGIN usb2_phy1 */
vdd33-supply = <&scmi_vdd3v3_usb>;
/* USER CODE END usb2_phy1 */
};
&usb2_phy2{
status = "okay"
;/* USER CODE BEGIN usb2_phy2 */
vdd33-supply = <&scmi_vdd3v3_usb>;
/* USER CODE END usb2_phy2 */
}
;&usb3dr{
status = "okay";
/* USER CODE BEGIN usb3dr */
dwc3: usb@48300000 {
maximum-speed = "high-speed";
usb-role-switch;
port
{dwc3_ep: endpoint {
remote-endpoint = <&typec_ep>;
};
};
};
/* USER CODE END usb3dr */};
&usbh{
status = "okay";
/* USER CODE BEGIN usbh *
/usbh_ehci: usb@482f0000 {
#address-cells = <1>;
#size-cells = <0>;
/* onboard HUB */
hub@1 {
compatible = "usb424,2514";
reg = <1>;
vdd-supply = <&scmi_v3v3>;
};
};
usbh_ohci:
usb@482e0000 {
status = "disabled";
};
/* USER CODE END usbh */
}
;&scmi_regu {
scmi_vddio1: regulator@0 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>
;};
scmi_vddcore: regulator@11 {
reg = <VOLTD_SCMI_STPMIC2_BUCK2>;
regulator-name = "vddcore";};
scmi_v1v8:
regulator@14 {reg = <VOLTD_SCMI_STPMIC2_BUCK5>
;regulator-name = "v1v8";
};
scmi_v3v3: regulator@16 {r
eg = <VOLTD_SCMI_STPMIC2_BUCK7>;
regulator-name = "v3v3";
};
scmi_vdd_emmc: regulator@18 {
reg = <VOLTD_SCMI_STPMIC2_LDO2>;
regulator-name = "vdd_emmc";
};
scmi_vdd3v3_usb: regulator@20 {
reg = <VOLTD_SCMI_STPMIC2_LDO4>;
regulator-name = "vdd3v3_usb";
};
scmi_vdd_sdcard: regulator@23 {
reg = <VOLTD_SCMI_STPMIC2_LDO7>;
regulator-name = "vdd_sdcard";
};
};
&mlahb {intc_rpmsg:
interrupt-controller@1 {
compatible = "rpmsg,intc";
reg = <1 0>;
#interrupt-cells = <1>;
interrupt-controller;
};
i2c_rpmsg: i2c@2 {
compatible = "rpmsg,i2c-controller";
reg = <2 0>;
rpmsg,dev-id = "rpmsg_i2c";
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
typec@35 {
compatible = "st,stm32mp25-typec";
reg = <0x35>;
interrupts-extended = <&intc_rpmsg 0>;
status = "okay";
connector {
compatible = "usb-c-connector";
label = "USB-C";
port {
typec_ep: endpoint {
remote-endpoint = <&dwc3_ep>;
};
};
};
};
};
};
/* USER CODE END addons */

使用編輯工具打開uboot下的(BringupCA35DeviceTreeBringupu-bootstm32mp257d-bringup-mx-u-boot.dtsi)

/* USER CODE BEGIN addons */
&dwc3 {
dr_mode = "peripheral";
/delete-node/ port;
};
&i2c_rpmsg {
/delete-node/ typec@35;
};
&usart2 {
u-boot,dm-pre-reloc;
};
&usart2_pins_mx {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
};
pins2 {
u-boot,dm-pre-relo
c;}
;};
/* USER CODE END addons */

PMIC配置與tf-a一樣,這里略寫。

修改完成后,編譯U-Boot

myir@myir-vm:~$ cd stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir$ source /opt/st/myd-ld25x/4.2.4-snapshot/environment-setup-cortexa35-ostl-linux
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir$ export FIP_DEPLOYDIR_ROOT=../../FIP_artifacts
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir$ export FWDDR_DIR=../../stm32mp-ddr-phy-A2022.11-r0/stm32mp-ddr-phy-A2022.11
myir@myir-vm:~/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir$ make -f $PWD/../Makefile.sdk DEPLOYDIR=../../FIP_artifacts/u-boot UBOOT_CONFIG=default UBOOT_DEFCONFIG=stm32mp25_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE=stm32mp257d-bringup-mx FIP_CONFIG="optee-emmc" all

注:已將上述uboot單獨(dú)編譯的命令存放在/home/myir/stm32mp25x-BringUp-bsp/myir-st-uboot/u-boot-myir/build.sh

編譯完成后生成fip文件在定義的FIP_artifacts文件夾下,如下圖所示:

米爾科技

米爾科技

米爾電子,是一家專注于嵌入式處理器模組設(shè)計(jì)、研發(fā)、生產(chǎn)和銷售于一體的國家級高新技術(shù)企業(yè),也被評為專精特新企業(yè)。米爾電子深耕嵌入式領(lǐng)域10多年,致力于為企業(yè)級客戶提供基于ARM、FPGA、RISC-V和AI等各種架構(gòu),穩(wěn)定可靠的處理器模組,滿足客戶大批量產(chǎn)品應(yīng)用部署的需求,同時(shí)為客戶提供產(chǎn)品定制設(shè)計(jì)、行業(yè)應(yīng)用解決方案和OEM的一站式服務(wù)。

米爾電子,是一家專注于嵌入式處理器模組設(shè)計(jì)、研發(fā)、生產(chǎn)和銷售于一體的國家級高新技術(shù)企業(yè),也被評為專精特新企業(yè)。米爾電子深耕嵌入式領(lǐng)域10多年,致力于為企業(yè)級客戶提供基于ARM、FPGA、RISC-V和AI等各種架構(gòu),穩(wěn)定可靠的處理器模組,滿足客戶大批量產(chǎn)品應(yīng)用部署的需求,同時(shí)為客戶提供產(chǎn)品定制設(shè)計(jì)、行業(yè)應(yīng)用解決方案和OEM的一站式服務(wù)。 收起

查看更多

相關(guān)推薦

登錄即可解鎖
  • 海量技術(shù)文章
  • 設(shè)計(jì)資源下載
  • 產(chǎn)業(yè)鏈客戶資源
  • 寫文章/發(fā)需求
立即登錄

米爾電子,是一家專注于嵌入式處理器模組設(shè)計(jì)、研發(fā)、生產(chǎn)和銷售于一體的國家級高新技術(shù)企業(yè),也被評為專精特新企業(yè)。米爾電子深耕嵌入式領(lǐng)域10多年,致力于為企業(yè)級客戶提供基于ARM、FPGA、RISC-V和AI等各種架構(gòu),穩(wěn)定可靠的處理器模組,滿足客戶大批量產(chǎn)品應(yīng)用部署的需求,同時(shí)為客戶提供產(chǎn)品定制設(shè)計(jì)、行業(yè)應(yīng)用解決方案和OEM的一站式服務(wù)。 米爾英文簡稱“MYIR”,是“Make Your Idea Real”第一個(gè)大寫字母的縮寫。我們的理念是“專業(yè)服務(wù)助力客戶成功”,目前米爾已通過專業(yè)高效的服務(wù),幫助全球數(shù)萬家企業(yè)的產(chǎn)品成功上市。