Tina-SDK开发

news2024/11/14 1:15:29

开发环境搭建

获取TinaSDK源码

Tina-SDKV2.0源码网盘链接:https://pan.baidu.com/s/13uKlqDXImmMl9cgKc41tZg?pwd=qcw7

上传到ubuntu,创建文件夹用来保存源码:

ubuntu@ubuntu1804:~$ mkdir Tina_SDK
ubuntu@ubuntu1804:~$ cd Tina_SDK/
ubuntu@ubuntu1804:~/Tina_SDK$ tree -L 1
.
├── tina-d1-h.tar.bz2.00
├── tina-d1-h.tar.bz2.01
├── tina-d1-h.tar.bz2.02
├── tina-d1-h.tar.bz2.03
├── tina-d1-h.tar.bz2.04
├── tina-d1-h.tar.bz2.05
├── tina-d1-h.tar.bz2.06
├── tina-d1-h.tar.bz2.07
└── tina-d1-h.tar.bz2.08

0 directories, 9 files

查看所有文件MD5校验值:

ubuntu@ubuntu1804:~/Tina_SDK$ md5sum tina-d1-h.tar.bz2.*
e755bae00cd76afc3fb276b4e3fd86ba  tina-d1-h.tar.bz2.00
cb60ecfdb51c624ff3cbd7b24552866f  tina-d1-h.tar.bz2.01
54e56a4cf1cef46ca0a94b85ea1d33a1  tina-d1-h.tar.bz2.02
4988fa08827c0f7af2dc170145e24b26  tina-d1-h.tar.bz2.03
a0463bcf8e73db27b5ecafaac593a919  tina-d1-h.tar.bz2.04
a87382ca16a8c12b3a94f1cad99ce77e  tina-d1-h.tar.bz2.05
5973530baa3b282108351818641c27fd  tina-d1-h.tar.bz2.06
ccd63e1d16534b364a101d2d44416261  tina-d1-h.tar.bz2.07
e0d72713565f4424ea43c07e15a38139  tina-d1-h.tar.bz2.08

确保校验值对上。否则需要重新上传。

解压源码:

ubuntu@ubuntu1804:~/Tina_SDK$ cat tina-d1-h.tar.bz2.* | tar -jxv

等待一段时间,即可解压完成。

ubuntu@ubuntu1804:~/Tina_SDK$ tree -L 1
.
├── tina-d1-h
├── tina-d1-h.tar.bz2.00
├── tina-d1-h.tar.bz2.01
├── tina-d1-h.tar.bz2.02
├── tina-d1-h.tar.bz2.03
├── tina-d1-h.tar.bz2.04
├── tina-d1-h.tar.bz2.05
├── tina-d1-h.tar.bz2.06
├── tina-d1-h.tar.bz2.07
└── tina-d1-h.tar.bz2.08

1 directory, 9 files
ubuntu@ubuntu1804:~/Tina_SDK$ mv tina-d1-h ../

编译固件之前,先安装一些依赖,否则编译会报错:

sudo apt-get install build-essential subversion git libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lib32z1 lib32z1-dev lib32stdc++6 libstdc++6 libc6:i386 libstdc++6:i386 lib32ncurses5 lib32z1 -y

编译出固件

进入源码目录,执行source build/envsetup.shlunch之后,选择2

ubuntu@ubuntu1804:~/tina-d1-h$ source build/envsetup.sh 
Setup env done! Please run lunch next.
ubuntu@ubuntu1804:~/tina-d1-h$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. d1-h_nezha_min-tina
     2. d1-h_nezha-tina
     3. d1s_cvbs-tina
     4. d1s_nezha-tina
     5. t113_100ask_devkit-tina
     6. t113_100ask-tina

Which would you like? [Default d1s_nezha]: 2
============================================
TINA_BUILD_TOP=/home/ubuntu/tina-d1-h
TINA_TARGET_ARCH=riscv
TARGET_PRODUCT=d1-h_nezha
TARGET_PLATFORM=d1-h
TARGET_BOARD=d1-h-nezha
TARGET_PLAN=nezha
TARGET_BUILD_VARIANT=tina
TARGET_BUILD_TYPE=release
TARGET_KERNEL_VERSION=5.4
TARGET_UBOOT=u-boot-2018
TARGET_CHIP=sun20iw1p1
============================================
no buildserver to clean
[1] 66670
ubuntu@ubuntu1804:~/tina-d1-h$ 

接着make编译、pack打包:

ubuntu@ubuntu1804:~/tina-d1-h$ make
...
make[5]: Leaving directory '/home/ubuntu/tina-d1-h/target/allwinner/generic/image'
make[4]: Leaving directory '/home/ubuntu/tina-d1-h/target/allwinner/d1-h-nezha'
make[3]: Leaving directory '/home/ubuntu/tina-d1-h/target/allwinner'
make[2]: Leaving directory '/home/ubuntu/tina-d1-h'
export MAKEFLAGS= ;make -w -r package/index
make[2]: Entering directory '/home/ubuntu/tina-d1-h'
Generating package index...
Signing key has not been configured
make[2]: Leaving directory '/home/ubuntu/tina-d1-h'
make[1]: Leaving directory '/home/ubuntu/tina-d1-h'
[2]+  Done                    $T/tools/build/buildserver --path $T 2> /dev/null 1>&2

#### make completed successfully (15:50 (mm:ss)) ####

ubuntu@ubuntu1804:~/tina-d1-h$ 
ubuntu@ubuntu1804:~/tina-d1-h$ ls
build   Config.in  dl      logs      out      prebuilt   rules.mk  target  toolchain
config  device     lichee  Makefile  package  README.md  scripts   tmp     tools
ubuntu@ubuntu1804:~/tina-d1-h$ pack
--==========--
PACK_CHIP         sun20iw1p1
PACK_PLATFORM     tina
PACK_BOARD        d1-h-nezha
PACK_KERN        
PACK_DEBUG        uart0
PACK_SIG          none
PACK_SECURE       none
PACK_MODE         normal
PACK_FUNC         android
PACK_PROGRAMMER   none
PACK_TAR_IMAGE    none
PACK_TOPDIR       /home/ubuntu/tina-d1-h
--==========--
No kernel param, parse it from d1-h
copying tools file
copying configs file
storage_type value is 5
rm /home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sys_partition_nor.fex
rm /home/ubuntu/tina-d1-h/out/d1-h-nezha/image/image_nor.cfg
copying boot resource

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
copying boot file
make user resource for : /home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sys_partition.fex
handle partition user-res
no user resource partitions
APP_PART_DOWNLOAD_FILE = /home/ubuntu/tina-d1-h/out/d1-h-nezha/image/app.fex
Need size of filesystem
no data resource partitions
don't build dtbo ...
update_chip
pack boot package
GetPrivateProfileSection read to end
content_count=3
LICHEE_REDUNDANT_ENV_SIZE config in BoardConfig.mk
--mkenvimage create redundant env data!--
---redundant env data size 0x20000---
packing for tina linux
normal
mbr count = 4

partitation file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sys_partition.bin
mbr_name file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sunxi_mbr.fex
download_name file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/dlinfo.fex

mbr size = 252
mbr magic softw411
disk name=boot-resource
disk name=env
disk name=env-redund
disk name=boot
disk name=rootfs
disk name=dsp0
disk name=recovery
this is not a partition key
update_for_part_info 0
crc 0 = 4c7bc2df
crc 1 = d9c69382
crc 2 = bc706624
crc 3 = 29cd3779
gpt_head->header_crc32 = 0x892c53ba
GPT----part num 8---
gpt_entry: 128
gpt_header: 92
GPT:boot-resource: a1f8          c177        
GPT:env         : c178          c36f        
GPT:env-redund  : c370          c567        
GPT:boot        : c568          1161f       
GPT:rootfs      : 11620         1b597       
GPT:dsp0        : 1b598         1b987       
GPT:recovery    : 1b988         227c7       
GPT:UDISK       : 227c8         ffffffde    
update gpt file ok
update mbr file ok
temp = 20
mbr count = 4 total_sectors = 15269888 logic_offset = 40960

partitation file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sys_partition.bin
mbr_name file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/sunxi_mbr.fex
download_name file Path=/home/ubuntu/tina-d1-h/out/d1-h-nezha/image/dlinfo.fex

mbr size = 252
mbr magic softw411
disk name=boot-resource
disk name=env
disk name=env-redund
disk name=boot
disk name=rootfs
disk name=dsp0
disk name=recovery
this is not a partition key
update_for_part_info 0
crc 0 = 4c7bc2df
crc 1 = d9c69382
crc 2 = bc706624
crc 3 = 29cd3779
gpt_head->header_crc32 = 0x1328fa28
GPT----part num 8---
gpt_entry: 128
gpt_header: 92
GPT:boot-resource: a1f8          c177        
GPT:env         : c178          c36f        
GPT:env-redund  : c370          c567        
GPT:boot        : c568          1161f       
GPT:rootfs      : 11620         1b597       
GPT:dsp0        : 1b598         1b987       
GPT:recovery    : 1b988         227c7       
GPT:UDISK       : 227c8         e8ffde      
update gpt file ok
update mbr file ok
====================================
show "sys_partition_for_dragon.fex" message
------------------------------------
  [mbr]
  mbr_size  : 252 Kbyte
------------------------------------
  partition_name  : boot-resource
  partition_size  : 8064
  downloadfile  : boot-resource.fex
  boot-resource.fex size : 3.0M byte
------------------------------------
  partition_name  : env
  partition_size  : 504
  downloadfile  : env.fex
  env.fex size : 128K byte
------------------------------------
  partition_name  : env-redund
  partition_size  : 504
  downloadfile  : env.fex
  env.fex size : 128K byte
------------------------------------
  partition_name  : boot
  partition_size  : 20664
  downloadfile  : boot.fex
  boot.fex -> /home/ubuntu/tina-d1-h/out/d1-h-nezha/boot.img
  boot.img size : 5.0M byte
------------------------------------
  partition_name  : rootfs
  partition_size  : 40824
  downloadfile  : rootfs.fex
  rootfs.fex -> /home/ubuntu/tina-d1-h/out/d1-h-nezha/rootfs.img
  rootfs.img size : 16M byte
------------------------------------
  partition_name  : dsp0
  partition_size  : 1008
  downloadfile  : dsp0.fex
  dsp0.fex size : 249K byte
------------------------------------
  partition_name  : recovery
  partition_size  : 28224
------------------------------------
/home/ubuntu/tina-d1-h/out/host/bin/
/home/ubuntu/tina-d1-h/out/d1-h-nezha/image
Begin Parse sys_partion.fex
Add partion boot-resource.fex BOOT-RESOURCE_FEX
Add partion very boot-resource.fex BOOT-RESOURCE_FEX
FilePath: boot-resource.fex
FileLength=2f8c00Add partion env.fex ENV_FEX000000000
Add partion very env.fex ENV_FEX000000000
FilePath: env.fex
FileLength=20000Add partion env.fex ENV_FEX000000000
Add partion very env.fex ENV_FEX000000000
FilePath: env.fex
FileLength=20000Add partion boot.fex BOOT_FEX00000000
Add partion very boot.fex BOOT_FEX00000000
FilePath: boot.fex
FileLength=4f4000Add partion rootfs.fex ROOTFS_FEX000000
Add partion very rootfs.fex ROOTFS_FEX000000
FilePath: rootfs.fex
FileLength=fc0000Add partion dsp0.fex DSP0_FEX00000000
Add partion very dsp0.fex DSP0_FEX00000000
FilePath: dsp0.fex
FileLength=3e38cBuildImg 0
Dragon execute image.cfg SUCCESS !
----------image is for nand/emmc----------
----------image is at----------

/home/ubuntu/tina-d1-h/out/d1-h-nezha/tina_d1-h-nezha_uart0.img

pack finish

打包成功后,镜像文件保存在/home/ubuntu/tina-d1-h/out/d1-h-nezha/tina_d1-h-nezha_uart0.img

烧录固件

把镜像文件传到PC端,打开全志线刷工具 AllwinnertechPhoeniSuit,找到PhoenixSuit.exe ,双击运行:

在这里插入图片描述

选择一键刷机:

在这里插入图片描述

找到镜像路径,选择全盘擦除升级:

在这里插入图片描述

选择好之后,不需要其他界面操作,这时拿起已经连接好的开发板,先按住 FEL 烧写模式按键,之后按一下 RESET 系统复位键,就可以自动进入烧写模式并开始烧写。

在这里插入图片描述

串口打印信息,如下:

[53]HELLO! BOOT0 is starting!
[56]BOOT0 commit : 88480af
[58]set pll start
[60]periph0 has been enabled
[63]set pll end
[64][pmu]: bus read error
[67]board init ok
[69]get_pmu_exist() = -1
[71]DRAM BOOT DRIVE INFO: V0.33
[74]DRAM CLK = 792 MHz
[76]DRAM Type = 3 (2:DDR2,3:DDR3)
[79]DRAMC ZQ value: 0x7b7bfb
[82]DRAM ODT value: 0x42.
[84]ddr_efuse_type: 0x0
[87]DRAM SIZE =512 M
[89]dram_tpr4:0x0
[91]PLL_DDR_CTRL_REG:0xf8004100
[94]DRAM_CLK_REG:0xc0000000
[96][TIMING DEBUG] MR2= 0x18
[100]DRAM simple test OK.
[103]dram size =512
[105]spinand UBOOT_START_BLK_NUM 8 UBOOT_LAST_BLK_NUM 32
[110]block from 8 to 32
[165]Check is correct.
[167]dma 0x301a8 int is not used yet
[171]dma 0x301a8 int is free, you do not need to free it again
[176]Entry_name        = opensbi
[179]Entry_name        = u-boot
[183]Entry_name        = dtb
[186]Jump to second Boot.

OpenSBI auto-t113-linux-V0.8-2-g053d088
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : T-HEAD Xuantie Platform
Platform HART Features : RV64ACDFIMSUVX
Platform Max HARTs     : 1
Current Hart           : 0
Firmware Base          : 0x41fc0400
Firmware Size          : 75 KB
Runtime SBI Version    : 0.2

MIDELEG : 0x0000000000000222
MEDELEG : 0x000000000000b1ff
PMP0    : 0x0000000041fc0000-0x0000000041fdffff (A)
PMP1    : 0x0000000040000000-0x000000007fffffff (A,R,W,X)
PMP2    : 0x0000000080000000-0x00000000bfffffff (A,R,W,X)
PMP3    : 0x0000000000020000-0x0000000000027fff (A,▒

U-Boot 2018.05-g24521d6-dirty (Jun 25 2024 - 02:56:26 -0400) Allwinner Technology

[00.271]DRAM:  512 MiB
[00.273]Relocation Offset is: 1dee9000
[00.277]secure enable bit: 0
[00.280]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz  MBus=300Mhz
[00.286]flash init start
[00.289]workmode = 0,storage type = 0
sspi->base_addr = 0x4025000, the SPI control register:
[VER] 0x4025000 = 0x00010001, [GCR] 0x4025004 = 0x00000083, [TCR] 0x4025008 = 0x00000184
[ICR] 0x4025010 = 0x00000f00, [ISR] 0x4025014 = 0x00000032, [FCR] 0x4025018 = 0x00200020
[FSR] 0x402501c = 0x00000000, [WCR] 0x4025020 = 0x00000000, [CCR] 0x4025024 = 0x00000002
[SDC] 0x4025028 = 0x00002000, [BCR] 0x4025030 = 0x00000000, [TCR] 0x4025034 = 0x00000000
[BCC] 0x4025038 = 0x20000000, [DMA] 0x4025088 = 0x000000e5

[00.336]sunxi-spinand-phy: not detect any munufacture from id table
[00.342]sunxi-spinand-phy: get spi-nand Model from fdt fail
[00.348]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                 0x07b00000      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.462]ubi0: attaching mtd4
[00.557]ubi0: scanning is finished
[00.563]ubi0: attached mtd4 (name "sys", size 123 MiB)
[00.568]ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[00.574]ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048
[00.581]ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[00.587]ubi0: good PEBs: 492, bad PEBs: 0, corrupted PEBs: 0
[00.592]ubi0: user volume: 10, internal volumes: 1, max. volumes count: 128
[00.599]ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[00.607]ubi0: available PEBs: 0, total reserved PEBs: 492, PEBs reserved for bad PEB handling: 20
[00.615]sunxi flash init ok
[00.618]line:703 init_clocks
[00.621]drv_disp_init
request pwm success, pwm0:pwm0:0x2000c00.
[00.638]drv_disp_init finish
[00.640]boot_gui_init:start
[00.643]set disp.dev2_output_type fail. using defval=0
[00.648]lcd_open_flow
[00.650]lcd_cfg_panel_info
[00.653]lcd_open_flow
[00.655]lcd_power_on
[00.680]boot_gui_init:finish
partno erro : can't find partition bootloader
[00.800]lcd_open_flow
[00.802] tft08006 drivers/video/sunxi/disp2/disp/lcd/tft08006.c lcd_panel_init 162
[00.809]lcd_panel_init
[01.283]lcd_open_flow
54 bytes read in 0 ms
[01.288]bmp_name=bootlogo.bmp size 1152054
[01.335]lcd_open_flow
[01.337]lcd_bl_open
FDT ERROR:fdt_get_all_pin:get property handle pinctrl-0 error:FDT_ERR_INTERNAL
sunxi_pwm_pin_set_state, fdt_set_all_pin, ret=-1
[01.350]lcd_open_flow
[01.353]lcd_open_flow
[01.355]LCD open finish
1152054 bytes read in 75 ms (14.6 MiB/s)
[01.491]Loading Environment from SUNXI_FLASH... OK
[01.512]out of usb burn from boot: not need burn key
[01.518]Item0 (Map) magic is bad
partno erro : can't find partition private
[01.544]update bootcmd
[01.556]change working_fdt 0x5eaa8da0 to 0x5ea88da0
No reserved memory region found in source FDT
[01.584]update dts
noncached_alloc(): addr = 0x5eca7080
noncached_alloc(): addr = 0x5eca70c0
noncached_alloc(): addr = 0x5eca7100
noncached_alloc(): addr = 0x5eca7940
phy_mode=rgmii, phy_interface=7
gmac: *** using ephy_clk ***
eth0
Warning: eth0 (eth0) using random MAC address - 62:2c:14:f8:ee:8c

