
自燒寫測試燒寫錯(cuò)誤 STM32CubeProgrammer 報(bào)錯(cuò)ip parsing error: mmcl報(bào)錯(cuò)Layout line 5: ip parsing error: mmcl根本原因Tsv 配置文件寫錯(cuò)IP 字段寫了mmcl正確是mmc1數(shù)字 1不是字母 l L 的小寫。 看截圖表格你的 ssb1 那一行 IP 列寫的是mmcl把數(shù)字 1 寫成字母 L 小寫l。這里也要選對#Opt Id Name Type Device Offset Binary - 0x01 fsbl1-boot Binary none 0x0 tf-a-stm32mp157d-atk-serialboot.stm32 - 0x03 ssbl-boot Binary none 0x0 u-boot.stm32 P 0x04 fsbl1 Binary mmc1 boot1 tf-a-stm32mp157d-atk-trusted.stm32 P 0x05 fsbl2 Binary mmc1 boot2 tf-a-stm32mp157d-atk-trusted.stm32 P 0x06 ssbl Binary mmc1 0x00080000 my-u-boot.stm32cd configs //進(jìn)入 uboot 的 configs 目錄 cp stm32mp15_trusted_defconfig stm32mp15_atk_trusted_defconfig //拷貝此時(shí)在 uboot 的 configs 目錄下就存在一個(gè)名為“stm32mp15_atk_trusted_defconfig”的默認(rèn) 配置文件這個(gè)默認(rèn)配置文件就是給我們開發(fā)板使用的。創(chuàng)建默認(rèn)配置設(shè)備樹在 uboot 的源碼目錄下運(yùn)行以下命令cd arch/arm/dts/ //進(jìn)入 uboot 設(shè)備樹目錄 cp stm32mp157d-ed1.dts stm32mp157d-atk.dts //復(fù)制.dts cp stm32mp15xx-edx.dtsi stm32mp157d-atk.dtsi //復(fù)制.dtsi cp stm32mp157a-ed1-u-boot.dtsi stm32mp157d-atk-u-boot.dtsi //復(fù)制.dtsi修改電源管理設(shè)置sdmmc1 { pinctrl-names default, opendrain, sleep; pinctrl-0 sdmmc1_b4_pins_a; pinctrl-1 sdmmc1_b4_od_pins_a; pinctrl-2 sdmmc1_b4_sleep_pins_a; st,neg-edge; broken-cd; bus-width 4; vmmc-supply v3v3; status okay; }; sdmmc2 { pinctrl-names default, opendrain, sleep; pinctrl-0 sdmmc2_b4_pins_a sdmmc2_d47_pins_a; pinctrl-1 sdmmc2_b4_od_pins_a sdmmc2_d47_pins_a; pinctrl-2 sdmmc2_b4_sleep_pins_a sdmmc2_d47_sleep_pins_a; non-removable; st,neg-edge; bus-width 8; vmmc-supply v3v3; keep-power-in-suspend; status okay; };網(wǎng)絡(luò)驅(qū)動(dòng)修改ethernet0 { status okay; pinctrl-0 ethernet0_rgmii_pins_a; pinctrl-1 ethernet0_rgmii_pins_sleep_a; pinctrl-names default, sleep; phy-mode rgmii-id; max-speed 1000; phy-handle phy0; mdio0 { #address-cells 1; #size-cells 0; compatible snps,dwmac-mdio; phy0: ethernet-phy0 { reg 0; }; }; };從圖13.2.6.3中可以看到 “ethernet5800a00 address not set.”字樣說明已經(jīng)找到了網(wǎng)絡(luò)外設(shè)并且網(wǎng)絡(luò)外設(shè)已經(jīng)啟動(dòng)但是還是會(huì)報(bào)“No ethernet found.”錯(cuò)誤這是因?yàn)閡boot啟動(dòng)的時(shí)候獲取不到MAC地址我們只需要設(shè)置一些地址相關(guān)的環(huán)境變量即可前面講解uboot的設(shè)置好地址相關(guān)環(huán)境變量以后就可以在uboot中使用網(wǎng)絡(luò)了用網(wǎng)線將開發(fā)板上的網(wǎng)絡(luò)接口與電腦或者路由器連接起來保證開發(fā)板和電腦在同一個(gè)網(wǎng)段內(nèi)通過ping命令來測試一下網(wǎng)絡(luò)連接命令如下網(wǎng)絡(luò)相關(guān)命令的時(shí)候已經(jīng)講過了命令如下setenv ipaddr 192.168.1.250 //開發(fā)板 IP 地址 setenv ethaddr 00:04:9f:04:d2:35 //開發(fā)板網(wǎng)卡 MAC 地址 setenv gatewayip 192.168.1.1 //開發(fā)板默認(rèn)網(wǎng)關(guān) setenv netmask 255.255.255.0 //開發(fā)板子網(wǎng)掩碼 setenv serverip 192.168.1.249 //服務(wù)器地址也就是 Ubuntu 地址 saveenvping 192.168.1.249STM32MP1 開發(fā)高頻踩坑1(數(shù)字一) 和l(L 小寫) 看混。#include stm32mp157.dtsi #include stm32mp15xd.dtsi #include stm32mp15-pinctrl.dtsi #include stm32mp15xxaa-pinctrl.dtsi #include stm32mp157-m4-srm.dtsi #include stm32mp157-m4-srm-pinctrl.dtsi #include stm32mpl57d-atk.dtsi#include stm32mpl57d-atk.dtsi 應(yīng)該是#include stm32mp157d-atk.dtsiUSB OTG設(shè)備樹修改1、添加usb_phy_tuning子節(jié)點(diǎn)在這一小節(jié)里我們就給uboot添加USB_OTG功能操作stm32mp157d-atk.dtsi這個(gè)文件在根節(jié)點(diǎn)“/”下添加名為“usb_phy_tuning”的子節(jié)點(diǎn)節(jié)點(diǎn)內(nèi)容如下usb_phy_tuning: usb-phy-tuning { st,hs-dc-level 2; st,fs-rftime-tuning; st,hs-rftime-reduction; st,hs-current-trim 15; st,hs-impedance-trim 1; st,squelch-level 3; st,hs-rx-offset 2; st,no-lsfs-sc; };添加STUSB1600 I2C子節(jié)點(diǎn)正點(diǎn)原子STM32MP157開發(fā)板上的USB OTG接口類型為Type-C使用STUSB1600芯片來實(shí)現(xiàn)此接口功能STUSB1600有一個(gè)I2C接口此I2C接口用來配置芯片因此我們還需要在設(shè)備樹中添加STUSB1600相關(guān)的I2C節(jié)點(diǎn)內(nèi)容。將如下內(nèi)容添加到stm32mp157d-atk.dtsi的最后面i2c1 { pinctrl-names default, sleep; pinctrl-0 i2c1_pins_a; pinctrl-1 i2c1_pins_sleep_a; i2c-scl-rising-time-ns 100; i2c-scl-falling-time-ns 7; status okay; /delete-property/dmas; /delete-property/dma-names; stusb160028 { compatible st,stusb1600; reg 0x28; interrupts 2 IRQ_TYPE_EDGE_FALLING; interrupt-parent gpiog; pinctrl-names default; pinctrl-0 stusb1600_pins_a; status okay; vdd-supply vin; connector { compatible usb-c-connector; label USB-C; power-role dual; power-opmode default; port { con_usbotg_hs_ep: endpoint { remote-endpoint usbotg_hs_ep; }; }; }; }; };由于STUSB1600是掛在STM32MP157的I2C1接口下因此示例代碼13.2.7.2是向I2C1節(jié)點(diǎn)追加內(nèi)容stusb1600節(jié)點(diǎn)添加usb接口相關(guān)節(jié)點(diǎn)繼續(xù)向stm32mp157d-atk.dtsi文件添加USB接口相關(guān)節(jié)點(diǎn)內(nèi)容內(nèi)容如下usbh_ehci { phys usbphyc_port0; status okay; }; usbotg_hs { phys usbphyc_port1 0; phy-names usb2-phy; usb-role-switch; status okay; port { usbotg_hs_ep: endpoint { remote-endpoint con_usbotg_hs_ep; }; }; }; usbphyc { status okay; };上述代碼中有三個(gè)節(jié)點(diǎn)usbh_ehci、usbotg_hs和usbphyc其中usbotg_hs默認(rèn)就有我們在前面將其屏蔽掉了完成以后如圖13.2.7.3所示在stm32mp157d-atk-u-boot.dtsi文件中添加usbotg_hs節(jié)點(diǎn)最后我們需要在stm32mp157d-atk-u-boot.dtsi文件里面添加usbotg_hs節(jié)點(diǎn)節(jié)點(diǎn)內(nèi)容如下所示usbotg_hs { phys usbphyc_port1 0; phy-names usb2-phy; u-boot,force-b-session-valid; hnp-srp-disable; /* TEMP: force peripheral for USB OTG */ dr_mode peripheral; // 刪掉 usb-role-switch; port { usbotg_hs_ep: endpoint { remote-endpoint con_usbotg_hs_ep; }; }; };至此uboot下的USB OTG就已經(jīng)修改完成重新編譯uboot并燒寫然后使用ums命令測試看看能不能將EMMC模擬成U盤掛載到電腦上命令如下做到這里保存修改的文件編譯和拷貝。把STM32MP157D-ATK開發(fā)板的USB_OTG接口連接到電腦里重啟開發(fā)板接著運(yùn)行以下命令ums 0 mmc 1如果電腦上出現(xiàn)如圖13.2.7.5所示的磁盤說明USB OTG工作成功LCD驅(qū)動(dòng)修改RGB LCD 7 寸 1024×600 屏幕節(jié)點(diǎn)uboot也是支持LCD顯示的但是要進(jìn)行相應(yīng)的設(shè)置主要是設(shè)置屏幕背光、屏幕時(shí)序參數(shù)這些這些直接在設(shè)備樹里面修改即可。打開stm32mp157d-atk.dts文件在里面添加LCD相關(guān)節(jié)點(diǎn)信息首先在根節(jié)點(diǎn)“/”下添加panel_backlight和panel_rgb這兩個(gè)節(jié)點(diǎn)節(jié)點(diǎn)內(nèi)容如下示panel_backlight: panel-backlight { compatible gpio-backlight; gpios gpiod 13 GPIO_ACTIVE_HIGH; default-on; status okay; }; panel_rgb: panel-rgb { compatible simple-panel; pinctrl-names default, sleep; pinctrl-0 ltdc_pins_b; pinctrl-1 ltdc_pins_sleep_b; backlight panel_backlight; status okay; port { panel_in_rgb: endpoint { remote-endpoint ltdc_ep0_out; }; }; display-timings { native-mode timing0; timing0: timing0 { /* 7寸 1024*600 */ clock-frequency 51200000; hactive 1024; vactive 600; hfront-porch 160; hback-porch 140; hsync-len 20; vback-porch 20; vfront-porch 12; vsync-len 3; }; }; };第1~6行panel_backlight為LCD的背光控制節(jié)點(diǎn)主要指定LCD背光IO所使用的引腳正點(diǎn)原子的STM32MP157開發(fā)板LCD背光引腳為PD13。第8~38行panel_rgb為RGB LCD節(jié)點(diǎn)指定了LTDC接口所使用的IO、屏幕時(shí)序參數(shù)等。第11~12行指定LTDC接口的IOltdc_pins_b和ltdc_pins_sleep_b定義在stm32mp15-pinctrl.dtsi文件中。第22~35行的display-timings是非常重要的LCD時(shí)序參數(shù)不同的屏幕其時(shí)序參數(shù)不同這里演示的是正點(diǎn)原子7寸1024*600分辨率的。正點(diǎn)原子有4款RGB接口屏幕分別為4.3寸480*272和800*480分辨率、7寸800*480和1024*600分辨率這款屏幕時(shí)序參數(shù)如表13.2.9.1所示最后還需要在stm32mp157d-atk.dts文件里面向ltdc節(jié)點(diǎn)追加一些內(nèi)容內(nèi)容如下ltdc { status okay; pinctrl-names default; port { #address-cells 1; #size-cells 0; ltdc_ep0_out: endpoint0 { reg 0; remote-endpoint panel_in_rgb; }; }; };執(zhí)行 ./stm32mp157d_alientek.sh 報(bào)權(quán)限不夠問題分析plaintextrm: 無法刪除include/config/dtc.h: 權(quán)限不夠報(bào)錯(cuò)核心include/config下面的文件所有者不是當(dāng)前普通用戶 user大概率之前用 sudo/root 編譯過 uboot生成的頭文件屬于 root現(xiàn)在普通用戶執(zhí)行腳本清理刪不掉 root 的文件?,F(xiàn)象uboot 的make clean/make distclean會(huì)嘗試刪除include/config/*文件是 root 權(quán)限普通 user 無刪除權(quán)限。方案 1修復(fù)目錄文件權(quán)限推薦不要一直用 sudo 編譯 uboot在my_uboot目錄下執(zhí)行把整個(gè)源碼目錄所有者改回你當(dāng)前普通用戶userbashsudo chown -R $USER:$USER .執(zhí)行完再跑你的編譯腳本bash./stm32mp157d_alientek.shError: arch/arm/dts/stm32mp157d-atk.dtsi:223.17-31 syntax errorError: arch/arm/dts/stm32mp157d?atk.dtsi:223.17?31 syntax error FATAL ERROR: Unable to parse input tree報(bào)錯(cuò)指向第 223 行dtsusb_phy_tuning: usb?phy?tuning{問題根源設(shè)備樹節(jié)點(diǎn)語法節(jié)點(diǎn)名稱后面的左大括號(hào){前面必須要有空格。 你代碼dtsusb_phy_tuning: usb?phy?tuning{usb?phy?tuning和{緊貼在一起缺少空格DTC 編譯器報(bào)語法錯(cuò)誤。修改正確寫法dtsusb_phy_tuning: usb?phy?tuning {在usb?phy?tuning與{之間加一個(gè)空格。完整修正片段dtsusb_phy_tuning: usb?phy?tuning { st,hs?dc?level 2; st,fs?rftime?tuning; st,hs?rftime?reduction; st,hs?current?trim 15; st,hs?impedance?trim 1; st,squelch?level 3; st,hs?rx?offset 2; st,no?lsfs?sc; };Error: arch/arm/dts/stm32mp157d-atk.dtsi:223.17-20 syntax error FATAL ERROR: Unable to parse input tree scripts/Makefile.lib:308: recipe for target arch/arm/dts/stm32mp157d-atk.dtb failed make [2]: *** [arch/arm/dts/stm32mp157d-atk.dtb] Error 1 make [2]: *** 正在等待未完成的任務(wù).... dts/Makefile:38: recipe for target arch-dtbs failed make [1]: *** [arch-dtbs] Error 2 Makefile:1090: recipe for target dts/dt.dtb failed make: *** [dts/dt.dtb] Error 2 useruser-virtual-machine:~/linux/atk-mp usb_phy_tuning: usb?phy?tuning { st,hs?dc?level 2; st,fs?rftime?tuning; st,hs?rftime?reduction; st,hs?current?trim 15; st,hs?impedance?trim 1; st,squelch?level 3; st,hs?rx?offset 2; st,no?lsfs?sc; };錯(cuò)誤定位報(bào)錯(cuò)stm32mp157d?atk.dtsi:223.17?20 syntax error現(xiàn)在行號(hào)直接指向源文件 223 行就是usb_phy_tuning: usb?phy?tuning {這一行??茨阗N出來的代碼里所有橫線usb?phy?tuning、st,hs?dc?level里面的-不是英文減號(hào)是中文長破折號(hào)? 肉眼看著像橫線但 dtc 編譯器不認(rèn)直接報(bào)語法錯(cuò)誤。問題字符對比? 錯(cuò)誤你現(xiàn)在的中文破折號(hào)usb?phy?tuning? 正確英文半角減號(hào)usb-phy-tuning所有屬性里面的橫線全部要替換成英文-st,hs?dc?level→st,hs-dc-levelst,fs?rftime?tuning→st,fs-rftime-tuningst,hs?rftime?reduction→st,hs-rftime-reductionst,hs?current?trim→st,hs-current-trimst,hs?impedance?trim→st,hs-impedance-trimst,squelch?level→st,squelch-levelst,hs?rx?offset→st,hs-rx-offsetst,no?lsfs?sc→st,no-lsfs-sc完整正確代碼復(fù)制這個(gè)這里全部是英文減號(hào)dtsusb_phy_tuning: usb-phy-tuning { st,hs-dc-level 2; st,fs-rftime-tuning; st,hs-rftime-reduction; st,hs-current-trim 15; st,hs-impedance-trim 1; st,squelch-level 3; st,hs-rx-offset 2; st,no-lsfs-sc; };操作步驟刪除原來 223 行開始這一整塊粘貼上面這段CtrlS保存文件清理再編譯