我们都知道,T507要改动配置和重新分配处理器的引脚,都要先改动DTS,然后重新编译内核,把固件烧写到板上进行调试。
这种方式费时,费力。那么如何减少编译次数,同时快速调试主板呢?盈鹏飞嵌入式给出一个方法,仅供大家参考。
以下介绍内容均在盈鹏飞嵌入式AHD-T507(CoM-T507)主板验证通过。以下是AHD-T507主板的介绍:
AHD-T507产品功能图:
产品特性:
采用Allwinner公司Cortex-A53四核T507处理器,运行最高速度为1.5GHZ;
支持Mali-G31 MP2 GPU,支持OpenGL ES 3.2/2.0/1.0, Valkan 1.1,OpenCL 2.0
支持4K/25fps H.264视频编码,支持4K/15fps MJPEG编码;
多格式4K/60fps视频解码 (H.265,H.264,VC-1, MPEG-1/2/4, VP8) ;
支持双屏异显;支持RGB666/LVDS,分辨率最高1920x1080/60fps;支持HDMI 2.0A, 分辨率最高4K/60fps;支持TV CVBS OUT(NTSC/PAL);
支持1-2G Bytes LPDDR4 SDRAM;
支持EMMC 4G-64G大容量电子盘,可启动;
支持SDIO3.0,5路USB2.0 HOST和一路OTG,1路I2C,4路RS485, 2路PWM(应用于背光)
支持双路以太网,一路10/100M;一路10/100/1000M;
支持3G/4G通信;
支持6路AHD视频输入;
稳定的操作系统的支持,可预装Android10.0/LINUX 4.9/UBUNTU 20.04;
尺寸为:146*132MM
如果要快速验证功能,一种是改动DTS,然后重新编译内核等,烧写固件进行验证,那么是否有更快捷的办法呢?
答案是有的,那就是在线更改DTS。我们都知道,DTS经过编译后,就会变成DTB文件,组后烧写到板上,每次linux系统启动时,
DTb就会加载到内存,从而配置好主板的相关硬件并加载驱动。如何在线改动DTS呢?这里我们就要介绍的是u-boot相关fdt指令。
1. uboot FDT命令说明
FDT:flattened device tree的缩写
在UBOOT控制台停下后,输入fdt,可以查看fdt命令帮助
xxx#fdt
fdt - flattened device tree utility commands
Usage:
fdt addr [-c] <addr> [<length>] - Set the [control] fdt location to<addr>
fdt move <fdt> <newaddr> <length> - Copy the fdt to<addr> and make it active
fdt resize - Resize fdt to size+ padding to 4k addr
fdt print <path> [<prop>] - Recursive print starting at <path>
fdt list <path> [<prop>] - Print one level starting at <path>
fdt get value <var> <path><prop> - Get <property> andstore in <var>
fdt get name <var> <path> <index> - Get name of node <index> and storein <var>
fdt get addr <var> <path><prop> - Get start address of<property> and store in <var>
fdt get size <var> <path>[<prop>] - Get size of[<property>] or num nodes and store in <var>
fdt set <path> <prop> [<val>] - Set <property> [to <val>]
fdt mknode <path> <node> - Create a new node after<path>
fdt rm <path> [<prop>] - Delete the node or <property>
fdt header - Display header info
fdt bootcpu <id> - Set boot cpuid
fdt memory <addr> <size> - Add/Update memory node
fdt rsvmem print - Show current mem reserves
fdt rsvmem add <addr><size> - Add a mem reserve
fdt rsvmem delete <index> - Delete a mem reserves
fdt chosen [<start> <end>] - Add/update the /chosen branch inthe tree
<start>/<end> - initrd start/end addr
fdt save - write fdt to flash
NOTE: Dereference aliases by omiting theleading '/', e.g. fdt print ethernet0.
sunxi#
注:
其中常用的命令就是fdt list 和 fdt set,fdt save.
Fdt list用来查询节点配置
Fdt set 用来修改节点配置
fdt save用来保存修改过的节点。
查询配置
首先确定要查询的字段在device tree的路径,如果不知道路径,则需要用fdt命令查询:
2.1第一步根目录下查找
xxx#fdtlist /
如果找到需要的配置,比如wlan的配置,运行如下命令即可
xxx#fdtlist /wlan //注意路径中的 /
2.2第二步soc目录查找
fdtlist /soc
2.3第三步使用别名查找
别名是device tree中完整路径的一个简写,有一个专门的节点( /aliases )来表示别名的相关信息,用如下命令可以查看系统中别名的配置情况:
sunxi#fdtlist /aliases
aliases{
serial0 ="/soc@01c00000/uart@01c28000";
..............
mmc0 ="/soc@01c00000/sdmmc@01c0f000";
mmc2 ="/soc@01c00000/sdmmc@01C11000";
nand0 ="/soc@01c00000/nand0@01c03000";
disp ="/soc@01c00000/disp@01000000";
lcd0 ="/soc@01c00000/lcd0@01c0c000";
hdmi = "/soc@01c00000/hdmi@01ee0000";
pwm ="/soc@01c00000/pwm@01c21400";
boot_disp ="/soc@01c00000/boot_disp";
};
盈鹏飞嵌入式在开发AHD-T507主板的时候,经常有用户要适配液晶屏,每次编译内核十分的耗时间。
以下就以调整液晶参数进行说明:
调整液晶屏参数,通常涉及两个节点,一个是disp节点,另外一个是lcd0节点。
我们先看看disp节点有什么?
=> fdt list disp
disp@01000000 {
boot_fb0 = "bbf592c0,400,258,20,1000,70,3c,390,21c";
boot_disp2 = <0x00000004>;
boot_disp1 = <0x01040000>;
compatible = "allwinner,sunxi-disp";
reg = * 0xbbedb92c [0x00000060];
interrupts = <0x00000000 0x00000058 0x00000004 0x00000000 0x00000040 0x00000004 0x00000000 0x00000041 0x00000004 0x00000000 0x00000042 0x00000004 0x00000000 0x00000043 0x00000004>;
clocks = <0x0000000b 0x000000ae 0x00000012 0x00000013 0x00000014 0x00000015 0x00000016>;
boot_disp = <0x00000104>;
fb_base = <0x00000000>;
iommus = <0x00000028 0x00000000 0x00000000>;
status = "okay";
disp_init_enable = <0x00000001>;
disp_mode = <0x00000003>;
screen0_output_type = <0x00000001>;
screen0_output_mode = <0x00000004>;
screen1_output_type = <0x00000003>;
screen1_output_mode = <0x0000000a>;
screen1_output_format = <0x00000000>;
screen1_output_bits = <0x00000000>;
screen1_output_eotf = <0x00000004>;
screen1_output_cs = <0x00000101>;
screen1_output_dvi_hdmi = <0x00000002>;
screen1_output_range = <0x00000002>;
screen1_output_scan = <0x00000000>;
screen1_output_aspect_ratio = <0x00000008>;
dev0_output_type = <0x00000001>;
dev0_output_mode = <0x00000004>;
dev0_screen_id = <0x00000000>;
dev0_do_hpd = <0x00000000>;
dev1_output_type = <0x00000003>;
dev1_output_mode = <0x0000000a>;
dev1_screen_id = <0x00000001>;
dev1_do_hpd = <0x00000001>;
def_output_dev = <0x00000000>;
hdmi_mode_check = <0x00000001>;
fb0_format = <0x00000009>;
fb0_width = <0x00000400>;
fb0_height = <0x00000258>;
fb1_format = <0x00000000>;
fb1_width = <0x00000780>;
fb1_height = <0x00000438>;
chn_cfg_mode = <0x00000001>;
disp_para_zone = <0x00000001>;
dc1sw-supply = <0x000000af>;
bldo1-supply = <0x0000005b>;
cldo4-supply = <0x00000062>;
screen0_output_format = <0x00000000>;
screen0_output_bits = <0x00000000>;
screen0_output_eotf = <0x00000004>;
screen0_output_cs = <0x00000101>;
screen0_output_dvi_hdmi = <0x00000002>;
screen0_output_range = <0x00000002>;
screen0_output_scan = <0x00000000>;
screen0_output_aspect_ratio = <0x00000008>;
};
以下指令我们把这个disp_mode设置为0;
=> fdt set disp disp_mode <0>;
=> fdt list disp
disp@01000000 {
boot_fb0 = "bbf592c0,400,258,20,1000,70,3c,390,21c";
boot_disp2 = <0x00000004>;
boot_disp1 = <0x01040000>;
compatible = "allwinner,sunxi-disp";
reg = * 0xbbedb92c [0x00000060];
interrupts = <0x00000000 0x00000058 0x00000004 0x00000000 0x00000040 0x00000004 0x00000000 0x00000041 0x00000004 0x00000000 0x00000042 0x00000004 0x00000000 0x00000043 0x00000004>;
clocks = <0x0000000b 0x000000ae 0x00000012 0x00000013 0x00000014 0x00000015 0x00000016>;
boot_disp = <0x00000104>;
fb_base = <0x00000000>;
iommus = <0x00000028 0x00000000 0x00000000>;
status = "okay";
disp_init_enable = <0x00000001>;
disp_mode = <0x00000000>;
screen0_output_type = <0x00000001>;
screen0_output_mode = <0x00000004>;
screen1_output_type = <0x00000003>;
screen1_output_mode = <0x0000000a>;
screen1_output_format = <0x00000000>;
screen1_output_bits = <0x00000000>;
screen1_output_eotf = <0x00000004>;
screen1_output_cs = <0x00000101>;
screen1_output_dvi_hdmi = <0x00000002>;
screen1_output_range = <0x00000002>;
screen1_output_scan = <0x00000000>;
screen1_output_aspect_ratio = <0x00000008>;
dev0_output_type = <0x00000001>;
dev0_output_mode = <0x00000004>;
dev0_screen_id = <0x00000000>;
dev0_do_hpd = <0x00000000>;
dev1_output_type = <0x00000003>;
dev1_output_mode = <0x0000000a>;
dev1_screen_id = <0x00000001>;
dev1_do_hpd = <0x00000001>;
def_output_dev = <0x00000000>;
hdmi_mode_check = <0x00000001>;
fb0_format = <0x00000009>;
fb0_width = <0x00000400>;
fb0_height = <0x00000258>;
fb1_format = <0x00000000>;
fb1_width = <0x00000780>;
fb1_height = <0x00000438>;
chn_cfg_mode = <0x00000001>;
disp_para_zone = <0x00000001>;
dc1sw-supply = <0x000000af>;
bldo1-supply = <0x0000005b>;
cldo4-supply = <0x00000062>;
screen0_output_format = <0x00000000>;
screen0_output_bits = <0x00000000>;
screen0_output_eotf = <0x00000004>;
screen0_output_cs = <0x00000101>;
screen0_output_dvi_hdmi = <0x00000002>;
screen0_output_range = <0x00000002>;
screen0_output_scan = <0x00000000>;
screen0_output_aspect_ratio = <0x00000008>;
};
保存设置;
=> fdt save
uboot size = 0xd8000
storage type = 2
=> fdt list disp
disp@01000000 {
boot_fb0 = "bbf592c0,400,258,20,1000,70,3c,390,21c";
boot_disp2 = <0x00000004>;
boot_disp1 = <0x01040000>;
compatible = "allwinner,sunxi-disp";
reg = * 0xbbedb92c [0x00000060];
interrupts = <0x00000000 0x00000058 0x00000004 0x00000000 0x00000040 0x00000004 0x00000000 0x00000041 0x00000004 0x00000000 0x00000042 0x00000004 0x00000000 0x00000043 0x00000004>;
clocks = <0x0000000b 0x000000ae 0x00000012 0x00000013 0x00000014 0x00000015 0x00000016>;
boot_disp = <0x00000104>;
fb_base = <0x00000000>;
iommus = <0x00000028 0x00000000 0x00000000>;
status = "okay";
disp_init_enable = <0x00000001>;
disp_mode = <0x00000000>;
screen0_output_type = <0x00000001>;
screen0_output_mode = <0x00000004>;
screen1_output_type = <0x00000003>;
screen1_output_mode = <0x0000000a>;
screen1_output_format = <0x00000000>;
screen1_output_bits = <0x00000000>;
screen1_output_eotf = <0x00000004>;
screen1_output_cs = <0x00000101>;
screen1_output_dvi_hdmi = <0x00000002>;
screen1_output_range = <0x00000002>;
screen1_output_scan = <0x00000000>;
screen1_output_aspect_ratio = <0x00000008>;
dev0_output_type = <0x00000001>;
dev0_output_mode = <0x00000004>;
dev0_screen_id = <0x00000000>;
dev0_do_hpd = <0x00000000>;
dev1_output_type = <0x00000003>;
dev1_output_mode = <0x0000000a>;
dev1_screen_id = <0x00000001>;
dev1_do_hpd = <0x00000001>;
def_output_dev = <0x00000000>;
hdmi_mode_check = <0x00000001>;
fb0_format = <0x00000009>;
fb0_width = <0x00000400>;
fb0_height = <0x00000258>;
fb1_format = <0x00000000>;
fb1_width = <0x00000780>;
fb1_height = <0x00000438>;
chn_cfg_mode = <0x00000001>;
disp_para_zone = <0x00000001>;
dc1sw-supply = <0x000000af>;
bldo1-supply = <0x0000005b>;
cldo4-supply = <0x00000062>;
screen0_output_format = <0x00000000>;
screen0_output_bits = <0x00000000>;
screen0_output_eotf = <0x00000004>;
screen0_output_cs = <0x00000101>;
screen0_output_dvi_hdmi = <0x00000002>;
screen0_output_range = <0x00000002>;
screen0_output_scan = <0x00000000>;
screen0_output_aspect_ratio = <0x00000008>;
};
再进行lcd0节点的查看和设置:
=> fdt list lcd0
lcd0@01c0c000 {
compatible = "allwinner,sunxi-lcd0";
pinctrl-names = "active", "sleep";
status = "okay";
lcd_used = <0x00000001>;
lcd_driver_name = "default_lcd";
lcd_backlight = <0x000000c8>;
lcd_if = <0x00000003>;
lcd_x = <0x00000400>;
lcd_y = <0x00000258>;
lcd_width = <0x00000096>;
lcd_height = <0x0000005e>;
lcd_dclk_freq = <0x00000032>;
lcd_pwm_used = <0x00000001>;
lcd_pwm_ch = <0x00000000>;
lcd_pwm_freq = <0x0000c350>;
lcd_pwm_pol = <0x00000001>;
lcd_pwm_max_limit = <0x000000ff>;
lcd_hbp = <0x000000a0>;
lcd_ht = <0x0000052c>;
lcd_hspw = <0x00000074>;
lcd_vbp = <0x00000018>;
lcd_vt = <0x00000275>;
lcd_vspw = <0x00000003>;
lcd_lvds_if = <0x00000000>;
lcd_lvds_colordepth = <0x00000000>;
lcd_lvds_mode = <0x00000000>;
lcd_frm = <0x00000000>;
lcd_hv_clk_phase = <0x00000000>;
lcd_hv_sync_polarity = <0x00000000>;
lcd_gamma_en = <0x00000000>;
lcd_bright_curve_en = <0x00000000>;
lcd_cmap_en = <0x00000000>;
lcd_fsync_en = <0x00000000>;
lcd_fsync_act_time = <0x000003e8>;
lcd_fsync_dis_time = <0x000003e8>;
lcd_fsync_pol = <0x00000000>;
deu_mode = <0x00000000>;
lcdgamma4iep = <0x00000016>;
smart_color = <0x0000005a>;
lcd_pin_power = "bldo1";
lcd_power = "dc1sw";
lcd_bl_en = <0x00000032 0x00000003 0x00000017 0x00000001 0x00000000 0x00000003 0x00000001>;
pinctrl-0 = <0x000000b0>;
pinctrl-1 = <0x000000b1>;
};
=>
希望这个说明对广大朋友有用!欢迎交流。
网友评论