Hit any key to stop autoboot:  0
dsp0:gpio init config fail
dsp0:sharespace config fail
dsp0 version is r528-tina-v1.0.0-release-37-g735b6b4-dirty
DSP0 start ok, img length 254860, booting from 0x400660
[01.901]no vendor_boot partition is found
Android's image name: d1-h-nezha
Detect comp gzip
[02.154]
Starting kernel ...

[    0.000000] Linux version 5.4.61 (ubuntu@ubuntu1804) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #50 PREEMPT Tue Jun 25 06:59:32 UTC 2024
[    0.000000] cma: Reserved 8 MiB at 0x000000005f800000
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] On node 0 totalpages: 131072
[    0.000000]   DMA32 zone: 1792 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 131072 pages, LIFO batch:31
[    0.000000] elf_hwcap is 0x20112d
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129280
[    0.000000] Kernel command line: ubi.mtd=sys ubi.block=0,rootfs earlyprintk=sunxi-uart,0x02500000 clk_ignore_unused initcall_debug=0 console=ttyS0,115200 loglevel=8 root=/dev/ubiblock0_5 rootfstype=squashfs init=/sbin/init partitions=mbr@ubi0_0:boot-resource@ubi0_1:env@ubi0_2:env-redund@ubi0_3:boot@ubi0_4:rootfs@ubi0_5:dsp0@ubi0_6:recovery@ubi0_7:rootfs_data@ubi0_8:UDISK@ubi0_9: cma=8M snum= mac_addr= wifi_mac= bt_mac= specialstr= gpt=1 androidboot.hardware=sun20iw1p1 boot_type=5 androidboot.boot_type=5 gpt=1 uboot_message=2018.05-g24521d
[    0.000000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 495332K/524288K available (6406K kernel code, 663K rwdata, 2165K rodata, 184K init, 336K bss, 20764K reserved, 8192K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] plic: mapped 200 interrupts with 1 handlers for 2 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000006] sched_clock: 64 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000022] riscv_timer_clockevent depends on broadcast, but no broadcast function available
[    0.000311] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000911] Console: colour dummy device 80x25
[    0.000948] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000965] pid_max: default: 32768 minimum: 301
[    0.001130] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.001150] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.002696] ASID allocator initialised with 65536 entries
[    0.002847] rcu: Hierarchical SRCU implementation.
[    0.003453] devtmpfs: initialized
[    0.016485] random: get_random_u32 called from bucket_table_alloc.isra.31+0x4e/0x15e with crng_init=0
[    0.017399] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.017429] futex hash table entries: 256 (order: 0, 6144 bytes, linear)
[    0.017813] pinctrl core: initialized pinctrl subsystem
[    0.019052] NET: Registered protocol family 16
[    0.020928] DMA: preallocated 256 KiB pool for atomic allocations
[    0.021517] cpuidle: using governor menu
[    0.063906] rtc_ccu: sunxi ccu init OK
[    0.072980] clock: sunxi ccu init OK
[    0.073776] clock: sunxi ccu init OK
[    0.102457] iommu: Default domain type: Translated
[    0.102628] sunxi iommu: irq = 4
[    0.103675] SCSI subsystem initialized
[    0.103996] usbcore: registered new interface driver usbfs
[    0.104089] usbcore: registered new interface driver hub
[    0.104190] usbcore: registered new device driver usb
[    0.104349] mc: Linux media interface: v0.10
[    0.104405] videodev: Linux video capture interface: v2.00
[    0.105459] sunxi-msgbox-amp 3003000.msgbox: invalid resource
[    0.106252] Advanced Linux Sound Architecture Driver Initialized.
[    0.106819] Bluetooth: Core ver 2.22
[    0.106894] NET: Registered protocol family 31
[    0.106905] Bluetooth: HCI device and connection manager initialized
[    0.106926] Bluetooth: HCI socket layer initialized
[    0.106940] Bluetooth: L2CAP socket layer initialized
[    0.106974] Bluetooth: SCO socket layer initialized
[    0.107245] pwm module init!
[    0.108757] g2d 5410000.g2d: Adding to iommu group 0
[    0.109209] G2D: rcq version initialized.major:250
[    0.109863] input: sunxi-keyboard as /devices/virtual/input/input0
[    0.111373] clocksource: Switched to clocksource riscv_clocksource
[    0.123010] sun8iw20-pinctrl 2000000.pinctrl: initialized sunXi PIO driver
[    0.137891] thermal_sys: Registered thermal governor 'user_space'
[    0.137897] thermal_sys: Registered thermal governor 'power_allocator'
[    0.138388] NET: Registered protocol family 2
[    0.139140] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.139182] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.139241] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.139288] TCP: Hash tables configured (established 4096 bind 4096)
[    0.139422] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.139460] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.139672] NET: Registered protocol family 1
[    0.140824] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pc not found, using dummy regulator
[    0.141366] spi spi0: spi0 supply spi not found, using dummy regulator
[    0.141679] sunxi_spi_resource_get()2151 - [spi0] SPI MASTER MODE
[    0.141740] sunxi_spi_resource_get()2189 - Failed to get sample mode
[    0.141752] sunxi_spi_resource_get()2194 - Failed to get sample delay
[    0.141762] sunxi_spi_resource_get()2198 - sample_mode:-1431633921 sample_delay:-1431633921
[    0.141818] sunxi_spi_clk_init()2240 - [spi0] mclk 100000000
[    0.142463] sunxi_spi_probe()2653 - [spi0]: driver probe succeed, base ffffffd004060000, irq 31
[    0.144302] Initialise system trusted keyrings
[    0.144493] workingset: timestamp_bits=62 max_order=17 bucket_order=0
[    0.151060] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.170468] Key type asymmetric registered
[    0.170482] Asymmetric key parser 'x509' registered
[    0.170504] io scheduler mq-deadline registered
[    0.170512] io scheduler kyber registered
[    0.170531] atomic64_test: passed
[    0.171741] [DISP]disp_module_init
[    0.172287] disp 5000000.disp: Adding to iommu group 0
[    0.172892] [DISP] disp_init,line:2386:
[    0.172898] smooth display screen:0 type:1 mode:4
[    0.207628] lcd_cfg_panel_info
[    0.207639] tft08006
[    0.207682] display_fb_request,fb_id:0
[    0.223221] Freeing logo buffer memory: 1500K
[    0.223650] disp_al_manager_apply ouput_type:1
[    0.223794] [DISP] lcd_clk_config,line:732:
[    0.223807] disp 0, clk: pll(300000000),clk(300000000),dclk(25000000) dsi_rate(25000000)
[    0.223807]      clk real:pll(300000000),clk(300000000),dclk(75000000) dsi_rate(150000000)
[    0.224184] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pb not found, using dummy regulator
[    0.224891] [DISP]disp_module_init finish
[    0.225740] sunxi_sid_init()551 - insmod ok
[    0.226103] pwm-regulator vdd-cpu: Failed to get PWM: -16
[    0.226131] pwm-regulator: probe of vdd-cpu failed with error -16
[    0.232818] uart uart0: get regulator failed
[    0.232846] uart uart0: uart0 supply uart not found, using dummy regulator
[    0.233177] uart0: ttyS0 at MMIO 0x2500000 (irq = 18, base_baud = 1500000) is a SUNXI
[    0.233202] sw_console_setup()1808 - console setup baud 115200 parity n bits 8, flow n
[    1.063245] printk: console [ttyS0] enabled
[    1.068808] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pg not found, using dummy regulator
[    1.080225] uart uart1: get regulator failed
[    1.085090] uart uart1: uart1 supply uart not found, using dummy regulator
[    1.093121] uart1: ttyS1 at MMIO 0x2500400 (irq = 19, base_baud = 1500000) is a SUNXI
[    1.102998] misc dump reg init
[    1.107246] sunxi-rfkill soc@3000000:rfkill@0: module version: v1.0.9
[    1.114493] sunxi-rfkill soc@3000000:rfkill@0: get gpio chip_en failed
[    1.121855] sunxi-rfkill soc@3000000:rfkill@0: get gpio power_en failed
[    1.129242] sunxi-rfkill soc@3000000:rfkill@0: wlan_busnum (1)
[    1.135805] sunxi-rfkill soc@3000000:rfkill@0: Missing wlan_power.
[    1.142741] sunxi-rfkill soc@3000000:rfkill@0: wlan clock[0] (32k-fanout1)
[    1.150439] sunxi-rfkill soc@3000000:rfkill@0: wlan_regon gpio=44 assert=1
[    1.158229] sunxi-rfkill soc@3000000:rfkill@0: wlan_hostwake gpio=202 assert=1
[    1.166360] sunxi-rfkill soc@3000000:rfkill@0: wakeup source is enabled
[    1.174043] sunxi-rfkill soc@3000000:rfkill@0: Missing bt_power.
[    1.180762] sunxi-rfkill soc@3000000:rfkill@0: bt clock[0] (32k-fanout1)
[    1.188353] sunxi-rfkill soc@3000000:rfkill@0: bt_rst gpio=210 assert=0
[    1.196514] [ADDR_MGT] addr_mgt_probe: module version: v1.0.10
[    1.204188] [ADDR_MGT] addr_mgt_probe: success.
[    1.210142] sunxi-spinand: AW SPINand MTD Layer Version: 2.0 20201228
[    1.217408] sunxi-spinand-phy: AW SPINand Phy Layer Version: 1.10 20200306
[    1.225321] sunxi-spinand-phy: not detect any munufacture from id table
[    1.232764] sunxi-spinand-phy: get spi-nand Model from fdt fail
[    1.239385] sunxi-spinand-phy: get phy info from fdt fail
[    1.245430] sunxi-spinand-phy: not detect munufacture from fdt
[    1.252110] sunxi-spinand-phy: detect munufacture from id table: Winbond
[    1.259604] sunxi-spinand-phy: detect spinand id: ff21aaef ffffffff
[    1.266615] sunxi-spinand-phy: ========== arch info ==========
[    1.273167] sunxi-spinand-phy: Model:               W25N01GVZEIG
[    1.279863] sunxi-spinand-phy: Munufacture:         Winbond
[    1.286095] sunxi-spinand-phy: DieCntPerChip:       1
[    1.291772] sunxi-spinand-phy: BlkCntPerDie:        1024
[    1.297690] sunxi-spinand-phy: PageCntPerBlk:       64
[    1.303437] sunxi-spinand-phy: SectCntPerPage:      4
[    1.309081] sunxi-spinand-phy: OobSizePerPage:      64
[    1.314831] sunxi-spinand-phy: BadBlockFlag:        0x0
[    1.320652] sunxi-spinand-phy: OperationOpt:        0x7
[    1.326520] sunxi-spinand-phy: MaxEraseTimes:       65000
[    1.332562] sunxi-spinand-phy: EccFlag:             0x0
[    1.338384] sunxi-spinand-phy: EccType:             2
[    1.344058] sunxi-spinand-phy: EccProtectedType:    3
[    1.349687] sunxi-spinand-phy: ========================================
[    1.357131] sunxi-spinand-phy:
[    1.360631] sunxi-spinand-phy: ========== physical info ==========
[    1.367541] sunxi-spinand-phy: TotalSize:    128 M
[    1.372899] sunxi-spinand-phy: SectorSize:   512 B
[    1.378254] sunxi-spinand-phy: PageSize:     2 K
[    1.383422] sunxi-spinand-phy: BlockSize:    128 K
[    1.388757] sunxi-spinand-phy: OOBSize:      64 B
[    1.394044] sunxi-spinand-phy: ========================================
[    1.401440] sunxi-spinand-phy:
[    1.404936] sunxi-spinand-phy: ========== logical info ==========
[    1.411772] sunxi-spinand-phy: TotalSize:    128 M
[    1.417111] sunxi-spinand-phy: SectorSize:   512 B
[    1.422472] sunxi-spinand-phy: PageSize:     4 K
[    1.427631] sunxi-spinand-phy: BlockSize:    256 K
[    1.432992] sunxi-spinand-phy: OOBSize:      128 B
[    1.438329] sunxi-spinand-phy: ========================================
[    1.445863] sunxi-spinand-phy: block lock register: 0x00
[    1.451967] sunxi-spinand-phy: feature register: 0x19
[    1.457605] sunxi-spinand-phy: sunxi physic nand init end
[    1.464272] Creating 4 MTD partitions on "sunxi_mtd_nand":
[    1.470399] 0x000000000000-0x000000100000 : "boot0"
[    1.482551] 0x000000100000-0x000000500000 : "uboot"
[    1.490925] random: fast init done
[    1.512572] 0x000000500000-0x000000600000 : "secure_storage"
[    1.532519] 0x000000600000-0x000008000000 : "sys"
[    1.733115] libphy: Fixed MDIO Bus: probed
[    1.737689] CAN device driver interface
[    1.743097] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pe not found, using dummy regulator
[    1.754440] sunxi gmac driver's version: 1.0.0
[    1.759554] gmac-power0: NULL
[    1.762911] gmac-power1: NULL
[    1.766216] gmac-power2: NULL
[    1.770656] Failed to alloc md5
[    1.774250] eth0: Use random mac address
[    1.778955] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.786363] sunxi-ehci: EHCI SUNXI driver
[    1.791357] get ehci1-controller wakeup-source is fail.
[    1.797379] sunxi ehci1-controller don't init wakeup source
[    1.803712] [sunxi-ehci1]: probe, pdev->name: 4200000.ehci1-controller, sunxi_ehci: 0xffffffe000962758, 0x:ffffffd00407c000, irq_no:31
[    1.817272] sunxi-ehci 4200000.ehci1-controller: 4200000.ehci1-controller supply drvvbus not found, using dummy regulator
[    1.829857] sunxi-ehci 4200000.ehci1-controller: 4200000.ehci1-controller supply hci not found, using dummy regulator
[    1.842114] sunxi-ehci 4200000.ehci1-controller: EHCI Host Controller
[    1.849334] sunxi-ehci 4200000.ehci1-controller: new USB bus registered, assigned bus number 1
[    1.859202] sunxi-ehci 4200000.ehci1-controller: irq 49, io mem 0x04200000
[    1.891419] sunxi-ehci 4200000.ehci1-controller: USB 2.0 started, EHCI 1.00
[    1.899192] sunxi-ehci 4200000.ehci1-controller: ehci_irq: highspeed device connect
[    1.908691] hub 1-0:1.0: USB hub found
[    1.913001] hub 1-0:1.0: 1 port detected
[    1.918153] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.925184] sunxi-ohci: OHCI SUNXI driver
[    1.930181] get ohci1-controller wakeup-source is fail.
[    1.936194] sunxi ohci1-controller don't init wakeup source
[    1.942496] [sunxi-ohci1]: probe, pdev->name: 4200400.ohci1-controller, sunxi_ohci: 0xffffffe0009632b0
[    1.952932] sunxi-ohci 4200400.ohci1-controller: 4200400.ohci1-controller supply drvvbus not found, using dummy regulator
[    1.965478] sunxi-ohci 4200400.ohci1-controller: 4200400.ohci1-controller supply hci not found, using dummy regulator
[    1.977718] sunxi-ohci 4200400.ohci1-controller: OHCI Host Controller
[    1.984975] sunxi-ohci 4200400.ohci1-controller: new USB bus registered, assigned bus number 2
[    1.994798] sunxi-ohci 4200400.ohci1-controller: irq 50, io mem 0x04200400
[    2.076326] hub 2-0:1.0: USB hub found
[    2.080570] hub 2-0:1.0: 1 port detected
[    2.086001] usbcore: registered new interface driver uas
[    2.092203] usbcore: registered new interface driver usb-storage
[    2.098963] usbcore: registered new interface driver ums-alauda
[    2.105710] usbcore: registered new interface driver ums-cypress
[    2.112568] usbcore: registered new interface driver ums-datafab
[    2.119327] usbcore: registered new interface driver ums_eneub6250
[    2.126371] usbcore: registered new interface driver ums-freecom
[    2.133353] usbcore: registered new interface driver ums-isd200
[    2.140017] usbcore: registered new interface driver ums-jumpshot
[    2.146979] usbcore: registered new interface driver ums-karma
[    2.153601] usbcore: registered new interface driver ums-onetouch
[    2.160510] usbcore: registered new interface driver ums-realtek
[    2.167326] usbcore: registered new interface driver ums-sddr09
[    2.174035] usbcore: registered new interface driver ums-sddr55
[    2.180740] usbcore: registered new interface driver ums-usbat
[    2.187931] sunxi_gpadc_init,2151, success
[    2.194794] sunxi-rtc 7090000.rtc: registered as rtc0
[    2.200543] sunxi-rtc 7090000.rtc: setting system clock to 1970-01-01T00:01:19 UTC (79)
[    2.209577] sunxi-rtc 7090000.rtc: sunxi rtc probed
[    2.215667] i2c /dev entries driver
[    2.219651] IR NEC protocol handler initialized
[    2.225143] sunxi-rc-recv 7040000.s_cir: sunxi_irrx_resource_get: get ir protocol failed
[    2.234350] Registered IR keymap rc_map_sunxi
[    2.239323] rc rc0: sunxi-ir as /devices/platform/soc@3000000/7040000.s_cir/rc/rc0
[    2.248053] rc rc0: lirc_dev: driver sunxi-rc-recv registered at minor = 0, raw IR receiver, no transmitter
[    2.259150] input: sunxi-ir as /devices/platform/soc@3000000/7040000.s_cir/rc/rc0/s_cir_rx
[    2.269480] sunxi cedar version 1.1
[    2.273701] sunxi-cedar 1c0e000.ve: Adding to iommu group 0
[    2.279972] VE: install start!!!
[    2.279972]
[    2.285283] usb 1-1: new high-speed USB device number 2 using sunxi-ehci
[    2.293018] VE: cedar-ve the get irq is 6
[    2.293018]
[    2.299387] VE: ve_debug_proc_info:(____ptrval____), data:(____ptrval____), lock:(____ptrval____)
[    2.299387]
[    2.311028] VE: install end!!!
[    2.311028]
[    2.316213] VE: sunxi_cedar_probe
[    2.321557] sunxi-wdt 6011000.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    2.330746] Bluetooth: HCI UART driver ver 2.3
[    2.335744] Bluetooth: HCI UART protocol H4 registered
[    2.341500] Bluetooth: HCI UART protocol BCSP registered
[    2.347428] Bluetooth: XRadio Bluetooth LPM Mode Driver Ver 1.0.10
[    2.354736] [XR_BT_LPM] bluesleep_probe: bt_wake polarity: 1
[    2.361079] sun8iw20-pinctrl 2000000.pinctrl: pin PG16 already requested by 7040000.s_cir; cannot claim for 2000000.pinctrl:208
[    2.373967] sun8iw20-pinctrl 2000000.pinctrl: pin-208 (2000000.pinctrl:208) status -22
[    2.382857] Bluetooth: can't request bt_wake gpio 208
[    2.388510] sunxi-btlpm: probe of soc@3000000:btlpm@0 failed with error -22
[    2.398188] sunxi-mmc 4021000.sdmmc: SD/MMC/SDIO Host Controller Driver(v4.21 2021-11-18 10:02)
[    2.408192] sunxi-mmc 4021000.sdmmc: ***ctl-spec-caps*** 8
[    2.414407] sunxi-mmc 4021000.sdmmc: No vmmc regulator found
[    2.420743] sunxi-mmc 4021000.sdmmc: No vqmmc regulator found
[    2.427178] sunxi-mmc 4021000.sdmmc: No vdmmc regulator found
[    2.433642] sunxi-mmc 4021000.sdmmc: No vd33sw regulator found
[    2.440147] sunxi-mmc 4021000.sdmmc: No vd18sw regulator found
[    2.446673] sunxi-mmc 4021000.sdmmc: No vq33sw regulator found
[    2.453229] sunxi-mmc 4021000.sdmmc: No vq18sw regulator found
[    2.459759] sunxi-mmc 4021000.sdmmc: Cann't get pin bias hs pinstate,check if needed
[    2.469497] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.480638] sunxi-mmc 4021000.sdmmc: no vqmmc,Check if there is regulator
[    2.500857] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.514064] hub 1-1:1.0: USB hub found
[    2.518457] hub 1-1:1.0: 4 ports detected
[    2.523012] sunxi-mmc 4021000.sdmmc: detmode:manually by software
[    2.530756] sunxi_led_probe()1749 - start
[    2.535386] sunxi_get_str_of_property()1595 - failed to get the string of propname led_regulator!
[    2.545326] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 52, RTO !!
[    2.552447] sunxi_register_led_classdev()1483 - led_classdev start
[    2.559374] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 52, RTO !!
[    2.566267] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.583233] sunxi_led_probe()1845 - finish
[    2.588435] usbcore: registered new interface driver usbhid
[    2.594848] usbhid: USB HID core driver
[    2.599290] rpmsg_client_dsp_standby 3003000.msgbox.sunxi,dsp-power-msgbox.512.256: new channel: 0x200 -> 0x100!
[    2.612043] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[    2.624365] usbcore: registered new interface driver snd-usb-audio
[    2.633914] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pd not found, using dummy regulator
[    2.646314] sunxi-daudio 2034000.daudio: regulator missing or invalid
[    2.653570] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 5, RTO !!
[    2.661171] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 5, RTO !!
[    2.668032] [AUDIOCODEC][sunxi_codec_parse_params][2412]:digital_vol:0, lineout_vol:26, mic1gain:19, mic2gain:19 pa_msleep:120, pa_level:1, pa_pwr_level:1
[    2.668032]
[    2.685111] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 5, RTO !!
[    2.692007] [AUDIOCODEC][sunxi_codec_parse_params][2448]:adcdrc_cfg:0, adchpf_cfg:1, dacdrc_cfg:0, dachpf:0
[    2.702900] sunxi-mmc 4021000.sdmmc: smc 0 p1 err, cmd 5, RTO !!
[    2.709697] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12) dt B
[    2.721345] [AUDIOCODEC][sunxi_internal_codec_probe][2609]:codec probe finished
[    2.731246] sid_rd_ver_reg()254 - ver >= 4, soc ver:5
[    2.737112] debugfs: Directory '203034c.dummy_cpudai' with parent 'audiocodec' already present!
[    2.746939] [SNDCODEC][sunxi_card_init][583]:card init finished
[    2.755719] sunxi-codec-machine 2030340.sound: 2030000.codec <-> 203034c.dummy_cpudai mapping ok
[    2.772435] input: audiocodec sunxi Audio Jack as /devices/platform/soc@3000000/2030340.sound/sound/card0/input2
[    2.784506] [SNDCODEC][sunxi_card_dev_probe][836]:register card finished
[    2.792794] sunxi-rpaf-dsp soc@3000000:rpaf-dsp@203034c: register device finished!
[    2.801241] sunxi-rpaf-dsp soc@3000000:rpaf-dsp@203034c: [rpaf_dsp0] probe finished!
[    2.810335] rpmsg_hifi 3003000.msgbox.sunxi,dsp-msgbox.514.258: id:sunxi,dsp-msgbox new channel: 0x202 -> 0x102!
[    2.821878] rpmsg_hifi 3003000.msgbox.sunxi,dsp-msgbox.514.258: rpmsg hifi[0] client driver is probed
[    2.833780] NET: Registered protocol family 10
[    2.840125] Segment Routing with IPv6
[    2.844515] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.851953] NET: Registered protocol family 17
[    2.856969] can: controller area network core (rev 20170425 abi 9)
[    2.864076] NET: Registered protocol family 29
[    2.869041] can: raw protocol (rev 20170425)
[    2.873834] can: broadcast manager protocol (rev 20170425 t)
[    2.880177] can: netlink gateway (rev 20190810) max_hops=1
[    2.886609] Bluetooth: RFCOMM TTY layer initialized
[    2.892153] Bluetooth: RFCOMM socket layer initialized
[    2.897933] Bluetooth: RFCOMM ver 1.11
[    2.903168] Loading compiled-in X.509 certificates
[    2.910707] HDMI 2.0 driver init start!
[    2.915106] boot_hdmi=false
[    2.918286] ERROR: pinctrl_get for HDMI2.0 DDC fail
[    2.925306] HDMI2.0 module init end
[    2.954998] sunxi-i2c sunxi-i2c2: sunxi-i2c2 supply twi not found, using dummy regulator
[    2.971010] input: fts_ts as /devices/platform/soc@3000000/sunxi-i2c2/i2c-2/2-0038/input/input3
[    2.981200] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    2.989304] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.021548] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.029148] fts_ts 2-0038: 2-0038 supply  not found, using dummy regulator
[    3.037167] fts_ts 2-0038: 2-0038 supply  not found, using dummy regulator
[    3.044906] debugfs: Directory '2-0038-' with parent 'reg-dummy-regulator-dummy' already present!
[    3.311557] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.319656] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.361531] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.369612] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.411552] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.419649] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.461544] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.469640] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.511551] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.519649] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.561531] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.569612] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.611550] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.619666] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.661526] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.669625] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.711554] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.719668] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.761527] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.769624] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.811540] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.819636] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.861534] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.869633] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.911566] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.919683] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    3.961530] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    3.969609] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    4.011554] sunxi-i2c sunxi-i2c2: SLA+W has been transmitted; ACK not received
[    4.019653] sunxi-i2c sunxi-i2c2: engine-mode: xfer failed(dev addr:0x38)
[    4.061677] sunxi-i2c sunxi-i2c2: probe success
[    4.070880] debugfs: Directory '2031000.dmic' with parent 'snddmic' already present!
[    4.081098] sunxi-audio-card 2031060.sounddmic: dmic-hifi <-> 2031000.dmic mapping ok
[    4.091101] get ehci0-controller wakeup-source is fail.
[    4.097104] sunxi ehci0-controller don't init wakeup source
[    4.103362] [sunxi-ehci0]: probe, pdev->name: 4101000.ehci0-controller, sunxi_ehci: 0xffffffe000962390, 0x:ffffffd004bca000, irq_no:2e
[    4.116915] [sunxi-ehci0]: Not init ehci0
[    4.121874] get ohci0-controller wakeup-source is fail.
[    4.127836] sunxi ohci0-controller don't init wakeup source
[    4.134116] [sunxi-ohci0]: probe, pdev->name: 4101400.ohci0-controller, sunxi_ohci: 0xffffffe000962ee8
[    4.144554] [sunxi-ohci0]: Not init ohci0
[    4.149457] ubi0: attaching mtd3
[    4.489346] random: crng init done
[    4.547059] ubi0: scanning is finished
[    4.562100] ubi0 warning: ubi_eba_init: cannot reserve enough PEBs for bad PEB handling, reserved 16, need 20
[    4.575844] ubi0: attached mtd3 (name "sys", size 122 MiB)
[    4.582007] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[    4.589699] ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048
[    4.597310] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.605131] ubi0: good PEBs: 488, bad PEBs: 0, corrupted PEBs: 0
[    4.611868] ubi0: user volume: 10, internal volumes: 1, max. volumes count: 128
[    4.620035] ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[    4.629372] ubi0: available PEBs: 0, total reserved PEBs: 488, PEBs reserved for bad PEB handling: 16
[    4.639728] ubi0: background thread "ubi_bgt0d" started, PID 70
[    4.648304] block ubiblock0_5: created from ubi0:5(rootfs)
[    4.656347] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    4.667201] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    4.674859] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    4.684537] clk: Not disabling unused clocks
[    4.689329] ALSA device list:
[    4.692762] cfg80211: failed to load regulatory.db
[    4.698177]   #0: audiocodec
[    4.701452]   #1: snddmic
[    4.704380] alloc_fd: slot 0 not NULL!
[    4.712604] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    4.724171] devtmpfs: mounted
[    4.727648] Freeing unused kernel memory: 184K
[    4.732686] This architecture does not have kernel memory protection.
[    4.739896] Run /sbin/init as init process
[    5.540788] init: Console is alive
[    5.544987] init: - watchdog -
[    5.548530] init: - preinit -
[    6.806363] hdmi_hpd_sys_config_release
/dev/by-name/UDISK already format by ubifs
/dev/by-name/rootfs_data already format by ubifs
[    6.932034] mount_root: loading kmods from internal overlay
[    7.178600] block: attempting to load /etc/config/fstab
[    7.207531] UBIFS (ubi0:9): Mounting in unauthenticated mode
[    7.214373] UBIFS (ubi0:9): background thread "ubifs_bgt0_9" started, PID 117
[    7.322289] UBIFS (ubi0:9): recovery needed
[    7.595009] UBIFS (ubi0:9): recovery completed
[    7.600582] UBIFS (ubi0:9): UBIFS: mounted UBI device 0, volume 9, name "UDISK"
[    7.608856] UBIFS (ubi0:9): LEB size: 258048 bytes (252 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[    7.619967] UBIFS (ubi0:9): FS size: 53673984 bytes (51 MiB, 208 LEBs), journal size 7741440 bytes (7 MiB, 30 LEBs)
[    7.631699] UBIFS (ubi0:9): reserved for root: 0 bytes (0 KiB)
[    7.638207] UBIFS (ubi0:9): media format: w4/r0 (latest is w5/r0), UUID 0F597857-8DF5-4158-BE5D-801B4C610776, small LPT model
[    7.655206] block: extroot: UUID match (root: 14aa15db-35e00f98-1674d058-b2b76b5f, overlay: 14aa15db-35e00f98-1674d058-b2b76b5f)
[    7.678473] mount_root: switched to extroot
[    7.698526] procd: - early -
[    7.702102] procd: - watchdog -
[    8.102634] procd: - watchdog -
[    8.106465] procd: - ubus -
[    8.110233] procd (1): /proc/128/oom_adj is deprecated, please use /proc/128/oom_score_adj instead.
[    8.231464]
[    8.231464] insmod_device_driver
[    8.231464]
[    8.238620] sunxi_usb_udc 4100000.udc-controller: 4100000.udc-controller supply udc not found, using dummy regulator
[    8.455153] procd: - init -
Please press Enter to activate this console.
[    9.367332] fuse: init (API version 7.31)
[    9.652921] usbcore: registered new interface driver uvcvideo
[    9.700342] USB Video Class driver (1.1.1)
[    9.947238] file system registered
[   10.136731] configfs-gadget 4100000.udc-controller: failed to start g1: -19
[   10.584643] read descriptors
[   10.587868] read strings
[   10.771638] sunxi_set_cur_vol_work()397 WARN: get power supply failed
[   10.813963] android_work: sent uevent USB_STATE=CONNECTED
[   10.970922] sunxi_set_cur_vol_work()397 WARN: get power supply failed
[   11.032261] configfs-gadget gadget: high-speed config #1: c
[   11.038600] android_work: sent uevent USB_STATE=CONFIGURED
[   11.061464] sunxi_vbus_det_work()3356 WARN: get power supply failed
[   11.081660] android_work: sent uevent USB_STATE=DISCONNECTED
[   11.639655] android_work: sent uevent USB_STATE=CONNECTED
[   12.861861] ======== XRADIO WIFI OPEN ========
[   12.876291] [XRADIO] Driver Label:XR_V02.16.85_P2P_HT40_01.31
[   12.890370] [XRADIO] Allocated hw_priv @ 000000008a45bbe0
[   12.911506] sunxi-rfkill soc@3000000:rfkill@0: bus_index: 1
[   12.927757] sunxi-rfkill soc@3000000:rfkill@0: wlan power on success
[   13.192456] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12) dt B
[   13.203999] [XRADIO] Detect SDIO card 1
[   13.221934] sunxi-mmc 4021000.sdmmc: no vqmmc,Check if there is regulator
[   13.241446] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   13.267967] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   13.285285] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SDR12) dt B
[   13.310972] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing SD-HS(SDR25) dt B
[   13.331938] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 1 timing SD-HS(SDR25) dt B
[   13.356333] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 50000000Hz bm PP pm ON vdd 21 width 4 timing SD-HS(SDR25) dt B
[   13.379484] mmc0: new high speed SDIO card at address 0001
[   13.398023] [SBUS] XRadio Device:sdio clk=50000000
[   13.404845] [XRADIO] XRADIO_HW_REV 1.0 detected.
[   13.512096] [XRADIO] xradio_update_dpllctrl: DPLL_CTRL Sync=0x01400000.
[   13.585205] [XRADIO] Bootloader complete
[   13.751601] [XRADIO] Firmware completed.
[   13.762818] [WSM] Firmware Label:XR_C09.08.52.64_DBG_02.100 2GHZ HT40 Jan  3 2020 13:14:37
[   13.791479] [XRADIO] Firmware Startup Done.
[   13.801820] [XRADIO_WRN] enable Multi-Rx!
[   13.821092] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   13.874500] xt_time: kernel timezone is -0000
[   13.911779] Error: Driver 'gt9xxnew_ts' is already registered, aborting...
kmodloader done
[   14.656076] ieee80211_do_open: vif_type=2, p2p=0, ch=3, addr=00:65:d8:1d:b6:8e
[   14.681553] [STA] !!!xradio_vif_setup: id=0, type=2, p2p=0, addr=00:65:d8:1d:b6:8e
[   14.712564] [AP_WRN] BSS_CHANGED_ASSOC but driver is unjoined.
[   17.264412] libphy: 4500000.eth: probed
[   17.268701] sunxi-gmac 4500000.eth eth0: No PHY found!
[   17.564261] libphy: 4500000.eth: probed
[   17.568578] sunxi-gmac 4500000.eth eth0: No PHY found!
Trying to connect to SWUpdate...
[   17.602210] sunxi-gmac 4500000.eth eth0: phy init failed
[   17.626982] br-lan: port 1(eth0) entered blocking state
[   17.665325] br-lan: port 1(eth0) entered disabled state
[   17.910180] [SNDCODEC][sunxi_card_hw_params][620]:stream_flag: 0
[   17.924492] device eth0 entered promiscuous mode
[   21.976053] [STA_WRN] Freq 2442 (wsm ch: 7) prev: 3.
[   21.994314] wlan0: authenticate with 94:d9:b3:b7:c9:0a (try 1)
[   22.007660] [STA_WRN] [HT40][xradio_join_work][bss_ht_info]:
[   22.007660] [primary_chan  :0x00000007]
[   22.007660] [ht_param      :0x0000000f]
[   22.007660] [operation_mode:0x00000006]
[   22.007660] [stbc_param    :0x00000000]
[   22.007660] [basic_set[0]  :0x00000000]
[   22.074197] [STA_WRN] [HT40][xradio_join_work][PhyModeCfg:0x0027]
[   22.074197] [ModemFlags    :0x00000007]
[   22.074197] [ChWidthCfg    :0x00000002]
[   22.074197] [PriChCfg      :0x00000000]
[   22.074197] [BandCfg       :0x00000000]
[   22.074197] [STBC_Enable   :0x00000000]
[   22.074197] [PreambleCfg   :0x00000000]
[   22.074197] [SGI_Enable    :0x00000000]
[   22.074197] GF_Enable      :0x00000000]
[   22.412103] [TXRX_WRN] [RX] IF=0, No key found.
[   22.514074] wlan0: authenticate with 94:d9:b3:b7:c9:0a (try 2)
[   22.534240] wlan0: authenticated
[   22.541050] wlan0: associate with 94:d9:b3:b7:c9:0a (try 1)
[   22.606343] wlan0: RX AssocResp from 94:d9:b3:b7:c9:0a (capab=0x431 status=0 aid=8)
[   22.629980] wlan0: associated
[   22.639652] [AP_WRN] [STA] ASSOC HTCAP 11N 58
[   22.654007] [AP_WRN] [HT40][xradio_bss_info_changed][ht_prot:0x0000000a][HtProtMode:0x0002][Green:0x0004]
[   22.654455] [AP_WRN] [HT40][xradio_bss_info_changed][PhyModeCfg:0x5027]
[   22.654455] [ModemFlags    :0x00000007]
[   22.654455] [ChWidthCfg    :0x00000002]
[   22.654455] [PriChCfg      :0x00000000]
[   22.654455] [BandCfg       :0x00000000]
[   22.654455] [STBC_Enable   :0x00000000]
[   22.654455] [PreambleCfg   :0x00000001]
[   22.654455] [SGI_Enable    :0x00000001]
[   22.654455] [GF_Enable     :0x00000000]
[   22.815551] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready



