原文链接:https://bbs.aw-ol.com/topic/276
更多信息,欢迎来全志在线开发者社区看~
在设备BSP调试的过程中,经常会出现需要修改DTS的情况,比如调试一个新的屏幕、传感器或者wifi模组,传统的方法是: 在源码中直接修改board.dts文件->重新编译&打包->烧写到设备里 这种方法繁杂,编译和烧写都要花费时间,严重影响开发效率。 因此,全志(其实是uboot提供的)提供了一个启动阶段DTS调试的方法,可以让我们在启动阶段就把DTS改掉,这次启动加载的就是改后的DTS。 *注:这种修改是一次性的,不可以保存的,只限这次启动的时候生效,断电或者重启就不生效了1.设备上电过程中串口按住电脑键盘的"s"按键,让设备进入boot: *注:是真的按住调试的电脑的键盘的s按键,和按住2另设备跳烧录的操作一样(参考:[https://d1.docs.aw-ol.com/study/study_4compile/#pc2](https://d1.docs.aw-ol.com/study/study_4compile/#pc2)) 如果进入boot成功,就会有如下log,这时就可以在串口对设备进行DTS修改操作。 (详细log如下)
[188]HELLO! BOOT0 is starting!
[191]BOOT0 commit : 27369ab
[194]set pll start
[196]periph0 has been enabled
[199]set pll end
[200][pmu]: bus read error
[203]board init ok
[205]DRAM only have internal ZQ!!
[208]get_pmu_exist() = -1
[210]DRAM BOOT DRIVE INFO: V0.24
[213]DRAM CLK = 792 MHz
[215]DRAM Type = 3 (2:DDR2,3:DDR3)
[219]DRAMC ZQ value: 0x7b7bfb
[221]DRAM ODT value: 0x42.
[224]ddr_efuse_type: 0x0
[227]DRAM SIZE =1024 M
[231]DRAM simple test OK.
[233]dram size =1024
[235]key press : s
[237]spinand UBOOT_START_BLK_NUM 8 UBOOT_LAST_BLK_NUM 32
[242]block from 8 to 32
[318]Check is correct.
[320]dma 0x2f9f8 int is not used yet
[323]dma 0x2f9f8 int is free, you do not need to free it again
[329]Entry_name = opensbi
[332]Entry_name = u-boot
[335]Entry_name = dtb
[338]Jump to second Boot.
OpenSBI v0.6
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : T-HEAD Xuantie Platform
Platform HART Features : RV64ACDFIMSUVX
Platform Max HARTs : 1
Current Hart : 0
Firmware Base : 0x40000400
Firmware Size : 75 KB
Runtime SBI Version : 0.2
MIDELEG : 0x0000000000000222
MEDELEG : 0x000000000000b1ff
PMP0 : 0x0000000040000000-0x000000004001ffff (A)
PMP1 : 0x0000000040000000-0x000000007fffffff (A,R,W,X)
PMP2 : 0x0000000080000000-0x00000000bfffffff (A,R,W,X)
PMP3 : 0x0000000000020000-0x0000000000027fff (A,▒
U-Boot 2018.05-g0a88ac9 (Apr 30 2021 - 11:23:28 +0000) Allwinner Technology
[00.421]DRAM: 1 GiB
[00.423]Relocation Offset is: 3def0000
[00.427]secure enable bit: 0
[00.429]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz
[00.436]flash init start
[00.438]workmode = 0,storage type = 0
[00.444]sunxi-spinand-phy: not detect any munufacture from id table
[00.450]sunxi-spinand-phy: get spi-nand Model from fdt fail
[00.456]sunxi-spinand-phy: get phy info from fdt fail
device nand0 <nand>, # parts = 4
#: name size offset mask_flags
0: boot0 0x00100000 0x00000000 1
1: uboot 0x00300000 0x00100000 1
2: secure_storage 0x00100000 0x00400000 1
3: sys 0x0fb00000 0x00500000 0
active partition: nand0,0 - (boot0) 0x00100000 @ 0x00000000
defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:1024k@0(boot0)ro,3072k@1048576(uboot)ro,1024k@4194304(secure_storage)ro,-(sys)
[00.794]ubi0: attaching mtd4
[01.190]ubi0: scanning is finished
[01.200]ubi0: attached mtd4 (name "sys", size 251 MiB)
[01.204]ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[01.211]ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048
[01.217]ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[01.223]ubi0: good PEBs: 1004, bad PEBs: 0, corrupted PEBs: 0
[01.228]ubi0: user volume: 9, internal volumes: 1, max. volumes count: 128
[01.235]ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[01.243]ubi0: available PEBs: 0, total reserved PEBs: 1004, PEBs reserved for bad PEB handling: 40
[01.251]sunxi flash init ok
[01.254]line:714 init_clocks
__clk_init: clk pll_periph0x2 already initialized
register fix_factor clk error
[01.264]drv_disp_init
request pwm success, pwm2:pwm2:0x2000c00.
[01.281]drv_disp_init finish
[01.283]boot_gui_init:start
[01.286]set disp.dev2_output_type fail. using defval=0
[01.478]boot_gui_init:finish
[01.891]LCD open finish
partno erro : can't find partition bootloader
54 bytes read in 0 ms
[02.052]bmp_name=bootlogo.bmp size 3072054
3072054 bytes read in 126 ms (23.3 MiB/s)
[02.402]Loading Environment from SUNXI_FLASH... OK
[02.435]out of usb burn from boot: not need burn key
[02.460]update bootcmd
[02.482]change working_fdt 0x7eaafda8 to 0x7ea8fda8
[02.503]update dts
Hit any key to stop autoboot: 0
=> sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Unknown command 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss' - try 'help'
=>
=>
2.要看哪个DTS节点的参数,就输入 *fdt list +节点名称*
=> fdt list /soc/
soc@3000000 {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "simple-bus";
ranges; sram_ctrl@3000000 {
};
rtc_ccu@7090000 {
};
clock@2001000 {
};
clock@7010000 {
};
interrupt-controller@10000000 {
};
uart@2500000 {
};
uart@2500400 {
};
uart@2500800 {
};
uart@2500c00 {
};
uart@2501000 {
};
uart@2501400 {
};
ce@03040000 {
};
s_cir@7040000 {
};
ir@2003000 {
};
deinterlace@5400000 {
};
eth@4500000 {
};
rtc@7090000 {
};
dma-controller@3002000 {
};
timer@2050000 {
};
watchdog@6011000 {
};
mbus-comtroller@3102000 {
};
pmu {
};
idle {
};
pinctrl@2000000 {
};
spi@4025000 {
};
spi@4026000 {
};
twi@2502000 {
};
twi@2502400 {
};
twi@2502800 {
};
twi@2502c00 {
};
ledc@2008000 {
};
pwm@2000c00 {
};
keyboard@2009800 {
};
sid@3006000 {
};
gpadc@2009000 {
};
ths@02009400 {
};
rtp@2009c00 {
};
codec@2030000 {
};
dummy_cpudai@203034c {
};
sound@2030340 {
};
rpaf-dsp@203034c {
};
dmic@2031000 {
};
sound@2031050 {
};
sounddmic@2031060 {
};
daudio@2032000 {
};
sounddaudio0@20320a0 {
};
daudio@2033000 {
};
sounddaudio1@20330a0 {
};
daudio@2034000 {
};
sounddaudio2@20340a0 {
};
hdmiaudio@20340a4 {
};
spdif@2036000 {
};
soundspdif@2036040 {
};
g2d@5410000 {
};
disp@5000000 {
};
ve@1c0e000 {
};
msgbox@0601f000 {
};
lcd0@1c0c000 {
};
sdmmc@4022000 {
};
sdmmc@4020000 {
};
sdmmc@4021000 {
};
hdmi@5500000 {
};
usbc0@0 {
};
udc-controller@0x04100000 {
};
ehci0-controller@0x04101000 {
};
ohci0-controller@0x04101400 {
};
usbc1@0 {
};
ehci1-controller@0x04200000 {
};
ohci1-controller@0x04200400 {
};
pwm0@2000c10 {
};
pwm1@2000c11 {
};
pwm2@2000c12 {
};
pwm3@2000c13 {
};
pwm4@2000c14 {
};
pwm5@2000c15 {
};
pwm6@2000c16 {
};
pwm7@2000c17 {
};
vind@5800800 {
};
tvd@05c00000 {
};
tvd0@05c01000 {
};
card0_boot_para@2 {
};
card2_boot_para@3 {
};
rfkill@0 {
};
btlpm@0 {
};
addr_mgt@0 {
};
};
比如查看整个/soc/的DTS:
再比如看pwm0的设置则为:
=> fdt list /soc/pwm0
pwm0@2000c10 {
compatible = "allwinner,sunxi-pwm0";
reg = <0x00000000 0x02000c10 0x00000000 0x00000004>;
reg_base = <0x02000c00>;
pinctrl-names = "active", "sleep";
pinctrl-0 = <0x00000056>;
pinctrl-1 = <0x00000057>;
status = "okay";
phandle = <0x00000030>;
};
3.如果要修改某个节点的参数,则使用 *fdt set 节点名称 参数名称 要修改的数值* 如 *fdt set /soc/disp dev0_do_hpd <0>*
4.改好后输入 *boot* 启动设备即可。
*注:如果参数值是数字的话,要用"<>"阔起来,如:
fdt set /soc/disp/ screen0_output_type <4>
如果是字符串的话要用引号引起来,如:
dt set /soc/disp/ boot_fb0 "000000007eb4d680,780,438,20,1e00,348,17c,438,2bc"