BusyBox v1.27.2 () built-in shell (ash)

 _____  _              __     _
|_   _||_| ___  _ _   |  |   |_| ___  _ _  _ _
  | |   _ |   ||   |  |  |__ | ||   || | ||_'_|
  | |  | || | || _ |  |_____||_||_|_||___||_,_|
  |_|  |_||_|_||_|_|  Tina is Based on OpenWrt!
 ----------------------------------------------
 Tina Linux (Neptune, 61CC0487)
 ----------------------------------------------
root@TinaLinux:/#

MIPI屏适配

100ASK-D1-H_DualDisplay-DevKit V11

1. 显示适配

1.1 修改设备树

1.1.1 修改内核设备树

进入目录:

cd /home/ubuntu/tina-d1-h/device/config/chips/d1-h/configs/nezha/linux-5.4

修改board.dts:

&lcd0 {
        lcd_used            = <1>;

        lcd_driver_name     = "tft08006";
        lcd_backlight       = <100>;
        lcd_if              = <4>;

        lcd_x               = <480>;
        lcd_y               = <800>;
        lcd_width           = <52>;
        lcd_height          = <52>;
        lcd_dclk_freq       = <25>;

        lcd_pwm_used        = <1>;
        lcd_pwm_ch          = <0>;
        lcd_pwm_freq        = <1000>;
        lcd_pwm_pol         = <0>;
        lcd_pwm_max_limit   = <255>;

        lcd_hbp             = <10>;
        lcd_ht              = <515>;
        lcd_hspw            = <5>;
        lcd_vbp             = <20>;
        lcd_vt              = <830>;
        lcd_vspw            = <5>;

        lcd_dsi_if          = <0>;
        lcd_dsi_lane        = <2>;
        lcd_lvds_if         = <0>;
        lcd_lvds_colordepth = <0>;
        lcd_lvds_mode       = <0>;
        lcd_frm             = <0>;
        lcd_hv_clk_phase    = <0>;
        lcd_hv_sync_polarity= <0>;
        lcd_gamma_en        = <0>;
        lcd_bright_curve_en = <0>;
        lcd_cmap_en         = <0>;
        lcd_fsync_en        = <0>;
        lcd_fsync_act_time  = <1000>;
        lcd_fsync_dis_time  = <1000>;
        lcd_fsync_pol       = <0>;

        deu_mode            = <0>;
        lcdgamma4iep        = <22>;
        smart_color         = <90>;

        lcd_gpio_0 =  <&pio PG 13 GPIO_ACTIVE_HIGH>;
        pinctrl-0 = <&dsi4lane_pins_a>;
        pinctrl-1 = <&dsi4lane_pins_b>;
};

根据原理图:

在这里插入图片描述

可以查看到,mipi屏的pwm通道引脚是PB5,设备树中搜索PB5,发现有I2C设备树节点占用,需要把status位设置为disabled

在这里插入图片描述

lcd0设备树节点中的pwm通道是pwm0,即把pwm0设备树节点的引脚改为相应的PB5引脚:

在这里插入图片描述

1.1.2 修改uboot设备树

进入目录:

/home/ubuntu/tina-d1-h/device/config/chips/d1-h/configs/nezha

修改uboot-board.dts:

&lcd0 {
        lcd_used            = <1>;

        lcd_driver_name     = "tft08006";
        lcd_backlight       = <100>;
        lcd_if              = <4>;

        lcd_x               = <480>;
        lcd_y               = <800>;
        lcd_width           = <52>;
        lcd_height          = <52>;
        lcd_dclk_freq       = <25>;

        lcd_pwm_used        = <1>;
        lcd_pwm_ch          = <0>;
        lcd_pwm_freq        = <1000>;
        lcd_pwm_pol         = <0>;
        lcd_pwm_max_limit   = <255>;

        lcd_hbp             = <10>;
        lcd_ht              = <515>;
        lcd_hspw            = <5>;
        lcd_vbp             = <20>;
        lcd_vt              = <830>;
        lcd_vspw            = <5>;

        lcd_dsi_if          = <0>;
        lcd_dsi_lane        = <2>;
        lcd_lvds_if         = <0>;
        lcd_lvds_colordepth = <0>;
        lcd_lvds_mode       = <0>;
        lcd_frm             = <0>;
        lcd_hv_clk_phase    = <0>;
        lcd_hv_sync_polarity= <0>;
		lcd_io_phase        = <0x0000>;
		lcd_dsi_te	        = <0>;
        lcd_gamma_en        = <0>;
        lcd_bright_curve_en = <0>;
        lcd_cmap_en         = <0>;
        lcd_fsync_en        = <0>;
        lcd_fsync_act_time  = <1000>;
        lcd_fsync_dis_time  = <1000>;
        lcd_fsync_pol       = <0>;

        deu_mode            = <0>;
        lcdgamma4iep        = <22>;
        smart_color         = <90>;

        lcd_gpio_0 =  <&pio PG 13 GPIO_ACTIVE_HIGH>;
        pinctrl-0 = <&dsi4lane_pins_a>;
        pinctrl-1 = <&dsi4lane_pins_b>;
};

1.2 内核配置

修改内核驱动:

进入目录:

~/tina-d1-h/lichee/linux-5.4/drivers/video/fbdev/sunxi/disp2/disp/lcd

在这里100ASK_T113-PRO开发板适配4寸MIPI屏-Tina SDK - Allwinner / T113s3-PRO - 嵌入式开发问答社区可以下载到相应的驱动,替换到TinaSDK里面的tft08006.ctft08006.h

并修改如下:
在这里插入图片描述

执行ckernel,进入内核配置界面:

m kernel_menuconfig

选上屏幕显示驱动TFT08006

在这里插入图片描述

选上支持显示框架驱动:

在这里插入图片描述

"DISP Driver Support"关乎显示驱动框架的整体启用,而"LCD panels select"则专注于在这个框架下选择和配置具体的LCD面板硬件。前者是基础支持层,后者是具体应用层。

1.3 uboot配置

修改uboot下的驱动:

进入目录:

~/tina-d1-h/lichee/brandy-2.0/u-boot-2018/drivers/video/sunxi/disp2/disp/lcd

在这里100ASK_T113-PRO开发板适配4寸MIPI屏-Tina SDK - Allwinner / T113s3-PRO - 嵌入式开发问答社区可以下载到相应的驱动,替换到TinaSDK里面的tft08006.ctft08006.h

并修改如下:

在这里插入图片描述

执行cboot,进入uboot配置界面:

make menuconfig

选上屏幕显示驱动:

在这里插入图片描述

选上支持显示框架驱动:

在这里插入图片描述

mipi屏幕显示需要先在uboot阶段初始化。

1.4 显示测试

为了方便测试屏幕显示,可以选上TinaSDK自带的lvgl例程。

执行croot,进入配置界面:

make menuconfig

选上lvgl例程:

在这里插入图片描述

编译make,打包pack

烧录到板子后,执行lv_examples 1:

在这里插入图片描述

2. 触摸适配

2.1 修改内核设备树

根据原理图:

在这里插入图片描述

可以查看:

TP_INT→PB6;TP_RESET→PB4;DSI_SCL→PB0;DSI_SDA→PB1;

进入:

vi /home/ubuntu/tina-d1-h/device/config/chips/d1-h/configs/nezha/linux-5.4/board.dts

在这里插入图片描述

看到PB0、PB1引脚对应的是twi2设备树节点。所以需要在twi2设备树节点中添加触摸屏设备树节点。

&twi2 {
        clock-frequency = <400000>;
        pinctrl-0 = <&twi2_pins_a>;
        pinctrl-1 = <&twi2_pins_b>;
        pinctrl-names = "default", "sleep";
        dmas = <&dma 45>, <&dma 45>;
        dma-names = "tx", "rx";
        status = "okay";

        ctp@38 {
                compatible = "focaltech,fts";
                reg = <0x38>;
                status = "okay";
                interrupt-parent = <&pio>;
                interrupts = <PB 6 IRQ_TYPE_LEVEL_LOW>;
                focaltech,reset-gpio = <&pio PB 4 GPIO_ACTIVE_HIGH>;
                focaltech,irq-gpio = <&pio PB 6 IRQ_TYPE_LEVEL_LOW>;
                focaltech,max-touch-number = <5>;
                focaltech,display-coords = <0 0 480 800>;
                focaltech,reg_vdd = <0x0000001f>;
				focaltech,reg_avdd = <0x0000001f>;
        };
};

如果原来有同样地址为0x38的I2C设备和触摸设备的节点时,可以注释或者删除。

2.2 添加触摸驱动

Tina_SDK自带相应的触摸驱动,只需修改内核配置,把驱动编译进系统。

执行ckernel进入内核目录。

执行m kernel_menuconfig,进入内核配置界面,选上Focaltech Touchscreen

在这里插入图片描述

执行croot,进入SDK根目录,执行make menuconfig进入配置界面,把触摸驱动模块添加进文件系统中:

在这里插入图片描述

2.3 修改触摸驱动

在测试过程中,发现触摸点(x,y)不对,需要修改驱动程序。

进入目录:

tina-d1-h/lichee/linux-5.4/drivers/input/touchscreen/focaltech_touch

修改:

vim focaltech_core.c

两处修改:

  • fts_input_dev_report_a函数中修改,找到相应的位置:
#原来的
input_report_abs(data->input_dev, ABS_MT_POSITION_X, event->au16_x[i]);
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, event->au16_y[i]);

#修改的
input_report_abs(data->input_dev, ABS_MT_POSITION_X, -(event->au16_x[i] - 480));
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, -(event->au16_y[i] - 800));
  • fts_input_dev_report_b函数中修改,找到相应的位置:
#原来的
input_report_abs(data->input_dev, ABS_MT_POSITION_X, event->au16_x[i]);
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, event->au16_y[i]);

#修改的
input_report_abs(data->input_dev, ABS_MT_POSITION_X, -(event->au16_x[i] - 480));
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, -(event->au16_y[i] - 800));

2.4 修改lvgl驱动配置文件

如果在lvgl的例程上测试触摸功能,需要进入目录:

cd /home/ubuntu/tina-d1-h/package/gui/littlevgl-8/lv_examples/src

修改:

vim lv_drv_conf.h

在这里插入图片描述

如果之前配置过lvgl例程,需要进入目录:

cd /home/ubuntu/tina-d1-h/out/d1-h-nezha/compile_dir/target

删除lv_examples,再进行编译打包烧录。

开发板上执行lv_examples 0,测试:

在这里插入图片描述

XR829芯片适配

1. 修改设备树

查看原理图:

在这里插入图片描述

原设备树中,WL_REG_ON与原理图的不匹配,修改为PB12。

在这里插入图片描述

蓝牙的设备树节点无需修改:

在这里插入图片描述

与原理图引脚符合:

在这里插入图片描述

2. 添加内核模块

进入SDK根目录,执行:

make menuconfig

在这里插入图片描述

取消勾选xr829-40M,选上xr829。

3. 添加xr829固件

Firmware负责实现Wi-Fi和蓝牙的连接管理、数据传输、安全加密以及其他底层操作。

在这里插入图片描述

xr829 with 40M sdd取消勾选。

4. 启动odhcp6c服务

odhcp6c的核心作用在于简化并自动化IPv6网络环境下的地址配置过程,确保设备能够顺利接入并通信。

在这里插入图片描述

5. wifi测试

SDK根目录下,执行编译make,打包pack

烧录到开发板上。

执行wifi_scan_results_test扫描附近wifi热点:

root@TinaLinux:/# wifi_scan_results_test

*********************************
***Start scan!***
*********************************
bssid / frequency / signal level / flags / ssid
94:d9:b3:b7:c9:0a       2442    -30     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]    Programmers
64:6e:97:5d:22:4a       2442    -67     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]    pobo
d0:76:e7:f8:93:d8       2462    -68     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      TP-LINK_93D8
9c:a6:15:3b:b9:94       2437    -69     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      TP-LINK_B994
30:fc:68:4b:d7:94       2412    -70     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      1708
f0:92:b4:a6:03:91       2452    -45     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]    ChinaNet-kRAH
c8:50:e9:bb:f5:0a       2462    -48     [WPA-PSK-TKIP][WPA2-PSK+FT/PSK-CCMP][WPS][ESS]  ChinaNet-sqJr
32:95:e3:19:e8:48       2437    -62     [WPA2-PSK+FT/PSK-CCMP][ESS]
30:95:e3:59:e8:48       2437    -62     [WPA2-PSK+FT/PSK-CCMP][ESS]     \xe7\xbe\xbd\xe5\x8d\x92\xe7\xa7\x91\xe6\x8a\x80
74:69:4a:51:91:38       2417    -65     [WPA2-PSK-CCMP][ESS]    1510
34:12:f9:87:a6:49       2427    -69     [WPA2-PSK-CCMP][ESS]    \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
34:12:f9:87:a6:4d       2427    -70     [WPA2-PSK-CCMP][ESS]    \x00\x00\x00\x00\x00\x00\x00\x00
******************************
Wifi get_scan_results: Success!
******************************

执行wifi_connect_ap_test连接wifi热点:

root@TinaLinux:/# wifi_connect_ap_test Programmers 100asktech
==================================
Connecting to the network(Programmers)......
[ 2841.637787] [STA_WRN] Freq 2442 (wsm ch: 7) prev: 3.
[ 2841.643853] wlan0: authenticate with 94:d9:b3:b7:c9:0a (try 1)
[ 2841.657251] [STA_WRN] [HT40][xradio_join_work][bss_ht_info]:
[ 2841.657251] [primary_chan  :0x00000007]
[ 2841.657251] [ht_param      :0x0000000f]
[ 2841.657251] [operation_mode:0x00000006]
[ 2841.657251] [stbc_param    :0x00000000]
[ 2841.657251] [basic_set[0]  :0x00000000]
[ 2841.685173] [STA_WRN] [HT40][xradio_join_work][PhyModeCfg:0x0027]
[ 2841.685173] [ModemFlags    :0x00000007]
[ 2841.685173] [ChWidthCfg    :0x00000002]
[ 2841.685173] [PriChCfg      :0x00000000]
[ 2841.685173] [BandCfg       :0x00000000]
[ 2841.685173] [STBC_Enable   :0x00000000]
[ 2841.685173] [PreambleCfg   :0x00000000]
[ 2841.685173] [SGI_Enable    :0x00000000]
[ 2841.685173] GF_Enable      :0x00000000]
[ 2841.748294] wlan0: authenticated
[ 2841.752631] wlan0: associate with 94:d9:b3:b7:c9:0a (try 1)
[ 2841.806522] wlan0: RX AssocResp from 94:d9:b3:b7:c9:0a (capab=0x431 status=0 aid=5)
[ 2841.815277] wlan0: associated
[ 2841.824201] [AP_WRN] [STA] ASSOC HTCAP 11N 58
[ 2841.829535] [AP_WRN] [HT40][xradio_bss_info_changed][ht_prot:0x0000000a][HtProtMode:0x0002][Green:0x0004]
[ 2841.829952] [AP_WRN] [HT40][xradio_bss_info_changed][PhyModeCfg:0x5027]
[ 2841.829952] [ModemFlags    :0x00000007]
[ 2841.829952] [ChWidthCfg    :0x00000002]
[ 2841.829952] [PriChCfg      :0x00000000]
[ 2841.829952] [BandCfg       :0x00000000]
[ 2841.829952] [STBC_Enable   :0x00000000]
[ 2841.829952] [PreambleCfg   :0x00000001]
[ 2841.829952] [SGI_Enable    :0x00000001]
[ 2841.829952] [GF_Enable     :0x00000000]
[ 2841.922603] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Connected to the AP(Programmers)
Getting ip address(Programmers)......
[ 2842.217245] [TXRX_WRN] drop=1771, fctl=0x00d0.
Wifi connect ap : Success!
==================================

ifconfig,查看是否分配ip地址:

root@TinaLinux:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 12:94:C8:33:1D:27
          inet addr:192.168.100.100  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fd93:2460:b4ec::1/60 Scope:Global
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:11280 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11280 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:879840 (859.2 KiB)  TX bytes:879840 (859.2 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:65:D8:1D:B6:8E
          inet addr:192.168.0.126  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::265:d8ff:fe1d:b68e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:333 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:33951 (33.1 KiB)  TX bytes:4894 (4.7 KiB)

root@TinaLinux:/# ping www.baidu.com
PING www.baidu.com (183.2.172.42): 56 data bytes
64 bytes from 183.2.172.42: seq=0 ttl=52 time=8.906 ms
64 bytes from 183.2.172.42: seq=1 ttl=52 time=17.209 ms
64 bytes from 183.2.172.42: seq=2 ttl=52 time=18.982 ms
^C
--- www.baidu.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 8.906/15.032/18.982 ms
root@TinaLinux:/#

执行wifi_disconnect_ap_test,断开wifi热点。

6. 蓝牙测试

6.1 蓝牙通话HFP

蓝牙HFP(Hands-Free Profile)是一种蓝牙配置文件,它允许用户通过蓝牙设备进行免提通话。HFP的实现通常建立在RFCOMM协议之上,并定义了音频网关(AG)和免提设备(HF)之间的通信方式,使用AT指令进行控制和状态信息的交换。

在开发板中,执行bt_test -i,打开蓝牙电源、D1-H开发板和控制器XR829的数据传输通道HCI进入交互模式:

root@TinaLinux:/# bt_test -i
1719041879.566378: BTMG[bt_manager_set_enable_default:513]:  enable default profile from bt config.
1719041879.566644: BTMG[bt_manager_enable:407]:  bt manager version:Version:3.0.1.202110291544,builed time:Oct 29 2021-09:42:35
1719041879.566692: BTMG[bt_test_status_cb:82]:  bt is turnning on.
[13383.789836] sunxi-rfkill soc@3000000:rfkill@0: block state already is 1
[13383.817822] sunxi-rfkill soc@3000000:rfkill@0: set block: 0
[13383.834060] sunxi-rfkill soc@3000000:rfkill@0: bt power on success
1719041885.082395: BTMG[bt_profile_global_init:355]:  start bluealsa :1 times
1719041885.752543: BTMG[bt_test_adapter_power_state_cb:47]:  Turn on bt successfully
1719041886.086287: BTMG[bt_test_status_cb:67]:  BT is ON
[bt]#

打开手机,连接上蓝牙:

在这里插入图片描述

终端上输入hfp_dial 10086,即可控制手机拨打10086:

[bt]#hfp_dial 10086
[bt]#bluealsa: Unsupported AT message: RESP: command:, value:OK
1719042215.140614: BTMG[bt_test_hfp_event_cb:423]:  event HFP_OK
1719042215.244263: BTMG[bt_test_hfp_event_cb:423]:  event HFP_CIEV
1719042215.245588: [rfcomm_bcs_resp_cb:225]:  ++
1719042215.245640: BTMG[bt_test_hfp_event_cb:423]:  event HFP_BCS
bluealsa: setsockopt BT_VOICE error 22, Invalid argument
1719042215.275556: BTMG[bt_test_hfp_event_cb:423]:  event HFP_OK
bluealsa: SCO connection created by peer
1719042215.309518: [bt_hfp_hf_pcm_start:452]:  enter
1719042215.309568: [aw_pcm_tansport_start:245]:  enter,id:0
1719042215.309591: [aw_pcm_tansport_start:251[13719.425633] [SNDCODEC][sunxi_card_hw_params][620]:stream_flag: 1
]:  device:hw:snddaudio1,default;chanels:1,sampling:16000
1719042215.309618: [aw_pcm_tansport_start:253]:  hfp worker address:0x3fb8b9f658
1719042215.309797: [aw_pcm_tansport_start:245]:  enter,id:1
1719042215.309841: [aw_pcm_tansport_start:251]:  device:CaptureMic,hw:snddaudio1;chanels:1,sampling:16000
1719042215.309867: [aw_pcm_tansport_start:253]:  hfp worker address:0x3fb8b9f680
1719042215.310315: [aw_pcm_transport_runtine:194]:  enter,id:1
1719042215.310470: [aw_pcm_transport_runtine:208]:  opening read pcm ......
1719042215.311252: [aw_pcm_transport_runtine:194]:  enter,id:0
1719042215.311445: [aw_pcm_transport_runtine:208]:  opening read pcm ......
ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
1719042215.334374: BTMG[aw_pcm_open:400]:  --->Couldn't open PCM:hw:snddaudio1
1719042215.334409: [aw_pcm_transport_runtine:210]:  open read pcm failed
1719042215.334436: [aw_pcm_tansport_routine_device_free:169]:  enter,id:0
1719042215.334459: [aw_pcm_tansport_routine_device_free:183]:  quit,id:0
1719042215.334483: [aw_pcm_tansport_routine_data_free:157]:  enter
1719042215.334505: [aw_pcm_tansport_routine_data_free:162]:  quit
1719042215.338041: [aw_pcm_transport_runtine:214]:  opening write pcm ......
ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
1719042215.341763: BTMG[aw_pcm_open:400]:  --->Couldn't open PCM:hw:snddaudio1
1719042215.341801: [aw_pcm_transport_runtine:216]:  open write pcm failed
1719042215.341827: [aw_pcm_tansport_routine_device_free:169]:  enter,id:1
1719042215.342343: [aw_pcm_tansport_routine_device_free:183]:  quit,id:1
1719042215.342396: [aw_pcm_tansport_routine_data_free:157]:  enter
1719042215.342420: [aw_pcm_tansport_routine_data_free:162]:  quit
1719042216.014303: BTMG[bt_test_hfp_event_cb:423]:  event HFP_CIEV

结果如下:

在这里插入图片描述

还有其他的一些操作:

来电接听:hfp_answer 
来电拒绝:hfp_hangup
样机拨打上一个电话:hfp_last_num
样机获取手机:hfp_cnum

6.2 蓝牙音频A2DP

蓝牙音频A2DP(Advanced Audio Distribution Profile)区别于HFP的另一种蓝牙配置文件,主要用于音乐播放和其他音频流应用,它提供了一种从音频源设备(如智能手机、平板电脑或笔记本电脑)到音频接收设备(如蓝牙耳机、扬声器或车载音频系统)的音频传输机制。

A2DP定义了两种主要角色:Source(源)和Sink(接收器)。

6.2.1 Source

Source设备是数字音频流的发起者,它负责将音频数据编码并通过蓝牙发送给一个或多个Sink设备。

开发板中,执行bt_test -i -p a2dp-source,打开Source模式并进入交互模式:

root@TinaLinux:/# bt_test -i -p a2dp-source
1719044146.397706: BTMG[bt_manager_enable:407]:  bt manager version:Version:3.0.1.202110291544,builed time:Oct 29 2021-09:42:35
1719044146.398009: BTMG[bt_test_status_cb:82]:  bt is turnning on.
[15650.616385] sunxi-rfkill soc@3000000:rfkill@0: set block: 1
[15650.622614] sunxi-rfkill soc@3000000:rfkill@0: bt power off success
[15650.650590] sunxi-rfkill soc@3000000:rfkill@0: set block: 0
[15650.666950] sunxi-rfkill soc@3000000:rfkill@0: bt power on success
1719044150.730524: BTMG[bt_profile_global_init:355]:  start bluealsa :1 times
1719044151.289084: BTMG[bt_test_adapter_power_state_cb:47]:  Turn on bt successfully
1719044151.732365: BTMG[bt_test_status_cb:67]:  BT is ON

扫描附近蓝牙设备:

  • scan 1:扫描设备获取到mac地址。
  • scan 0:停止扫描。
  • scan_list:获取已经扫描到的设备。
[bt]#scan 1
[bt]#1719044547.238333: BTMG[bt_test_discovery_status_cb:91]:  bt start scanning.
1719044547.238379: BTMG[btmg_gap_bluez_callback:1228]:  Discovery started
1719044552.490007: BTMG[bt_test_update_rssi_cb:139]:  address:90:F0:52:BA:95:7D,name:linuxrf,rssi:-57
1719044555.674164: BTMG[bt_test_update_rssi_cb:139]:  address:60:AB:67:60:85:1F,name:小米手机,rssi:-67
1719044556.831551: BTMG[bt_test_update_rssi_cb:139]:  address:90:F0:52:BA:95:7D,name:linuxrf,rssi:-33
1719044558.882874: BTMG[bt_test_update_rssi_cb:139]:  address:90:F0:52:BA:95:7D,name:linuxrf,rssi:-58

连接蓝牙设备:

[bt]#connect 80:76:C2:23:D0:A9

更多的操作可以输入help来查看:

[bt]#help
Available commands:
        enable                          enable [0/1]: open bt or not
        scan                            scan [0/1]: scan for devices
        scan_list                       scan_list: list available devices
        pair                            pair [mac]: pair with devices
        unpair                          uppair [mac]: unpair with devices
        paired_list                     paired_list: list paired devices
        get_state                       get_state: get bt state
        get_name                        get_name: get bt name
        set_name                        set_name [name]: set bt name
        remote_name                     remote_name: get remote device name
        set_vol                         set_vol: set a2dp source volme
        get_vol                         get_vol: get a2dp source volme
        get_addr                        get_addr: get bt address
        set_dis                         set_dis [0~2]:0-NONE,1-page scan,2-inquiry scan&page scan
        set_page_to                     real timeout = slots * 0.625ms
        set_io_cap                      set_io_cap [0~4]:0-keyboarddisplay,             1-displayonly,2-displayyesno,3-keyboardonly,4-noinputnooutput
        avrcp                           avrcp [play/pause/stop/fastforward/rewind/forward/backward]: avrcp control
        profile_cn                      profile_cn [mac]:a2dp sink connect
        profile_dis                     profile_dis [mac]:a2dp sink disconnect
        connect                         connect [mac]:generic method to connect
        disconnect                      disconnect [mac]:generic method to disconnect
        remove                          remove [mac]:removes the remote device
        a2dp_src_start                  a2dp_src_start:start a2dp source playing
        a2dp_src_stop                   a2dp_src_stop:stop a2dp source playing
        hfp_answer                      hfp_answer: answer the phone
        hfp_hangup                      hfp_hangup: hangup the phone
        hfp_dial                        hfp_dial [num]: call to a phone number
        hfp_cnum                        hfp_cum: Subscriber Number Information
        hfp_last_num                    hfp_last_num: calling the last phone number dialed
        hfp_vol                         hfp_vol [0~15]: update phone's volume.
        spp_connect                     spp_connect dev_id dst channel
        spp_send                        spp_send data
        spp_disconnect                  spp_disconnect dst
        get_version                     get_version: get btmanager version
        debug                           debug [0~5]: set debug level
        ex_dbg                          ex_dbg [mask]: set ex debug mask
        test                            test : test cmd
6.2.2 Sink

Sink设备接收来自Source的音频数据,对其进行解码,并播放音频。Sink设备还可以实现远程控制功能,允许用户控制播放、音量等。

开发板中,执行bt_test -p a2dp-sink,打开Sink模式:

root@TinaLinux:/# bt_test -p a2dp-sink
root@TinaLinux:/# 1719045265.302286: BTMG[bt_manager_enable:407]:  bt manager version:Version:3.0.1.202110291544,builed time:Oct 29 2021-09:42:35
1719045265.303777: BTMG[bt_test_status_cb:82]:  bt is turnning on.
[16769.554233] sunxi-rfkill soc@3000000:rfkill@0: set block: 1
[16769.562498] sunxi-rfkill soc@3000000:rfkill@0: bt power off success
[16769.590341] sunxi-rfkill soc@3000000:rfkill@0: set block: 0
[16769.606706] sunxi-rfkill soc@3000000:rfkill@0: bt power on success
1719045269.582019: BTMG[bt_profile_global_init:355]:  start bluealsa :1 times
1719045270.143978: BTMG[bt_test_adapter_power_state_cb:47]:  Turn on bt successfully
1719045270.585384: BTMG[bt_test_status_cb:67]:  BT is ON

打开手机连接上蓝牙,播放音乐,找个耳机插上D1H开发板耳机孔,即可听到音乐。

如果想要使用扬声器的接口来播放音乐,需要做以下设置:

在SDK根目录下执行make menuconfig,选上:

在这里插入图片描述

package/libs/tinyalsa/,执行mm -B

ubuntu@ubuntu1804:~/tina-d1-h/package/libs/tinyalsa$ mm -B
ubuntu@ubuntu1804:~/tina-d1-h/package/libs/tinyalsa$ cd /home/ubuntu/tina-d1-h/out/d1-h-nezha/compile_dir/target/tinyalsa-1.1.1/ipkg-install/usr/bin/
ubuntu@ubuntu1804:~/tina-d1-h/out/d1-h-nezha/compile_dir/target/tinyalsa-1.1.1/ipkg-install/usr/bin$ ls
tinycap  tinymix  tinypcminfo  tinyplay
ubuntu@ubuntu1804:~/tina-d1-h/out/d1-h-nezha/compile_dir/target/tinyalsa-1.1.1/ipkg-install/usr/bin$ adb push ./* /usr/bin

在开发板中,可以执行以下:

#转换为喇叭播放:
tinymix set "LINEOUTL Output Select" 1
tinymix set "LINEOUTR Output Select" 1

#设置音量:
tinymix set "LINEOUT volume" 15
tinymix set "LINEOUT Switch" 1

即可通过扬声器接口从喇叭上播放音乐。

播放网络视频

1. 开机默认HDMI输出

网络视频将通过HDMI屏幕来显示,需要先配置HDMI输出。

修改uboot的设备树,实现开机默认HDMI显示。

进入目录:

cd /home/ubuntu/tina-d1-h/device/config/chips/d1-h/configs/nezha

修改uboot-board.dts

vim uboot-board.dts

修改disp节点,如下:

&disp {
	disp_init_enable         = <1>;
	disp_mode                = <0>;
/*
        screen0_output_type      = <1>;
        screen0_output_mode      = <4>;

        screen1_output_type      = <3>;
        screen1_output_mode      = <10>;
*/
	screen0_output_type      = <3>;
	screen0_output_mode      = <10>;

	screen1_output_type      = <1>;
	screen1_output_mode      = <4>;

/*
        screen1_output_format    = <0>;
        screen1_output_bits      = <0>;
        screen1_output_eotf      = <4>;
        screen1_output_cs        = <257>;
        screen1_output_dvi_hdmi  = <2>;
        screen1_output_range     = <2>;
        screen1_output_scan      = <0>;
        screen1_output_aspect_ratio = <8>;

*/

	screen0_output_format    = <0>;
	screen0_output_bits      = <0>;
	screen0_output_eotf      = <4>;
	screen0_output_cs        = <257>;
	screen0_output_dvi_hdmi  = <2>;
	screen0_output_range     = <2>;
	screen0_output_scan      = <0>;
	screen0_output_aspect_ratio = <8>;
/*
        dev0_output_type         = <1>;
        dev0_output_mode         = <4>;
        dev0_screen_id           = <0>;
        dev0_do_hpd              = <0>;
*/
	dev0_output_type         = <4>;
	dev0_output_mode         = <10>;
	dev0_screen_id           = <0>;
	dev0_do_hpd              = <1>;

	//dev1_output_type         = <4>;
	//dev1_output_mode         = <10>;
	//dev1_screen_id           = <1>;
	//dev1_do_hpd              = <1>;

	def_output_dev           = <0>;
	hdmi_mode_check          = <1>;

	fb0_format               = <0>;
	fb0_width                = <0>;
	fb0_height               = <0>;

	fb1_format               = <0>;
	fb1_width                = <0>;
	fb1_height               = <0>;
	chn_cfg_mode             = <1>;

	disp_para_zone           = <1>;
	/*VCC-LCD*/
/*	dc1sw-supply = <&reg_dc1sw>;*/
	/*VCC-DSI*/
/*	eldo3-supply = <&reg_eldo3>;*/
	/*VCC-PD*/
/*	dcdc1-supply = <&reg_dcdc1>;*/
};

在SDK根目录下,烧写make、打包pack和烧录。即可在HDMI屏幕上显示。

2. 使能RTSP

进入目录:

cd /home/ubuntu/tina-d1-h/package/allwinner

新建文件support_rtsp.patch:

touch support_rtsp.patch

写入以下内容:

diff --git a/allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am b/allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am
index f33af3743..5d1aeaf0c 100755
--- a/allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am
+++ b/allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am
@@ -72,4 +72,7 @@ if PLS_PARSER_ENABLE
 SUBDIRS += pls
 endif
 
-SUBDIRS += base
\ No newline at end of file
+SUBDIRS += remux
+
+SUBDIRS += base
+
diff --git a/allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c b/allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c
index 44305f3c6..a24273fbc 100755
--- a/allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c
+++ b/allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c
@@ -50,7 +50,7 @@ static struct ParserUriKeyInfoS asfKeyInfo =
 };
 #endif
 
-#if 0
+#if 1
 extern CdxParserCreatorT remuxParserCtor;
 static struct ParserUriKeyInfoS remuxKeyInfo =
 {
@@ -460,7 +460,7 @@ void AwParserInit(void)
     AwParserRegister(&movParserCtor, CDX_PARSER_MOV, &movKeyInfo);
 #endif
 
-#if 0
+#if 1
     AwParserRegister(&remuxParserCtor, CDX_PARSER_REMUX, &remuxKeyInfo);
 #endif
 
diff --git a/allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am b/allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am
index 9dbb73590..86174f94e 100755
--- a/allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am
+++ b/allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am
@@ -65,6 +65,8 @@ libcdx_parser_la_LIBADD += $(top_srcdir)/libcore/parser/avi/libcdx_avi_parser.la
 libcdx_parser_la_CFLAGS += -DAVI_PARSER_ENABLE
 endif
 
+libcdx_parser_la_LIBADD += $(top_srcdir)/libcore/parser/remux/libcdx_remux_parser.la
+
 if TS_PARSER_ENABLE
 libcdx_parser_la_LIBADD += $(top_srcdir)/libcore/parser/ts/libcdx_ts_parser.la
 libcdx_parser_la_CFLAGS += -DTS_PARSER_ENABLE

用 git apply 来运行 patch 补丁:

git apply support_rtsp.patch

如果出现以下错误:

ubuntu@ubuntu1804:~/tina-d1-h/package/allwinner$ git apply support_rtsp.patch
error: patch failed: allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am:72
error: allwinner/tina_multimedia/libcedarx/libcore/parser/Makefile.am: patch does not apply
error: patch failed: allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c:50
error: allwinner/tina_multimedia/libcedarx/libcore/parser/base/CdxParser.c: patch does not apply
error: patch failed: allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am:65
error: allwinner/tina_multimedia/libcedarx/libcore/parser/base/Makefile.am: patch does not apply
ubuntu@ubuntu1804:~/tina-d1-h/package/allwinner$

大概率是被修改过了,不用再修改。

执行croot,进入配置界面:

make menuconfig

选上以下内容:

在这里插入图片描述

保存、编译make、打包pack和烧录。这样开发板就支持rtsp拉流功能了。

3. RTSP推流

有拉流,相应的就需要有推流。要实现这些功能,首先需要一个支持rtsp流媒体协议的服务器,可以在windows下搭建一个服务器。

下载链接:Releases · bluenviron/mediamtx (github.com)

在这里插入图片描述

下载完成后,双击.exe,即可运行服务器:

在这里插入图片描述

一般使用的是8554这个端口。

在ubuntu上,准备一个mp4格式的视频(视频尽量一分钟左右),使用ffmpeg工具来实现推流操作:

ffmpeg -re -stream_loop -1 -i input.mp4 -c copy -f rtsp rtsp://192.168.0.198:8554/input.mp4

192.168.0.198是windows上的无线ip地址。

这时推流已经就位了,下面开始在开发板上面进行拉流的操作。

4. RTSP拉流

完成了之前的步骤后,开发板进行 RTSP 拉流就比较容易了,联网、拉流即可。

wifi配置、连接根据之前写的操作来执行。

tplayerdemo 来拉流播放:

操作之前需要先把windows上的防火墙关闭,确保能ping通192.168.0.198,同样也需要能ping通ubuntu的桥接ip地址。

tplayerdemo rtsp://192.168.0.198:8554/input.mp4

可以看到视频可以播放到 HDMI 的输出了,日志如下:

root@TinaLinux:/# tplayerdemo rtsp://192.168.0.198:8554/input.mp4
WARNING: awplayer <cdx_log_set_level:30>: cdx Set log level to 6

INFO   : cedarc <CedarPluginVDInit:79>: register h264 decoder success!
INFO   : cedarc <CedarPluginVDInit:84>: register mjpeg decoder success!
INFO   : cedarc <CedarPluginVDInit:86>: register mpeg2 decoder success!
INFO   : cedarc <CedarPluginVDInit:92>: register mpeg4dx decoder success!
INFO   : cedarc <CedarPluginVDInit:79>: register mpeg4H263 decoder success!
INFO   : cedarc <CedarPluginVDInit:90>: register mpeg4Normal decoder success!
INFO   : cedarc <CedarPluginVDInit:74>: register vc1 decoder success!
INFO   : cedarc <CedarPluginVDInit:85>: register h265 decoder success!

******************************************************************************************
* This program implements a simple player, you can type commands to control the player.
* To show what commands supported, type 'help'.
******************************************************************************************
dd: writing '/dev/fb0': No space left on device
32401+0 records in
32400+0 records out
argc = 2
argv[0] = tplayerdemo
argv[1] = rtsp://192.168.0.198:8554/input.mp4
may be is one file:cut[  133.664339] [SNDCODEC][sunxi_card_hw_params][620]:stream_flag: 0
 down suffix is:.mp4
find the matched type:.mp4
create player:0

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tina_multimedia <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag   : tina3.5
branch: tina-dev
date  : Mon Jul 15 19:04:59 2019 +0800
Change-Id: I5f6c8a88d7b387a312b7744797a0d5f8ab07ee7a
-------------------------------------------------------------------------------
xplayer:process message XPLAYER_COMMAND_SET_AUDIOSINK.
xplayer:process message XPLAYER_COMMAND_SET_SURFACE.
xplayer:process message XPLAYER_COMMAND_SET_SUBCTRL.
xplayer:process message XPLAYER_COMMAND_SET_DI.
create player[0]:0x34a2a3d0
screen width:1920,screen height:1080
1:playVideo:0
before TPlayerSetDataSource,94712:rtsp://192.168.0.198:8554/input.mp4
xplayer:process message XPLAYER_COMMAND_SET_SOURCE.
setDataSource end
xplayer:process message XPLAYER_COMMAND_PREPARE.
Created new TCP socket 9 for connection
INFO   : cedarc <log_set_level:4[  133.983565] VE: enable hw clock
3>: Set log level to 5 from /ven[  133.989646] enable_cedar_hw_clk,552
dor/etc/cedarc.conf
ERROR  : cedarc <DebugCheckConfig:301>: [4[  133.998973] VE: VE real_freq=576000000
[  133.998973]
0;31mnow cedarc log level:5
info: media source is unseekable.
TPlayerPrepare end
TPlayerSetHoldLastPicture()
xplayer:process message XPLAYER_COMMAND_START.
(Allwinner Audio Middle Layer),line(971) : Create Decoder!!=====
(Allwinner Audio Middle Layer),line(603) : AudioDec_Installaudiolib ok
(Allwinner Audio Middle Layer),line(606) : audio decoder init start ...
(AllwinnerAlibs),line(50) :
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Audio <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag   : audiocodec-v1.2
branch: new
commit: 3ba65962c01cbf1280ddda19d843009b6ef8ce85
date  : Tue Jan 8 16:25:27 2019 +0800
----------------------------------------------------------------------

(AllwinnerAlibs),line(700) : ----Loading so success!
(AllwinnerAlibs),line(902) : *************pAudioStreamInfo start******************
(AllwinnerAlibs),line(903) : eCodecFormat         :id(4), name(aac low-complexy)
(AllwinnerAlibs),line(904) : eSubCodecFormat      :0
(AllwinnerAlibs),line(905) : nChannelNum          :2
(AllwinnerAlibs),line(906) : nBitsPerSample       :16
(AllwinnerAlibs),line(907) : nSampleRate          :44100
(AllwinnerAlibs),line(908) : nAvgBitrate          :0
(AllwinnerAlibs),line(909) : nMaxBitRate          :0
(AllwinnerAlibs),line(910) : nFileSize            :0
(AllwinnerAlibs),line(911) : eAudioBitstreamSource:0
(AllwinnerAlibs),line(912) : eDataEncodeType      :0
(AllwinnerAlibs),line(913) : nCodecSpecificDataLen:2
(AllwinnerAlibs),line(914) : pCodecSpecificData   :0x3fbc088420
(AllwinnerAlibs),line(915) : nFlags               :0
(AllwinnerAlibs),line(916) : nBlockAlign          :0
(AllwinnerAlibs),line(917) : *************pAudioStreamInfo end  ******************
(AAC Decoder),line(36) : init successs...
(Allwinner Audio Middle Layer),line(614) : AUDIO DECODE INIT OK...0
started.

tplayerdemo# ERROR  : awplayer <PlayerStart:806>: invalid start operation, player already in started status.
have no enough data to play
have enough data to play again
ERROR  : awplayer <__LayerQueueBuffer:969>: *** picNode is full when queue buffer
ERROR  : awplayer <__LayerQueueBuffer:969>: *** picNode is full when queue buffer
*****tplayer:video decoded width = 1280,height = 720
*****tplayerdemo:video decoded width = 1280,height = 720real set to display rect:w = 1280,h = 720
warning: unknown callback from Tinaplayer.
*****tplayer:video width = 1280,height = 720
warning: unknown callback from Tinaplayer.
****player(0x34a2c7b0): first video pts = 1714438937699315*****
ERROR  : awplayer <__LayerQueueBuffer:969>: *** picNode is full when queue buffer
ERROR  : fbm.c <FbmReturnPicture:1043>: invalid frame status, a picture being returned,                 but bUsedByRender=0, bInValidPictureQueue=1, bAlreadyDisplayed=0.
ERROR  : fbm.c <FbmReturnPicture:1044>: **picture[0x3fb4001f08],id[8]
WARNING: cedarc <ReturnPicture:1698>: FbmReturnPicture return fail,            it means the picture being returned it not one of this FBM.

mediamtx服务器上的信息如下:

在这里插入图片描述

红外控制LVGL界面切换

1. 测试红外功能

1.1 配置设备树

查看原理图:

在这里插入图片描述

可以看到红外对应的引脚号是PG16

进入目录:

cd /home/ubuntu/tina-d1-h/device/config/chips/d1-h/configs/nezha/linux-5.4

修改board.dts

vim board.dts

修改引脚:

在这里插入图片描述

以下节点是红外接收的设备树节点,没有使能的话,需要使能:

在这里插入图片描述

1.2 配置内核配置文件

执行ckernel,进入内核目录。

打开内核配置界面:

m kernel_menuconfig

红外有很多种协议,NEC红外协议是最常用的一种,默认选上:

在这里插入图片描述

添加红外接收驱动:

在这里插入图片描述

保存,回到SDK根目录,编译make、打包pack和烧录。

1.3 验证红外功能

开发板上,执行cat proc/bus/input/devices:

root@TinaLinux:/# cat proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-keyboard"
P: Phys=sunxikbd/input0
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=100000000 0 0 100000000800 4000000000000 10000000

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-ir"
P: Phys=sunxi-ir/input0
S: Sysfs=/devices/platform/soc@3000000/7040000.s_cir/rc/rc0/s_cir_rx
U: Uniq=
H: Handlers=kbd event1
B: PROP=20
B: EV=100017
B: KEY=2
B: REL=3
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="audiocodec sunxi Audio Jack"
P: Phys=ALSA
S: Sysfs=/devices/platform/soc@3000000/2030340.sound/sound/card0/input2
U: Uniq=
H: Handlers=kbd event2
B: PROP=0
B: EV=23
B: KEY=40 0 0 0 0 0 400000000 0 c000000000000 0
B: SW=14

I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="fts_ts"
P: Phys=
S: Sysfs=/devices/platform/soc@3000000/sunxi-i2c2/i2c-2/2-0038/input/input3
U: Uniq=
H: Handlers=event3
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=661800000000000

可以看到/dev/input/event1就是红外接收的设备节点了。

执行:

hexdump /dev/input/event1

查看是否接收正常:

root@TinaLinux:/# hexdump /dev/input/event1
0000000 0d07 0000 0000 0000 4ab4 000c 0000 0000
0000010 0004 0004 0007 0000 0d07 0000 0000 0000
0000020 4ab4 000c 0000 0000 0000 0000 0000 0000
0000030 0d08 0000 0000 0000 4a1b 000e 0000 0000
0000040 0004 0004 0009 0000 0d08 0000 0000 0000
0000050 4a1b 000e 0000 0000 0000 0000 0000 0000
0000060 0d0a 0000 0000 0000 5968 0009 0000 0000
0000070 0004 0004 0007 0000 0d0a 0000 0000 0000
0000080 5968 0009 0000 0000 0000 0000 0000 0000
0000090 0d0b 0000 0000 0000 cf50 0004 0000 0000
00000a0 0004 0004 0009 0000 0d0b 0000 0000 0000
00000b0 cf50 0004 0000 0000 0000 0000 0000 0000

收到数据就是接收正常的现象。下面可以编写测试程序了。

1.4 编写红外接收测试程序

以下编写的测试文件:

ubuntu@ubuntu1804:~/C_Source/C_IRTest$ tree -L 2
.
├── bin
│   └── main
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   └── Makefile
├── build.sh
├── CMakeLists.txt
├── inc
│   └── ir_test.h
├── main.c
├── src
│   └── ir_test.c
└── toolchain.cmake

5 directories, 10 files

主函数main.c如下:

#include <stdio.h>

#include "ir_test.h"

int main(int argc,char ** argv)
{
        int rang_low = 0, rang_high = 0;
        return test_keyboard(DEV_PATH);
}

红外模块测试程序/src/ir_test.c如下:

#include "ir_test.h"

static const int key_exit = 102;
static int keys_fd = 0;

unsigned int test_keyboard(const char * event_file)
{
        int code = 0, i;
        struct input_event data={0};
        keys_fd=open(DEV_PATH, O_RDONLY);
        if(keys_fd <= 0)
        {
                printf("open %s error!\n", DEV_PATH);
                return -1;
        }
        fcntl(keys_fd,F_SETFL,O_NONBLOCK);
        for(;;)
        {
                read(keys_fd, &data, sizeof(data));
                if(data.value){
                        printf("%d\r\n",data.value);
                        code = data.value;
                }
        }
        close(keys_fd);
        return 0;
}

所用到的头文件/inc/ir_test.h如下:

#ifndef IR_TEST_H
#define IR_TEST_H

#include <stdio.h>
#include <linux/input.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/time.h>
#include <limits.h>
#include <unistd.h>
#include <signal.h>

#define DEV_PATH "/dev/input/event1" //difference is possible

unsigned int test_keyboard(const char * event_file);

#endif

使用CMake来构建工程会更加方便一些,CMakeLists.txt如下:

cmake_minimum_required(VERSION 3.10)
project(ir)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

include_directories(${PROJECT_SOURCE_DIR}/inc)

file(GLOB SRC_FILES "src/*.c")

add_executable(main main.c ${SRC_FILES})

#target_link_libraries(target_name lib1 lib2 ...)

指定交叉编译工具,toolchain.cmake如下:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR riscv)

set(tools "/home/ubuntu/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702")
set(CMAKE_C_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-g++)

为了更加方便编译,编写一个脚本。build.sh如下:

rm -rf build
mkdir -p build
cd build/
cmake -DCMAKE_TOOLCHAIN_FILE="../toolchain.cmake" ..
make -j8

执行./build.sh,生成的可执行程序在bin/文件下。

使用adb来推送到开发板上:

adb push bin/main /mnt/UDISK/

在开发板上执行/mnt/UDISK/main,即可验证红外接收:

root@TinaLinux:/mnt/UDISK# ./main
7
9
7
9

为后面实现红外切换LVGL界面做准备。

2. lvgl9移植

lvgl的界面准备使用9.0版本去实现,在这之前,需要先移植lvgl9.0版本例程到开发板上,为后面移植界面做准备。

参考文章:移植lvgl v9到嵌入式linux设备_lvgl9 linux-CSDN博客

2.1 准备移植资源

以下文件是从LVGL官方仓库,下载两个仓库:

注意:都要选择v9.0版本!!

名称仓库地址描述
lvglhttps://github.com/lvgl/lvgl.git包含了LVGL图形界面控件源码、驱动接口源代码以及例程
lv_port_linuxhttps://github.com/lvgl/lv_port_linux.git适配有framebuffer的linux系统的接口

由于版本更新,直接在ubuntu上克隆是最新版本的,编译会出现问题。

建议在window上都选择V9.0版本下载上面两个仓库,最后用lvgl仓库代替lv_port_linux_frame_buffer的lvgl文件夹。

lv_port_linux

在这里插入图片描述

lvgl

在这里插入图片描述

2,2 移植步骤

替换好工程后,上传到ubuntu,新建一个目录用于存放该工程。

可以看到目录结构如下:

ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0$ tree -L 1
.
├── CMakeLists.txt
├── LICENSE
├── lv_conf.h
├── lvgl
├── main.c
├── Makefile
├── mouse_cursor_icon.c
└── README.md

1 directory, 7 files

如果需要支持触摸功能,修改lv_conf.h

888 /*Driver for evdev input devices*/
889 #define LV_USE_EVDEV    1

mian.c中添加触摸输入:

需要确定设备的触摸节点(可以使用cat /dev/input/event3测试)

int main(void)
{
    lv_init();

    /*Linux frame buffer device init*/
    lv_display_t * disp = lv_linux_fbdev_create();
    lv_linux_fbdev_set_file(disp, "/dev/fb0");

    /*input touch device init*/
    lv_indev_t *touch;
    touch = lv_evdev_create(LV_INDEV_TYPE_POINTER,"/dev/input/event3");

    /*Create a Demo*/
    lv_demo_widgets();
    //lv_demo_widgets_start_slideshow();

    /*Handle LVGL tasks*/
    while(1) {
        lv_timer_handler();
        usleep(5000);
    }

    return 0;
}

2.3 编译

指定交叉编译工具,编写一个toolchain.cmake如下:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR riscv)

set(tools "/home/ubuntu/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702")
set(CMAKE_C_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-g++)

为了方便编译,编写一份脚本build.sh

rm -rf build
mkdir -p build
cd build/
cmake -DCMAKE_TOOLCHAIN_FILE="../toolchain.cmake" ..
make -j8

编译:

ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0$ ls
bin  build  build.sh  CMakeLists.txt  LICENSE  lv_conf.h  lvgl  main.c  Makefile  mouse_cursor_icon.c  README.md  toolchain.cmake
ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0$
ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux$ sudo chmod +x build.sh
ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0$ ./build.sh 
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
...
[ 99%] Linking C static library liblvgl_examples.a
[ 99%] Built target lvgl_examples
[ 99%] Building C object CMakeFiles/main.dir/main.c.o
[ 99%] Building C object CMakeFiles/main.dir/mouse_cursor_icon.c.o
[100%] Linking CXX executable /home/ubuntu/lvgl_demo/lv_port_linux-release-v9.0/bin/main
[100%] Built target main
ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0$ 

编译成功后,可执行程序保存在bin/目录下:

ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0/bin$ file main 
main: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linux 4.15.0, with debug_info, not stripped
ubuntu@ubuntu1804:~/lvgl_demo/lv_port_linux-release-v9.0/bin$

3. lvgl输入设备适配

通过前面的测试,可以确认红外功能是可以使用的,为了方便控制lvgl的界面切换,需要把红外绑定到lvgl的输入设备框架里。

3.1 移植红外输入设备

参考官方文档:

Input device interface(输入设备接口) — LVGL 文档 (100ask.net)

可以看到,要创建输入设备,需要使用以下:

/*Register at least one display before you register any input devices*/
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_...);   /*See below.*/
lv_indev_set_read_cb(indev, read_cb);  /*See below.*/

其中LV_INDEV_TYPE_成员可以是:

  • LV_INDEV_TYPE_POINTER:触摸屏或鼠标
  • LV_INDEV_TYPE_KEYPAD:键盘或键垫
  • LV_INDEV_TYPE_ENCODER:具有左右旋转及按下选项的编码器
  • LV_INDEV_TYPE_BUTTON:外部按钮虚拟按压屏幕

read_cb 是一个函数指针,它将定期被调用以报告输入设备当前的状态。

每种类型,官网都简单写了一个read_cb所指向的函数的用法。可以参考它的,把红外适配上去。

在这里,红外使用的是LV_INDEV_TYPE_BUTTON类型,官网中的read_cb指向的函数是这样使用的:

void button_read(lv_indev_t * indev, lv_indev_data_t*data){
    static uint32_t last_btn = 0;   /*Store the last pressed button*/
    int btn_pr = my_btn_read();     /*Get the ID (0,1,2...) of the pressed button*/
    if(btn_pr >= 0) {               /*Is there a button press? (E.g. -1 indicated no button was pressed)*/
       last_btn = btn_pr;           /*Save the ID of the pressed button*/
       data->state = LV_INDEV_STATE_PRESSED;  /*Set the pressed state*/
    } else {
       data->state = LV_INDEV_STATE_RELEASED; /*Set the released state*/
    }
    data->btn_id = last_btn;         /*Save the last button*/
}

这里需要把my_btn_read修改成上一章验证过的红外测试接口 ,加以修改,如下:

static int ir_pressed(void)
{
    struct input_event data={0};
    int cnt = 0;

    read(keys_fd, &data, sizeof(data));
    if(data.value == 7)
    {
        cnt = 0;
        return cnt;
    }else if(data.value == 9)
    {
        cnt = 1;
        return cnt;
    }

    return -1;
}

这样,read_cb所指向的函数就变成:

static void read_cb(lv_indev_t * indev, lv_indev_data_t*data)
{
    static uint32_t last_btn = 0;                       /*Store the last pressed button*/
    int btn_pr = ir_pressed();                                  /*Get the ID (0,1,2...) of the pressed button*/
    if(btn_pr >= 0) {                                   /*Is there a button press? (E.g. -1 indicated no button was pressed)*/
        last_btn = btn_pr;                              /*Save the ID of the pressed button*/
        data->state = LV_INDEV_STATE_PRESSED;    /*Set the pressed state*/
            printf("last_btn : %d\n",last_btn);
    } else {
        data->state = LV_INDEV_STATE_RELEASED;   /*Set the released state*/
                //printf("RELEASED\n");
    }
        data->btn_id = last_btn;                                /*Save the last button*/
        //printf("data->btn_id : %d\n",data->btn_id);
}

ir_pressed返回的每个索引都分配了相应的坐标,使用了lv_indev_set_button_points(my_indev, points_array)points_array 应该看起来像 const lv_point_t points_array[] = { {12,30},{60,90}, ...}

添加上初始化,就可以用红外控制lvgl界面切换了(界面需要在lvgl9移植的工程上额外编写):

static const lv_point_t points_array[] = {{20,20},{120,20}};

void ir_init(void)
{
    keys_fd = open(DEV_PATH, O_RDONLY);
    if(keys_fd <= 0)
    {
        printf("open %s error!\n", DEV_PATH);
        return;
    }

    fcntl(keys_fd,F_SETFL,O_NONBLOCK);

    lv_indev_t * indev = lv_indev_create();
    lv_indev_set_type(indev,LV_INDEV_TYPE_BUTTON);
    lv_indev_set_read_cb(indev,read_cb);
    lv_indev_set_button_points(indev,points_array);
}

整个工程的目录结构如下:

ubuntu@ubuntu1804:~/C_Source/lvgl_v9_demo_irtest$ tree -L 2
.
├── bin
│   └── main
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   ├── lib
│   ├── lvgl
│   └── Makefile
├── build.sh
├── CMakeLists.txt
├── inc
│   ├── anim.h
│   ├── calendar.h
│   ├── ir_test.h
│   └── my_lvgl_demo_irtest.h
├── lv_conf.h
├── lvgl
│   ├── CMakeLists.txt
│   ├── component.mk
│   ├── demos
│   ├── docs
│   ├── env_support
│   ├── examples
│   ├── idf_component.yml
│   ├── Kconfig
│   ├── library.json
│   ├── library.properties
│   ├── LICENCE.txt
│   ├── lv_conf_template.h
│   ├── lvgl.h
│   ├── lvgl.mk
│   ├── lvgl.pc.in
│   ├── README.md
│   ├── SConscript
│   ├── scripts
│   ├── src
│   └── tests
├── main.c
├── Makefile
├── mouse_cursor_icon.c
├── src
│   ├── anim.c
│   ├── calendar.c
│   ├── ir_test.c
│   └── my_lvgl_demo_irtest.c
└── toolchain.cmake

15 directories, 32 files

执行./build.sh可以直接编译程序,可执行程序main放在bin/文件里。

推送到开发板上:

adb push bin/main /mnt/UDISK/

3.2 测试

开发板上执行:

root@TinaLinux:/mnt/UDISK# ./main
last_btn : 0
last_btn : 0
last_btn : 1
last_btn : 1
last_btn : 0
last_btn : 1
last_btn : 0
last_btn : 1

界面如下:

在这里插入图片描述

0是往前返回上一个界面,1是往下一个界面走,搞定。

WIFI投屏

参考哪吒D1编译配置DLNA客户端进行B站投屏 / 全志 SOC / WhyCan Forum(哇酷开发者社区)实现wifi投屏功能。

1. 常见的投屏协议

实现该功能前,可以了解一下常见的投屏协议主要包括以下几种:

  1. AirPlay:由苹果公司开发的无线显示协议,允许将iPhone、iPad或Mac的屏幕内容投屏到Apple TV或支持AirPlay的Android电视盒子上。AirPlay支持镜像模式和流模式两种工作方式。
  2. Miracast:由Wi-Fi联盟制定的Wi-Fi投屏行业标准,基于Wi-Fi Direct技术,可以在Android 4.2及以上版本和Windows 8.1或Windows 10系统中使用,实现无线连接和数据传输。
  3. DLNA:由数字生活网络联盟(Digital Living Network Alliance)创建的投屏协议,基于UPnP协议,主要用于在设备之间共享多媒体内容。DLNA不是无线显示解决方案,而是在一台设备上获取内容并在另一台设备上播放的方法。
  4. Chromecast:由谷歌开发的无线投屏技术,与AirPlay相比,Chromecast的体验更接近于DLNA。
  5. WiDi:支持Windows 10笔记本的无线投屏方式,无需安装软件即可实现无线投屏。

2. 配置DLNA客户端

DLNA客户端可以接收并播放以DLNA协议推送的流媒体,而B站可以将视频通过DLNA协议来推送。
所以需要给D1h开发板配置DLNA客户端,就可以在同一网络下实现B站投屏了。

故事情节:

有个博主使用gmrender-resurrect用来做DLNA客户端。
gmrender-resurrect是基于 GStreamer 框架开发的项目,专门用于实现 DLNA/UPnP-AV 媒体播放功能。
GStreamer是一个全面的多媒体框架,提供了一整套工具和组件来处理各种媒体任务。
但是博主发现使用GStreamer来解码B站投屏的视频会出现闪屏和不能自动硬件缩放问题。
于是就对gmrender-resurrect进行了魔改,把GStreamer 改成了tina自带的tplayer来播放视频。
gmrender-resurrect自此便成了tprender

在tina的package里面没有相关的库,下面将手动交叉编译tprender和DLNA的底层upnp库。

2.1 获取源码资料

我们百问网提供了相应的源码和补丁:https://github.com/DongshanPI/DongshannezhaSTU_DLNA_ScreenProjection.git

进入ubuntu,把源码克隆下来:

ubuntu@ubuntu1804:~$ git clone https://github.com/DongshanPI/DongshannezhaSTU_DLNA_ScreenProjection.git
ubuntu@ubuntu1804:~$ tree DongshannezhaSTU_DLNA_ScreenProjection -L 1
DongshannezhaSTU_DLNA_ScreenProjection
├── libupnp-1.14.12
├── README.md
└── tprender

2 directories, 1 file

在交叉编译源码之前,先把补丁也克隆下来:

ubuntu@ubuntu1804:~$ git clone https://github.com/DongshanPI/Tina-sdk_dongshannezhastu
ubuntu@ubuntu1804:~$ tree Tina-sdk_dongshannezhastu -L 1
Tina-sdk_dongshannezhastu
├── config_gstreamer
├── device
├── package
├── README.md
└── target

3 directories, 2 files
ubuntu@ubuntu1804:~$ cd tina-d1-h/
ubuntu@ubuntu1804:~/tina-d1-h$ source build/envsetup.sh 
Setup env done! Please run lunch next.
ubuntu@ubuntu1804:~/tina-d1-h$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. d1-h_nezha_min-tina
     2. d1-h_nezha-tina
     3. d1s_nezha-tina

Which would you like? [Default d1-h_nezha]: 2
============================================
TINA_BUILD_TOP=/home/ubuntu/tina-d1-h
TINA_TARGET_ARCH=riscv
TARGET_PRODUCT=d1-h_nezha
TARGET_PLATFORM=d1-h
TARGET_BOARD=d1-h-nezha
TARGET_PLAN=nezha
TARGET_BUILD_VARIANT=tina
TARGET_BUILD_TYPE=release
TARGET_KERNEL_VERSION=5.4
TARGET_UBOOT=u-boot-2018
TARGET_CHIP=sun20iw1p1
============================================
clean buildserver
[2] 90293
ubuntu@ubuntu1804:~/tina-d1-h$ rm .config
ubuntu@ubuntu1804:~/tina-d1-h$ rm out/ -rf
ubuntu@ubuntu1804:~/tina-d1-h$ cp ../Tina-sdk_dongshannezhastu/* -rfvd ./

如果执行了rm .configrm out/ -rf,后续烧录系统需要wifi功能,就得重新根据之前的文章重新配置wifi功能。

拷贝完成后,执行:

ubuntu@ubuntu1804:~/tina-d1-h$ cp config_gstreamer.txt .config
ubuntu@ubuntu1804:~/tina-d1-h$ make

编译完成后,记得进行打包pack操作:

ubuntu@ubuntu1804:~/tina-d1-h$ pack

否则out/无法更新。就会影响到tprender的编译。

2.2 交叉编译

新建一个终端,进入DongshannezhaSTU_DLNA_ScreenProjection目录。

配置临时交叉编译环境变量:

ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection$ export PATH=$PATH:/home/ubuntu/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection$ cd libupnp-1.14.12/
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ ./configure --host=riscv64-unknown-linux-gnu
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ make
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ mkdir tmp
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ make install DESTDIR=$(pwd)/tmp/
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ ls -lh tmp/usr/local/lib
total 8.4M
-rw-r--r-- 1 ubuntu ubuntu 1.1M Jun 20 23:34 libixml.a
-rwxr-xr-x 1 ubuntu ubuntu  929 Jun 20 23:34 libixml.la
lrwxrwxrwx 1 ubuntu ubuntu   17 Jun 20 23:34 libixml.so -> libixml.so.11.1.2
lrwxrwxrwx 1 ubuntu ubuntu   17 Jun 20 23:34 libixml.so.11 -> libixml.so.11.1.2
-rwxr-xr-x 1 ubuntu ubuntu 205K Jun 20 23:34 libixml.so.11.1.2
-rw-r--r-- 1 ubuntu ubuntu 6.0M Jun 20 23:34 libupnp.a
-rwxr-xr-x 1 ubuntu ubuntu  955 Jun 20 23:34 libupnp.la
lrwxrwxrwx 1 ubuntu ubuntu   17 Jun 20 23:34 libupnp.so -> libupnp.so.17.1.3
lrwxrwxrwx 1 ubuntu ubuntu   17 Jun 20 23:34 libupnp.so.17 -> libupnp.so.17.1.3
-rwxr-xr-x 1 ubuntu ubuntu 1.2M Jun 20 23:34 libupnp.so.17.1.3
drwxrwxr-x 2 ubuntu ubuntu 4.0K Jun 20 23:34 pkgconfig
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ 

就可以在当前的tmp/目录下得到相应的动态库。

进入tprender/目录:

ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/libupnp-1.14.12$ cd ../tprender/
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ cp ../libupnp-1.14.12/tmp/usr/local/lib/libixml.so.11.1.2 libs/libixml.so
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ cp ../libupnp-1.14.12/tmp/usr/local/lib/libixml.so.11.1.2 libs/libixml.so.11
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ cp ../libupnp-1.14.12/tmp/usr/local/lib/libupnp.so.17.1.3 libs/libupnp.so
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ cp ../libupnp-1.14.12/tmp/usr/local/lib/libupnp.so.17.1.3 libs/libupnp.so.17

修改CMakeLists.txt:

ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ gedit CMakeLists.txt

在这里插入图片描述

保存退出,编译即可得到可执行程序tprender

ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ rm -rf CMakeFiles cmake_install.cmake  CMakeCache.txt tags
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ cmake .
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ make 
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ file tprender
tprender: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linux 4.15.0, with debug_info, not stripped
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ 

3. 测试投屏功能

扫描附近wifi:

root@TinaLinux:/# wifi_scan_results_test

*********************************
***Start scan!***
*********************************
bssid / frequency / signal level / flags / ssid
94:d9:b3:b7:c9:0a       2442    -36     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]    Programmers
d6:84:09:1e:9b:95       2412    -59     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      Guest_An
d4:84:09:1d:9b:95       2412    -61     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      Voform
4a:0e:ec:50:95:83       2437    -62     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      1415\xe5\xa4\x87\xe7\x94\xa8
48:0e:ec:50:95:83       2437    -66     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      A1415
f0:92:b4:a6:03:91       2452    -38     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS]    ChinaNet-kRAH
a4:a9:30:ba:83:16       2457    -51     [WPA2-PSK-CCMP][WPS][ESS]       wifi1
1c:68:7e:bc:25:0a       2412    -58     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      \xe9\xa1\xba\xe6\x88\x90\xe5\x8a\xb3\xe5\x8a\xa1
34:12:f9:87:a6:48       2427    -61     [WPA2-PSK-CCMP][WPS][ESS]       Redmi_83D1
34:12:f9:87:a6:49       2427    -62     [WPA2-PSK-CCMP][ESS]    \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
a4:39:b3:73:ac:74       2427    -63     [WPA2-PSK-CCMP][WPS][ESS]       Redmi_83D1
b4:77:48:a7:52:45       2437    -63     [WPA2-PSK-CCMP][ESS]    VANTEN
98:0d:51:10:78:31       2437    -70     [WPA2-PSK-CCMP][WPS][ESS]
aa:a9:30:ba:83:16       2457    -61     [ESS]
a6:39:b3:63:ac:74       2427    -62     [ESS]
******************************
Wifi get_scan_results: Success!
******************************
root@TinaLinux:/#

在这里准备用手机的B站来进行投屏,开发板需要连接和手机同一个wifi:

root@TinaLinux:/# wifi_connect_ap_test <wifi名> <wifi密码>
root@TinaLinux:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 46:6C:D2:EA:24:03
          inet addr:192.168.100.100  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fd18:7ee6:608a::1/60 Scope:Global
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:108 (108.0 B)  TX bytes:108 (108.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:65:D8:1D:B6:8E
          inet addr:192.168.0.127  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::265:d8ff:fe1d:b68e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:103820 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18352 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:69417258 (66.2 MiB)  TX bytes:3751190 (3.5 MiB)

root@TinaLinux:/#

连接成功后,wlan0节点会有ip地址。测试wifi功能:

root@TinaLinux:/# ping www.baidu.com
PING www.baidu.com (183.2.172.185): 56 data bytes
64 bytes from 183.2.172.185: seq=0 ttl=52 time=13.684 ms
64 bytes from 183.2.172.185: seq=1 ttl=52 time=18.239 ms
64 bytes from 183.2.172.185: seq=2 ttl=52 time=14.803 ms
^C
--- www.baidu.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 13.684/15.575/18.239 ms
root@TinaLinux:/#

在ubuntu上,推送可执行程序动态库到D1h开发板:

ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$ adb push libs/ tprender /root/
libs/: 4 files pushed. 1.4 MB/s (2738288 bytes in 1.887s)
tprender: 1 file pushed. 1.3 MB/s (116984 bytes in 0.087s)
5 files pushed. 1.3 MB/s (2855272 bytes in 2.143s)
ubuntu@ubuntu1804:~/DongshannezhaSTU_DLNA_ScreenProjection/tprender$

开发板上进入/root目录,执行:

root@TinaLinux:~# ./tprender -f "D1-H"
WARNING: awplayer <cdx_log_set_level:30>: cdx Set log level to 6
INFO   : cedarc <CedarPluginVDInit:79>: register h264 decoder success!
INFO   : cedarc <CedarPluginVDInit:84>: register mjpeg decoder success!
INFO   : cedarc <CedarPluginVDInit:86>: register mpeg2 decoder success!
INFO   : cedarc <CedarPluginVDInit:92>: register mpeg4dx decoder success!
INFO   : cedarc <CedarPluginVDInit:79>: register mpeg4H263 decoder success!
INFO   : cedarc <CedarPluginVDInit:90>: register mpeg4Normal decoder success!
INFO   : cedarc <CedarPluginVDInit:74>: register vc1 decoder success!
INFO   : cedarc <CedarPluginVDInit:85>: register h265 decoder success!
gmrender-resurrect started [ gmediarender 0.0.9 (libupnp-1.14.10; glib-2.50.1; withou[14742.072053] [SNDCODEC][sunxi_card_hw_params][620]:stream_flag: 0
t gstreamer.) ].
Logging switched off. Enable with --logfile=<filename> (or --logfile=stdout for console)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> tina_multimedia <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag   : tina3.5
branch: tina-dev
date  : Mon Jul 15 19:04:59 2019 +0800
Change-Id: I5f6c8a88d7b387a312b7744797a0d5f8ab07ee7a
-------------------------------------------------------------------------------
xplayer:process message XPLAYER_COMMAND_SET_AUDIOSINK.
xplayer:process message XPLAYER_COMMAND_SET_SURFACE.
xplayer:process message XPLAYER_COMMAND_SET_SUBCTRL.
xplayer:process message XPLAYER_COMMAND_SET_DI.
dd: writing '/dev/fb0': No space left on device
32401+0 records in
32400+0 records out
ERROR [2024-06-21 15:45:10.824354 | webserver] Could not stat './/grender-64x64.png': No such file or directory
ERROR [2024-06-21 15:45:10.824939 | webserver] Could not stat './/grender-128x128.png': No such file or directory
output_set_volume
Ready for rendering.

打开手机B站APP,在投屏功能上就可以看见D1-H这个设备了:

在这里插入图片描述

点击D1-H即可在hdmi屏幕上进行wifi投屏了。

LVGLv9.1.0移植

1. 移植步骤

1.1 下载LVGL源码

名称仓库地址描述
lv_port_linuxhttps://github.com/lvgl/lv_port_linux.git适配有framebuffer、DRM/KMS和SDL2的linux系统的接口

在ubuntu上,新建终端,克隆上面的仓库地址:

ubuntu@ubuntu1804:~$ git clone https://github.com/lvgl/lv_port_linux.git
ubuntu@ubuntu1804:~$ cd lv_port_linux/
ubuntu@ubuntu1804:~/lv_port_linux$ git submodule update --init --recursive
Cloning into '/home/ubuntu/lv_port_linux/lvgl'...
Submodule path 'lvgl': checked out 'e29d35b43c509b6d7189f5dac87139441669ae66'
Submodule path 'lvgl': checked out 'e29d35b43c509b6d7189f5dac87139441669ae66'

查看目录结构:

ubuntu@ubuntu1804:~/lv_port_linux$ tree -L 2
.
├── CMakeLists.txt
├── LICENSE
├── lv_conf.h
├── lvgl
│   ├── CMakeLists.txt
│   ├── CMakePresets.json
│   ├── component.mk
│   ├── demos
│   ├── docs
│   ├── env_support
│   ├── examples
│   ├── idf_component.yml
│   ├── Kconfig
│   ├── library.json
│   ├── library.properties
│   ├── LICENCE.txt
│   ├── lv_conf_template.h
│   ├── lvgl.h
│   ├── lvgl.mk
│   ├── lvgl.pc.in
│   ├── README.md
│   ├── SConscript
│   ├── scripts
│   ├── src
│   └── tests
├── main.c
├── Makefile
├── mouse_cursor_icon.c
└── README.md

8 directories, 21 files

查看如果发现lvgl的库是9.0.1版本的,那就删除lvgl/文件夹,重新克隆:

ubuntu@ubuntu1804:~/lv_port_linux$ rm lvgl/ -rf
ubuntu@ubuntu1804:~/lv_port_linux$ git clone https://github.com/lvgl/lvgl.git
Cloning into 'lvgl'...
remote: Enumerating objects: 104172, done.
remote: Counting objects: 100% (15487/15487), done.
remote: Compressing objects: 100% (1633/1633), done.
remote: Total 104172 (delta 14432), reused 13985 (delta 13854), pack-reused 88685
Receiving objects: 100% (104172/104172), 332.99 MiB | 12.14 MiB/s, done.
Resolving deltas: 100% (79168/79168), done.
Checking out files: 100% (2894/2894), done.
ubuntu@ubuntu1804:~/lv_port_linux$

可以看到:

ubuntu@ubuntu1804:~/lv_port_linux$ cd lvgl/
ubuntu@ubuntu1804:~/lv_port_linux/lvgl$ vim lv_conf_template.h 

/**
 * @file lv_conf.h
 * Configuration file for v9.1.1-dev
 */

源码获取完毕!接下来就是编译了。

1.2 编译

想要在开发板上运行,当然是需要指定相应的交叉编译工具的了。

创建一个文件toolchain.cmake,用于指定交叉编译工具:

set(CMAKE_SYSTEM_NAME Linux)
#如果是arm,就写arm;这里是riscv
set(CMAKE_SYSTEM_PROCESSOR riscv)

set(tools "/home/ubuntu/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702")
set(CMAKE_C_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/riscv64-unknown-linux-gnu-g++)

为了方便编译,编写一个脚本build.sh

rm -rf build
mkdir -p build
cd build/
cmake -DCMAKE_TOOLCHAIN_FILE="../toolchain.cmake" ..
make -j8

目录结构如下:

ubuntu@ubuntu1804:~/lv_port_linux$ tree -L 1
.
├── build.sh
├── CMakeLists.txt
├── LICENSE
├── lv_conf.h
├── lvgl
├── main.c
├── Makefile
├── mouse_cursor_icon.c
├── README.md
└── toolchain.cmake

1 directory, 9 files

经过编译测试,需要修改CMakeLists.txt,否则编译会报错,注释掉下面几个:

--- CMakeLists.txt-bak	2024-06-24 22:11:40.077461049 -0400
+++ CMakeLists.txt	2024-06-24 22:12:16.549404544 -0400
@@ -12,12 +12,12 @@
 
 add_executable(main main.c mouse_cursor_icon.c)
 
-include(${CMAKE_CURRENT_LIST_DIR}/lvgl/tests/FindLibDRM.cmake)
-include_directories(${Libdrm_INCLUDE_DIRS})
+#include(${CMAKE_CURRENT_LIST_DIR}/lvgl/tests/FindLibDRM.cmake)
+#include_directories(${Libdrm_INCLUDE_DIRS})
 
-find_package(SDL2)
-find_package(SDL2_image)
-include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})
+#find_package(SDL2)
+#find_package(SDL2_image)
+#include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})
 
 target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${Libdrm_LIBRARIES} m pthread)
 add_custom_target (run COMMAND ${EXECUTABLE_OUTPUT_PATH}/main DEPENDS main)

执行./build.sh,编译:

ubuntu@ubuntu1804:~/lv_port_linux$ sudo chmod +x build.sh
ubuntu@ubuntu1804:~/lv_port_linux$ ./build.sh 
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
...
[ 99%] Linking C static library ../lib/liblvgl_examples.a
[ 99%] Built target lvgl_examples
[ 99%] Linking C static library ../lib/liblvgl_demos.a
[ 99%] Built target lvgl_demos
[ 99%] Building C object CMakeFiles/main.dir/mouse_cursor_icon.c.o
[ 99%] Building C object CMakeFiles/main.dir/main.c.o
[100%] Linking CXX executable /home/ubuntu/lv_port_linux/bin/main
[100%] Built target main
ubuntu@ubuntu1804:~/lv_port_linux$

编译成功,可执行程序保存在bin/目录下:

ubuntu@ubuntu1804:~/lv_port_linux$ file bin/main 
bin/main: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linux 4.15.0, with debug_info, not stripped
ubuntu@ubuntu1804:~/lv_port_linux$

1.3 测试

使用adb推送到D1H开发板上即可:

ubuntu@ubuntu1804:~/lv_port_linux$ adb push bin/main /mnt/UDISK/
bin/main: 1 file pushed. 1.4 MB/s (2297184 bytes in 1.601s)
ubuntu@ubuntu1804:~/lv_port_linux$

开发板上执行./main,会出现警告,还会感觉卡卡的:

root@TinaLinux:/mnt/UDISK# ./main
[Warn]  (0.000, +0)      lv_init: Memory integrity checks are enabled via LV_USE_ASSERT_MEM_INTEGRITY which makes LVGL much slower lv_init.c:232
[Warn]  (0.000, +0)      lv_init: Object sanity checks are enabled via LV_USE_ASSERT_OBJ which makes LVGL much slower lv_init.c:236
[Warn]  (0.000, +0)      lv_init: Style sanity checks are enabled that uses more RAM lv_init.c:240

根据警告,修改lv_conf.h

231 /*Enable asserts if an operation is failed or an invalid data is found.
232  *If LV_USE_LOG is enabled an error message will be printed on failure*/
233 #define LV_USE_ASSERT_NULL          0   /*Check if the parameter is NULL. (Very fast, recommended)*/
234 #define LV_USE_ASSERT_MALLOC        0   /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
235 #define LV_USE_ASSERT_STYLE         0   /*Check if the styles are properly initialized. (Very fast, recommended)*/
236 #define LV_USE_ASSERT_MEM_INTEGRITY 0   /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
237 #define LV_USE_ASSERT_OBJ           0   /*Check the object's type and existence (e.g. not deleted). (Slow)*/

再次编译./build.sh,上传执行即可。

2. 支持触摸

2.1 修改lv_conf.h

如果想要支持触摸功能,修改lv_conf.h

888 /*Driver for evdev input devices*/
889 #define LV_USE_EVDEV    1

2.2 修改main.c

main.c,添加触摸初始化:

int main(void)
{
    lv_init();

    /*Linux display device init*/
    lv_linux_disp_init();

    /*input touch device init*/
    lv_indev_t * indev = lv_evdev_create(LV_INDEV_TYPE_POINTER, "/dev/input/event3");

    /*Create a Demo*/
    lv_demo_widgets();
    //lv_demo_widgets_start_slideshow();

    /*Handle LVGL tasks*/
    while(1) {
        lv_timer_handler();
        usleep(5000);
    }

    return 0;
}

2.3 测试

如果不知道哪个是触摸的设备节点,用最简单的方式去测试。

执行hexdump /dev/input/event*,一个一个设备节点去试,用手触碰屏幕:

root@TinaLinux:/mnt/UDISK# hexdump /dev/input/event3
0000000 0f0e 0000 0000 0000 aa0f 0006 0000 0000
0000010 0003 0039 0000 0000 0f0e 0000 0000 0000
0000020 aa0f 0006 0000 0000 0003 003a 0002 0000
0000030 0f0e 0000 0000 0000 aa0f 0006 0000 0000
0000040 0003 0030 0008 0000 0f0e 0000 0000 0000
0000050 aa0f 0006 0000 0000 0003 0035 0192 0000
0000060 0f0e 0000 0000 0000 aa0f 0006 0000 0000
0000070 0003 0036 01cd 0000 0f0e 0000 0000 0000
0000080 aa0f 0006 0000 0000 0001 014a 0001 0000
0000090 0f0e 0000 0000 0000 aa0f 0006 0000 0000
00000a0 0000 0000 0000 0000 0f0e 0000 0000 0000
00000b0 d808 0006 0000 0000 0003 003a 0003 0000
00000c0 0f0e 0000 0000 0000 d808 0006 0000 0000
00000d0 0000 0000 0000 0000 0f0e 0000 0000 0000
00000e0 05a1 0007 0000 0000 0003 003a 0004 0000
00000f0 0f0e 0000 0000 0000 05a1 0007 0000 0000
0000100 0000 0000 0000 0000 0f0e 0000 0000 0000
0000110 332e 0007 0000 0000 0003 003a 0005 0000
0000120 0f0e 0000 0000 0000 332e 0007 0000 0000
0000130 0000 0000 0000 0000 0f0e 0000 0000 0000
0000140 60bc 0007 0000 0000 0003 003a 0006 0000
0000150 0f0e 0000 0000 0000 60bc 0007 0000 0000
0000160 0003 0030 0007 0000 0f0e 0000 0000 0000
0000170 60bc 0007 0000 0000 0000 0000 0000 0000
0000180 0f0e 0000 0000 0000 8983 0007 0000 0000
0000190 0003 0039 ffff ffff 0f0e 0000 0000 0000
00001a0 8983 0007 0000 0000 0001 014a 0000 0000
00001b0 0f0e 0000 0000 0000 8983 0007 0000 0000

有数据说明就是这个设备节点了。

OK,编译再次上传执行,完毕!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2071589.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【单片机】PIC16F1719 单片机,UART,串口发送

/** 文件: main.c* 目标: PIC16F1719* 编译器: XC8 v1.41* 开发环境: MPLABX v4.10** 创建日期: 2023年8月4日 下午2:58** PIC16F1719* +-----------------+* VPP -> 1 : RE3/MCLR/VPP : 40 <> PGD/RB7* <>…

【二分-BM19 寻找峰值】

题目 BM19 寻找峰值 描述 给定一个长度为n的数组nums&#xff0c;请你找到峰值并返回其索引。数组可能包含多个峰值&#xff0c;在这种情况下&#xff0c;返回任何一个所在位置即可。 分析 对一个左闭右闭的区间二分&#xff0c;通过改变l 或r 的值将原始查找区间缩小一半…

【HarmonyOS NEXT星河版开发实战】页面跳转

个人主页→VON 收录专栏→鸿蒙综合案例开发​​​​​ 代码及其图片资源会发布于gitee上面&#xff08;已发布&#xff09; gitee地址https://gitee.com/wang-xin-jie234 目录 前言 界面功能介绍 界面构建过程 知识点概述 页面跳转 页面传参 全套源代码 Index页面 Sec…

API 的多版本管理,如何在 Apifox 中操作?

开放 API 是技术团队向外部提供服务和数据的关键手段。随着业务的发展和技术的更新&#xff0c;API 也需要不断进行版本迭代。这种迭代通常是为了满足市场需求&#xff0c;优化现有功能&#xff0c;增加新特性&#xff0c;或者修复漏洞。 在多个版本共存的情况下&#xff0c;团…

pikachu靶场----ssrf实现

目录 ssrf简介 SSRF&#xff08;curl&#xff09; 1.后端代码分析 2.http协议连接本地文件 3.file协议读取C盘中的文件。 4.dict协议扫描内网其他主机的端口开放情况 5.使用burp扫描内网其他主机的端口开放情况 ssrf简介 SSRF(Server-Side Request Forgery:服务器端请求…

AI引领边缘计算变革,打造嵌入式产业新未来

在科技的洪流中&#xff0c;AI&#xff08;人工智能&#xff09;如同一位强大的领航者&#xff0c;正引领着边缘计算发生深刻的变革&#xff0c;为嵌入式产业开辟出一片充满无限可能的新未来。 曾经&#xff0c;我们难以想象智能设备能够在无需依赖云端强大计算能力的情况下&am…

.NET_WebForm_layui控件使用及与webform联合使用

使用layui控件填充布局 操作流程&#xff1a; 创建项目。引入css以及js样式。使用栅格样式进行布局。官网查找控件元素&#xff08;此处以图标和按钮为例&#xff09;。将对应的元素从官网复制下来。在布局中填充。很简单的操作&#xff0c;其他控件也同理&#xff0c;不再赘…

GlusterFS-分布式文件系统:概念、案例

目录 GlusterFS 简介 概念 文件系统 通信方式 Cluster特点 扩展性和高性能 高可用性 全局统一命名空间 弹性卷管理 基于标准协议 GlusterFS术语 &#xff08;1&#xff09;Brick &#xff08;2&#xff09;Volume &#xff08;3&#xff09;FUSE &#xff08;4…

因http连接问题产生的生产事故

早上7点接到报警&#xff08;有机器oom报警&#xff0c;且负载很高&#xff0c;运维看阿里云监控上的tcp链接&#xff09;&#xff0c;研发和运维小伙伴一起分析&#xff0c;因为怕影响线上客户&#xff0c;直接选择了服务回退&#xff08;昨天&#xff09;。 服务回退后&…

2024/08(二) 近期关于AI的阅读和理解[笔记]

## Multi Agent/Flow 最近团队在实验 flowise 的 Agentflows 设计&#xff0c;顺带看了现在市面多加解决方案&#xff0c;这两天偶尔看到蚂蚁CodeFuse团队开发的Mulit Agent框架开发思想&#xff0c; 所以将他们一起总结归纳下。 Agent Base&#xff1a;构建了四种基本的Agent…

【计算机三级-数据库技术】操作题大题(第1套)

46题 1 设要为某工厂设计一个数据库&#xff0c;需要记录如下信息&#xff08;有下划线的信息可作为唯一标识&#xff09;&#xff1a; •产品有产品名、规格&#xff1b; •每种产品拥有多道加工工序&#xff0c;每道加工工序只适用于一种产品&#xff1b; •每道工序需要记…

【CAN总线测试】——CAN交互层测试

从0开始学习CANoe使用 从0开始学习车载测试 相信时间的力量 星光不负赶路者&#xff0c;时光不负有心人。 目录 1.应用报文发送检查 2.周期型报文测试 3.信号使用位与未使用位默认值检查 4.突增负载测试 5.CheckSum测试 6.RollongCounter测试 1.应用报文发送检查 用例编…

四种常见的云攻击及其应对措施

随着云应用的快速发展&#xff0c;也吸引了众多潜在恶意人士的觊觎。企业用户往往习惯于使用联盟或VPN进行直接连接或通过合作伙伴进行连接。 现在&#xff0c;另一个能够攻击者提供访问级别的攻击媒介竟然是云服务供应商(CSP)&#xff0c;这在以往是前所未有的。违规CSP有可能…

秒懂C++之set、map的封装

目录 红黑树的泛型编程 改变比较方式&#xff1a;仿函数 迭代器模拟实现 运算符重载 begin/end !/运算符重载 测试 const Find [ ] 运算符重载 全部代码 RBTree.h Mymap.h Myset.h test.cpp 红黑树的泛型编程 既然我们要实现set,map的封装那肯定要用到我们前面所学…

LLaMa系列模型详解(原理介绍、代码解读):LLaMa_llama模型

LLaMA详解 LLaMA&#xff08;Large Language Model Meta AI&#xff09;是由Meta&#xff08;前身为Facebook&#xff09;开发的一种大规模语言模型&#xff0c;旨在提高自然语言处理&#xff08;NLP&#xff09;任务的性能。LLaMA基于变换器&#xff08;Transformer&#xff…

只需5分钟!手把手教你安装StableDiffusion,开启AI图像生成新纪元

在这个数字化时代&#xff0c;人工智能&#xff08;AI&#xff09;技术已经深入到我们生活的每一个角落。 特别是在图像生成领域&#xff0c;AI技术的应用不仅极大地提高了创作效率&#xff0c;更开启了艺术创作的新纪元。 今天&#xff0c;我们将聚焦于StableDiffusion这一先…

【数据结构】关于二叉搜索树,你知道如何实现增删模拟吗???(超详解)

前言&#xff1a; &#x1f31f;&#x1f31f;Hello家人们&#xff0c;这期讲解二叉搜索树内部实现基础功能模拟&#xff0c;希望能帮到屏幕前的你。 &#x1f308;上期博客在这里&#xff1a;http://t.csdnimg.cn/rfYFW &#x1f308;感兴趣的小伙伴看一看小编主页&#xff1a…

从需求到交付:动态敏捷如何确保每一行代码都物超所值

动态敏捷方法论在软件开发中的应用 在当今快速变化的商业环境中&#xff0c;软件开发团队面临着不断变化的需求和市场挑战。传统的瀑布式开发模型已无法满足现代软件开发的灵活性和响应速度需求。动态敏捷&#xff08;Dynamic Agility&#xff09;作为一种新兴的开发方法论&…

introsort的快排跑排序OJ代码

introsort的快排跑排序OJ代码 introsort是introspective sort采⽤了缩写&#xff0c;他的名字其实表达了他的实现思路&#xff0c;他的思路就是进⾏⾃ 我侦测和反省&#xff0c;快排递归深度太深&#xff08;sgi stl中使⽤的是深度为2倍排序元素数量的对数值&#xff09;那就说…

《黑神话:悟空》在未来市场的应用与代码案例分析

作者主页: 知孤云出岫 目录 作者主页:**《黑神话&#xff1a;悟空》在未来市场的应用与代码案例分析****一、引言****二、市场应用场景分析****1. 数据驱动的市场决策****2. 游戏内经济系统的智能优化****3. 个性化推荐系统与用户体验提升** **三、市场推广与用户扩展策略***…