页次: 1
嗯嗯,多谢晕哥解答,这是生成的镜像大小
是改 /board/widora/mangopi/r3/devicetree/linux下的devicetree.dts么?把ram分区调大么?
spi-nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
//status = "disabled";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x80000>;
read-only;
};
partition@1 {
label = "kernel.itb";
reg = <0x80000 0x580000>;
read-only;
};
partition@2 {
label = "rom";
reg = <0x600000 0x4000000>;
read-only;
};
partition@3 {
label = "overlay";
reg = <0x4800000 0x3000000>;
};
};
};
应该是squashfs根文件系统系统超大了,你看下文件系统镜像文件多大,然后改dts文件,应该就可以了。
首先感谢aodzip大佬分享的开发包,让我这个菜鸟编译系统顺利了n倍,感谢晕哥提供的平台和各位大佬的帮助。
最近想跟着逸俊晨晖大佬的帖子,跑一下视频硬解码,结果每次编译后文件系统的挂载都有问题,后来发现只要在菜单勾选ffmpg选项,哪怕只选择h264解码也不行。(编译的文件系统14M左右)
看报错unable to read id index table是分区表没找到,导致挂载文件系统失败?
看论坛的帖子,知道开发包的文件系统分squashfs只读文件系统和overlay分区的可写文件系统来实现可读可写,会不会是文件系统变大超出分区了?
0x000000000000-0x000000080000 : "u-boot"
0x000000080000-0x000000600000 : "kernel.itb"
0x000000600000-0x000004600000 : "rom" //squashfs只读文件系统
0x000004800000-0x000007800000 : "overlay" //jffs2文件系统
应该改 buildroot-tiny200/board/allwinner/generic/genimage-nand.cfg nand镜像分区配置?
还是改 buildroot-tiny200/board/allwinner/generic/uboot.env
buildroot-tiny200/board/allwinner/generic/legacy/uboot.env 里面的环境变量?
板子:MangoPi R3 128M nand版
环境:buildroot-tiny200 (F1C100/200s) 开发包
下面是勾选配置和完整启动信息,那位大佬知道的话还请指点一二 ^_^!
U-Boot SPL 2020.07 (Jun 10 2021 - 15:57:37 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from MMC2
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
SPI-NAND: GigaDevice GD5F1GQ4UAYIG
SPI-NAND: U-Boot address: 53248
U-Boot 2020.07 (Jun 10 2021 - 15:57:37 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Allwinner F1C100s Generic Device
DRAM: 64 MiB
MMC: mmc@1c0f000: 0, mmc@1c10000: 1
Setting up a 800x480 lcd console (overscan 0x0)
In: serial
Out: serial
Err: serial
Allwinner mUSB OTG (Peripheral)
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
Card did not respond to voltage select!
unrecognized JEDEC id bytes: ff, c8, f1
Failed to initialize SPI flash at 0:0 (error -2)
List of MTD devices:
* spi-nand0
- device: spi-nand@1
- parent: spi@1c05000
- driver: spi_nand
- type: NAND flash
- block size: 0x20000 bytes
- min I/O: 0x800 bytes
- OOB size: 64 bytes
- OOB available: 31 bytes
- 0x000000000000-0x000008000000 : "spi-nand0"
=========================
Boot Device: spi
Boot Slot 0: empty
Boot Slot 1: spi-nand
=========================
DFU waiting on SPI-NAND...
musb-hdrc: peripheral reset irq lost!
Booting from SPI-NAND...
Reading 5767168 byte(s) (2816 page(s)) at offset 0x00080000
## Loading kernel from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'kernel@0' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x810000cc
Data Size: 4309048 Bytes = 4.1 MiB
Architecture: ARM
OS: Linux
Load Address: 0x80000000
Entry Point: 0x80000000
Hash algo: crc32
Hash value: f1a8af74
Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'fdt@0' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x8141c1e8
Data Size: 15655 Bytes = 15.3 KiB
Architecture: ARM
Hash algo: crc32
Hash value: 7947cec8
Verifying Hash Integrity ... crc32+ OK
Booting using the fdt blob at 0x8141c1e8
Loading Kernel Image
Loading Device Tree to 80ff9000, end 80fffd26 ... OK
Cannot setup simplefb: node not found
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.92 (root@8d496aa93fd6) (gcc version 8.4.0 (Buildroot -g22245a5-dirty)) #1 Thu Jun 10 15:58:19 CST 2021
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Widora MangoPi R3
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x83000000
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 rootwait init=/preinit root=/dev/mtdblock2 rootfstype=squashfs overlayfsdev=/dev/mtdblock3 net.ifnames=0 vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 38736K/65536K available (6144K kernel code, 248K rwdata, 1676K rodata, 1024K init, 225K bss, 10416K reserved, 16384K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x254/0x444 with crng_init=0
[ 0.000049] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000142] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000897] Console: colour dummy device 80x30
[ 0.000992] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070263] pid_max: default: 32768 minimum: 301
[ 0.070804] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.070851] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.072786] CPU: Testing write buffer coherency: ok
[ 0.074862] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076053] devtmpfs: initialized
[ 0.088203] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.088267] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.092586] pinctrl core: initialized pinctrl subsystem
[ 0.095137] NET: Registered protocol family 16
[ 0.098898] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.101302] cpuidle: using governor menu
[ 0.145666] SCSI subsystem initialized
[ 0.146068] usbcore: registered new interface driver usbfs
[ 0.146227] usbcore: registered new interface driver hub
[ 0.146389] usbcore: registered new device driver usb
[ 0.146912] mc: Linux media interface: v0.10
[ 0.147042] videodev: Linux video capture interface: v2.00
[ 0.147176] pps_core: LinuxPPS API ver. 1 registered
[ 0.147194] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.147260] PTP clock support registered
[ 0.148360] ion_parse_dt_heap_common: id 4 type 4 name cma align 1000
[ 0.149297] Advanced Linux Sound Architecture Driver Initialized.
[ 0.151849] clocksource: Switched to clocksource timer
[ 0.183688] thermal_sys: Registered thermal governor 'step_wise'
[ 0.184503] NET: Registered protocol family 2
[ 0.185993] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.186070] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.186124] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.186171] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.186435] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.186493] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.187018] NET: Registered protocol family 1
[ 0.189658] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.191556] Initialise system trusted keyrings
[ 0.192324] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.214764] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.215423] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.337664] Key type asymmetric registered
[ 0.337705] Asymmetric key parser 'x509' registered
[ 0.337882] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.337908] io scheduler mq-deadline registered
[ 0.337926] io scheduler kyber registered
[ 0.354205] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.379602] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.385922] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[ 0.387295] printk: console [ttyS0] disabled
[ 0.407601] 1c25400.serial: ttyS0 at MMIO 0x1c25400 (irq = 27, base_baud = 6250000) is a 16550A
[ 0.841418] printk: console [ttyS0] enabled
[ 0.851177] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 0.872318] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.881965] SCSI Media Changer driver v0.25
[ 0.887809] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 0.900714] spi-nand spi0.0: GigaDevice SPI NAND was found.
[ 0.906419] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[ 0.916009] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.922475] Creating 4 MTD partitions on "spi0.0":
[ 0.927313] 0x000000000000-0x000000080000 : "u-boot"
[ 0.937742] 0x000000080000-0x000000600000 : "kernel.itb"
[ 0.946595] random: fast init done
[ 0.969643] 0x000000600000-0x000004600000 : "rom"
[ 1.203317] 0x000004800000-0x000007800000 : "overlay"
[ 1.380159] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.386811] ehci-platform: EHCI generic platform driver
[ 1.392508] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.398733] ohci-platform: OHCI generic platform driver
[ 1.404552] usbcore: registered new interface driver usb-storage
[ 1.411526] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.425183] i2c /dev entries driver
[ 1.429333] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 1.443175] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 1.454196] sun4i-csi 1cb0000.csi: Packed (RAW) format enabled.
[ 1.462071] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.472136] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.510184] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.519608] usbcore: registered new interface driver usbhid
[ 1.525300] usbhid: USB HID core driver
[ 1.529474] sunxi-cedar 1c0e000.video-codec: sunxi cedar version 0.01alpha
[ 1.536807] sunxi-cedar 1c0e000.video-codec: cedar-ve the get irq is 20
[ 1.548638] debugfs: Directory '1c23c00.codec' with parent 'F1C100s Audio Codec' already present!
[ 1.562557] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[ 1.578587] NET: Registered protocol family 17
[ 1.583275] Key type dns_resolver registered
[ 1.588662] Loading compiled-in X.509 certificates
[ 1.607053] sun4i-drm soc:display-engine: bound 1e00000.display-frontend (ops 0xc073b278)
[ 1.616110] sun4i-drm soc:display-engine: bound 1e60000.display-backend (ops 0xc073aab8)
[ 1.625668] sun4i-drm soc:display-engine: bound 1c0c000.lcd-controller (ops 0xc0739658)
[ 1.634256] sun4i-drm soc:display-engine: bound 1c0a000.tv-encoder (ops 0xc073a378)
[ 1.642032] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.648633] [drm] No driver support for vblank timestamp query.
[ 1.656340] [drm] Initialized sun4i-drm 1.0.0 20150629 for soc:display-engine on minor 0
[ 1.665374] [drm] kms: can't enable cloning when we probably wanted to.
[ 1.737113] Console: switching to colour frame buffer device 100x30
[ 1.775979] sun4i-drm soc:display-engine: fb0: sun4i-drmdrmfb frame buffer device
[ 1.784530] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.802354] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.809113] ALSA device list:
[ 1.812215] #0: F1C100s Audio Codec
[ 1.816494] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.825227] cfg80211: failed to load regulatory.db
[ 1.836565] unable to read id index table
[ 1.840975] List of all partitions:
[ 1.844663] 1f00 512 mtdblock0
[ 1.844672] (driver?)
[ 1.851280] 1f01 5632 mtdblock1
[ 1.851287] (driver?)
[ 1.857903] 1f02 65536 mtdblock2
[ 1.857908] (driver?)
[ 1.864528] 1f03 49152 mtdblock3
[ 1.864535] (driver?)
[ 1.871058] No filesystem could mount root, tried:
[ 1.871063] squashfs
[ 1.875969]
[ 1.879769] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[ 1.888107] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.92 #1
[ 1.893834] Hardware name: Allwinner suniv Family
[ 1.898615] [<c010e1a8>] (unwind_backtrace) from [<c010b954>] (show_stack+0x10/0x14)
[ 1.906385] [<c010b954>] (show_stack) from [<c06ee31c>] (panic+0xe8/0x2e4)
[ 1.913278] [<c06ee31c>] (panic) from [<c090135c>] (mount_block_root+0x2bc/0x31c)
[ 1.920760] [<c090135c>] (mount_block_root) from [<c0901568>] (prepare_namespace+0x128/0x188)
[ 1.929289] [<c0901568>] (prepare_namespace) from [<c06f6154>] (kernel_init+0x8/0x108)
[ 1.937204] [<c06f6154>] (kernel_init) from [<c01010e0>] (ret_from_fork+0x14/0x34)
[ 1.944752] Exception stack(0xc2839fb0 to 0xc2839ff8)
[ 1.949801] 9fa0: 00000000 00000000 00000000 00000000
[ 1.957968] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1.966130] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 1.972739] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2) ]---
在两位大佬的基础上更新lvgl到v7版
1、在链接时没有链接标准库,导致没有strcat,strncpy,atoi,strtok,itoa等。我不知道该怎么改,就重写了一下这些函数。
2、为减小文件体积,编译器没放在工程里,需要大家自己下载。编译器我在ubuntu下,用的gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
在Makefile文件中更改编译器位置。
CROSS_COMPILE = 解压的路径/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-
3、在工程路径下,执行make即可编译,出现下面的信息就是成功了。
Make header information for brom booting
bootloader size= 1800
The bootloader head has been fixed
4、生成的固件在 /build/firmware.bin
5、液晶屏驱动参数我改了一下,支持RGB565
6、感谢诸位大佬的无私奉献,让我少走许多弯路,在下水平有限,哪里不对的欢迎大家批评指正
显示效果:
工程文件下载:
https://whycan.cn/files/members/4756/lvgl_v7_f1c100s.zip
F1C100S的Keil裸机USB+LCD+PWM+GPIO工程搞定,修复GNU工具链BUG
https://whycan.cn/t_3645.html
lvgl移植到裸跑的f1c100s上
https://whycan.cn/t_1984.html
在大侠达克罗德放出的《F1C100S裸奔framebuffer + PWM + GPIO驱动》基础上移植LVGL。
目前已经能够在800*480的屏幕上使用32颜色深度,跑lvgl的demo例子。
但感觉速度很慢,比在linux下使用fbdev还慢。
有时间再优化。
看看能不能用DMA实现数据传输。
lchjng 说:你好,晕哥,请问楼主的那个参考程序,如何在win7的环境下用什么工具编译啊
https://whycan.cn/t_3649.html#p33367
编译软件下载: https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update
Linux 编译软件下载: gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2编译软件可以用上面的gcc, windows/linux 版本都有,
make 在 linux自带, windows 的 msys 软件包也带 make.
多谢诸位相助,感谢小二大佬指点!
将 "PD0", "PD12" 从lcd_rgb666_pins中删除, 将twi0_pins的引脚定义为"PD0", "PD12",make clean 后重新编译 设备树,linux内核后,屏幕显示也好使,触摸也有数据了。
lcd_rgb666_pins: lcd-rgb666-pins {
pins = "PD1", "PD2", "PD3", "PD4",
"PD5", "PD6", "PD7", "PD8", "PD9",
"PD10", "PD11", "PD13", "PD14",
"PD15", "PD16", "PD17", "PD18", "PD19",
"PD20", "PD21";
function = "lcd";
};
twi0_pins: twi0-pin-pd {
pins = "PD0", "PD12";
function = "i2c0";
};
我看原理图上NS2009硬件 TWI0 SCK 接 PD0 , TWI0SDA 接 PD12 没问题。
suniv.dtsi中PD0 PD12 已经定义为lcd_rgb666_pins,
lcd_rgb666_pins: lcd-rgb666-pins {
pins = "PD0", "PD1", "PD2", "PD3", "PD4",
"PD5", "PD6", "PD7", "PD8", "PD9",
"PD10", "PD11", "PD12", "PD13", "PD14",
"PD15", "PD16", "PD17", "PD18", "PD19",
"PD20", "PD21";
function = "lcd";
};
我对比了一下,发现这段初始化frame buffer device的时候,PD0被twi占用了,导致没有fb0。我在改改试试。
多谢 流氓兔,小二大佬^_^
这是正常的
[ 1.227428] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[ 1.236224] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[ 1.244009] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.250666] [drm] No driver support for vblank timestamp query.
[ 1.304634] Console: switching to colour frame buffer device 60x34
[ 1.328041] sun4i-drm display-engine: fb0: frame buffer device
[ 1.335169] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
这是不正常的
[ 1.259679] suniv-pinctrl 1c20800.pinctrl: pin PD0 already requested by 1c27000.twi; cannot claim for 1c0c000.lcd-controller
[ 1.270999] suniv-pinctrl 1c20800.pinctrl: pin-96 (1c0c000.lcd-controller) status -22
[ 1.278881] suniv-pinctrl 1c20800.pinctrl: could not request pin 96 (PD0) from group PD0 on device 1c20800.pinctrl
[ 1.289334] sun4i-tcon 1c0c000.lcd-controller: Error applying setting, reverse things back
[ 1.297629] sun4i-tcon: probe of 1c0c000.lcd-controller failed with error -22
问题描述:本来屏幕好使,尝试移植ns2009电阻触摸驱动后,开机uboot屏幕有显示,启动内核时,屏幕一点一点变黑,进入系统后evtest 测试触摸有数据。
运行LVGL程序提示
Error: cannot open framebuffer device: No such file or directory
下面是移植驱动的步骤,麻烦各位大佬瞅瞅哪里步骤不对,指点一二,小弟感激不尽^_^
将ns2009.c放到drivers/input/touchscreen目录下
drivers/input/touchscreen/Makefile 增加了
obj-$(CONFIG_TOUCHSCREEN_NS2009) += ns2009.o
drivers/input/touchscreen/Kconfig 增加了
config TOUCHSCREEN_NS2009
tristate "Nsiway NS2009 touchscreen"
depends on I2C
select INPUT_POLLDEV
help
Say Y here to enable Nsiway NS2009 resistive touchscreen
controller support.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called ns2009.
linux/arch/arm/boot/dts下suniv.dtsi增加了
i2c0: i2c@1C27000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01C27000 0x400>;
interrupts = <7>;
clocks = <&ccu CLK_BUS_I2C0>;
resets = <&ccu RST_BUS_I2C0>;
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
i2c0_pins: i2c0 {
pins = "PE11", "PE12";
function = "i2c0";
};
twi0: twi@1c27000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01c27000 0x400>;
interrupts = <7>;
clocks = <&ccu CLK_BUS_I2C0>;
clock-names = "apb";
resets = <&ccu RST_BUS_I2C0>;
clock-frequency = <100000>;
#address-cells = <1>;
#size-cells = <0>;
};
linux/arch/arm/boot/dts下suniv-f1c100s-licheepi-nano.dts 增加了
&pio {
ts_reset_pin: ts_reset_pin@0 {
pins = "PE9";
function = "gpio_out";
};
twi0_pins: twi0-pin-pd {
pins = "PD0", "PD12";
function = "i2c0";
};
uart1_pins: uart1-pin-pa {
pins = "PA2", "PA3";
function = "uart1";
};
};
&twi0 {
pinctrl-names = "default";
pinctrl-0 = <&twi0_pins>;
status = "okay";
ts: twi0@0x48 {
compatible = "nsiway,ns2009";
i2c-max-frequency = <100000>;
reg = <0x48>;
status = "okay";
};
};
这是启动log
U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Aug 02 2020 - 05:51:43)
DRAM: 64 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05679-g013ca457fd-dirty (Aug 02 2020 - 05:51:43 +0800) Allwinner Technology
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
Booting using the fdt blob at 0x80c00000
Loading Device Tree to 816fa000, end 816ff2ac ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@kali) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #9 Wed Aug 19 11:27:29 CST 2020
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] random: fast init done
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16002
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2 mem=63M vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 54132K/64512K available (6144K kernel code, 239K rwdata, 1440K rodata, 1024K init, 249K bss, 10380K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc4000000 - 0xff800000 ( 952 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc3f00000 ( 63 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 240 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 250 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000046] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000112] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000672] Console: colour dummy device 80x30
[ 0.000763] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070232] pid_max: default: 32768 minimum: 301
[ 0.070547] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070586] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.072030] CPU: Testing write buffer coherency: ok
[ 0.073727] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076270] devtmpfs: initialized
[ 0.083570] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.083628] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.083891] pinctrl core: initialized pinctrl subsystem
[ 0.085894] NET: Registered protocol family 16
[ 0.087458] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.089228] cpuidle: using governor menu
[ 0.115483] SCSI subsystem initialized
[ 0.115808] usbcore: registered new interface driver usbfs
[ 0.115950] usbcore: registered new interface driver hub
[ 0.116159] usbcore: registered new device driver usb
[ 0.116601] pps_core: LinuxPPS API ver. 1 registered
[ 0.116625] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.116685] PTP clock support registered
[ 0.117166] Advanced Linux Sound Architecture Driver Initialized.
[ 0.118785] clocksource: Switched to clocksource timer
[ 0.145414] NET: Registered protocol family 2
[ 0.146831] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.146903] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.146952] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.147231] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.147283] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.147750] NET: Registered protocol family 1
[ 0.149091] RPC: Registered named UNIX socket transport module.
[ 0.149133] RPC: Registered udp transport module.
[ 0.149149] RPC: Registered tcp transport module.
[ 0.149165] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.151493] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.153315] Initialise system trusted keyrings
[ 0.153867] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.171364] NFS: Registering the id_resolver key type
[ 0.171443] Key type id_resolver registered
[ 0.171465] Key type id_legacy registered
[ 0.171580] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.186212] Key type asymmetric registered
[ 0.186254] Asymmetric key parser 'x509' registered
[ 0.186465] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.186497] io scheduler noop registered
[ 0.186515] io scheduler deadline registered
[ 0.187310] io scheduler cfq registered (default)
[ 0.187343] io scheduler mq-deadline registered
[ 0.187362] io scheduler kyber registered
[ 0.188500] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.198197] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.370515] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.377175] console [ttyS0] disabled
[ 0.397427] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 24, base_baud = 6250000) is a 16550A
[ 0.873969] console [ttyS0] enabled
[ 0.884796] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.923334] brd: module loaded
[ 0.945187] loop: module loaded
[ 0.949281] SCSI Media Changer driver v0.25
[ 0.956943] m25p80 spi0.0: found w25q256, expected w25q128
[ 0.962765] m25p80 spi0.0: w25q256 (32768 Kbytes)
[ 0.968433] 4 ofpart partitions found on MTD device spi0.0
[ 0.974040] Creating 4 MTD partitions on "spi0.0":
[ 0.978898] 0x000000000000-0x000000100000 : "u-boot"
[ 0.987799] rfd_ftl: no RFD magic found in 'u-boot'
[ 0.994981] ftl_cs: FTL header not found.
[ 1.000713] 0x000000100000-0x000000110000 : "dtb"
[ 1.006713] ftl_cs: FTL header not found.
[ 1.012357] 0x000000110000-0x000000510000 : "kernel"
[ 1.028545] rfd_ftl: no RFD magic found in 'kernel'
[ 1.035754] ftl_cs: FTL header not found.
[ 1.041453] 0x000000510000-0x000001000000 : "rootfs"
[ 1.074700] rfd_ftl: no RFD magic found in 'rootfs'
[ 1.081911] ftl_cs: FTL header not found.
[ 1.088050] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.094706] ehci-platform: EHCI generic platform driver
[ 1.100315] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.106536] ohci-platform: OHCI generic platform driver
[ 1.112234] usbcore: registered new interface driver usb-storage
[ 1.119248] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 1.128303] i2c /dev entries driver
[ 1.134632] input: ns2009_ts as /devices/platform/soc/1c27000.twi/i2c-0/0-0048/input/input0
[ 1.198904] sunxi-mmc 1c0f000.mmc: base:0xdca4e2c9 irq:19
[ 1.206388] usbcore: registered new interface driver usbhid
[ 1.212088] usbhid: USB HID core driver
[ 1.234775] NET: Registered protocol family 17
[ 1.239587] Key type dns_resolver registered
[ 1.246229] Loading compiled-in X.509 certificates
[ 1.259679] suniv-pinctrl 1c20800.pinctrl: pin PD0 already requested by 1c27000.twi; cannot claim for 1c0c000.lcd-controller
[ 1.270999] suniv-pinctrl 1c20800.pinctrl: pin-96 (1c0c000.lcd-controller) status -22
[ 1.278881] suniv-pinctrl 1c20800.pinctrl: could not request pin 96 (PD0) from group PD0 on device 1c20800.pinctrl
[ 1.289334] sun4i-tcon 1c0c000.lcd-controller: Error applying setting, reverse things back
[ 1.297629] sun4i-tcon: probe of 1c0c000.lcd-controller failed with error -22
[ 1.306354] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.318239] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.324165] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.334445] hub 1-0:1.0: USB hub found
[ 1.338961] hub 1-0:1.0: 1 port detected
[ 1.345821] using random self ethernet address
[ 1.350409] using random host ethernet address
[ 1.356619] usb0: HOST MAC 72:d3:b8:20:13:73
[ 1.361146] usb0: MAC 8a:c6:a6:dc:9e:63
[ 1.365089] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.372650] g_cdc gadget: g_cdc ready
[ 1.377875] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.395405] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.402223] vcc3v3: disabling
[ 1.405202] ALSA device list:
[ 1.408167] #0: Loopback 1
[ 1.411932] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.420633] cfg80211: failed to load regulatory.db
[ 1.500288] random: crng init done
[ 3.005526] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[ 3.013471] devtmpfs: mounted
[ 3.020982] Freeing unused kernel memory: 1024K
Starting logging: OK
Starting mdev...
modprobe: can't change directory to '/lib/modules': No such file or directory
Initializing random number generator... done.
Starting network: OK
Welcome to King
我在论坛帖子的滋养下,从零基础小白到现在对嵌入式linux移植编译+LVGL移植+应用开发一套流程略知一二的入门级选手。在此感谢哇酷网各位大佬的相助,众多坛友的无私奉献!
我是用的是Clion配置工程,修改CMakeLists.txt文件的编译选项,用Clion编译的。(安装完Clion就保存快照,试用30天快到了,就恢复一下)
现在将LVGL_v7添加中文支持遇到的问题分享一下,希望大家能跳过这些坑。
本人水平有限,有啥错误,欢迎批评指正,大家共同进步!
一、LVGL内置字库显示
关于LVGL内置字库的配置使用,官方文档介绍的比较清楚,就不再赘述。其中有一个中文的字库LV_FONT_SIMSUN_16_CJK,不过字比较少。下面是七月中旬最先版v7的官方英文文档,接口有很大变动,如果用最新源码,参考之前v6的教程就会各种找不到属性方法。
https://whycan.cn/files/members/4756/LVGL.pdf
二、显示自己生成的内部字库
下面是阿里大佬开发的字库生成工具,使用很简单
https://whycan.cn/files/members/4756/LvglFontTool_V0_3.rar
还有一步:6、保存为myFont.c文件
将字库添加到工程需要一下几步:
1、将myFont.c另存为UTF-8编码格式,并复制到 lvgl/src/lv_font/ 下。
2、在CMakeLists.txt中 lvgl/src/lv_font/lv_font_montserrat_48.c 附近添加lvgl/src/lv_font/myFont.c。
3、在 main.c 文件中声明LV_FONT_DECLARE(myFont);(也可以按照官方改lv_conf.h)。
4、在main函数前添加测试函数
void lv_font_test()
{
LV_FONT_DECLARE(myFont);//放这里也行
lv_obj_t* label1 = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_font(label1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &myFont_6763);
lv_obj_set_pos(label1, 20, 20);
lv_label_set_text(label1, "Hello,你好,哇酷网!");
}
5、在主函数while前添加语句调用lv_font_test();
6、编译后,查看 file yourName
7、rz -y 传到板子上运行(要chmod 777 yourName)
二、显示外部bin字库
外部字库比内部字库麻烦一点。
以下为详细步骤:
1、在字库生成工具右下角类型选择外部bin字库,转换保存会生成myFont.c myFont.bin两个文件。
2、将myFont.bin文件传到板子/root/目录下,并且chmod 777 myFont.bin。
3、将myFongt.c复制到工程 lvgl/src/lv_font/ 下,并修改以下内容
//添加头文件
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//取消这行注释
static uint8_t __g_font_buf[322];//如bin文件存在SPI FLASH可使用此buff
//修改函数,就是读取bin文件
static uint8_t *__user_font_getdata(int offset, int size){
//如字模保存在SPI FLASH, SPIFLASH_Read(__g_font_buf,offset,size);
//如字模已加载到SDRAM,直接返回偏移地址即可如:return (uint8_t*)(sdram_fontddr+offset);
uint32_t br;
FILE *fp = NULL;
fp = fopen("./myFont.bin", "rb");
if(!fp){
fprintf(stderr, "can't open file myFont.bin");
exit(1);
}
fseek(fp, offset, SEEK_SET);
fread(__g_font_buf, (uint32_t)size, 1, fp);
fclose(fp);
return __g_font_buf;
}
4、在CMakeLists.txt中 lvgl/src/lv_font/lv_font_montserrat_48.c 附近添加lvgl/src/lv_font/myFont.c。
5、在 main.c 文件中声明LV_FONT_DECLARE(myFont);(也可以按照官方改lv_conf.h)。
6、在main函数前添加测试函数
void lv_font_test()
{
LV_FONT_DECLARE(myFont);//放这里也行
lv_obj_t* label1 = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_font(label1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &myFont_6763);
lv_obj_set_pos(label1, 20, 20);
lv_label_set_text(label1, "Hello,你好,哇酷网!");
}
7、在主函数while前添加语句调用lv_font_test();
8、编译,传到板子运行。
总结:内部字库在汉字过多或者过大时,编译会报错,切显示汉字错位,若要使用GB2312和所有汉字时,最好使用外bin字库。
重新看了一遍这个帖子
https://whycan.cn/t_4223.html
Tiny200做的很不错,可惜官方没有SPINAND的固件支持,故弄了超整合版本(坛子里自己的都有,非歪朵拉官方)
1.整合4.19.117内核,USB、显示、code(录音我试了ok)
2.支持SPINAND,SD卡启动,DMA SPI支持,双线模式
3.自动挂载U盘,SD卡等外设
4.整合python3+pyqt5,一起夸平台,卡的飞起(逃
5.整合设备树拓展功能,可以动态添加PE上SPI,I2C,串口等修改功能管脚和驱动状态
6.ns2009驱动也整合了,滤波可能要自己调调问题不大
7.网络配置啥的我都没管,懒。。。顺便吐槽下坑网的上传,居然没法用,总之还是比较完整的了,太懒了就不写了,空了更新。
在吐槽下tiny200,那个boot0按键更本没用,USBID不知道为啥要去掉,触摸的GPIO没啥用阿,ns2009这破玩意,就不是给人用的。
链接: https://pan.baidu.com/s/1uESxgv_yr5eCsgW9tMNN_Q 提取码: cpat 复制这段内容后打开百度网盘手机App,操作更方便哦
原来大佬已经移植过ns2009驱动了..........
握鼠标的手,微微颤抖
好吧,只能自己尝试一下了。多谢小二大佬热心答疑^_^!
r2版本ns2009接的f1c200s不是中断口,会麻烦一些,要么改驱动,要么飞线。
小二大佬,之前板子上是nada flash ,我用论坛大佬的F1C200s_UART1_TF_IMAGE,TF卡镜像跑QT5的例子时电阻触摸好使,就是有点偏差。当时没有跳线。
后来感觉nada flash太难用,不适合新手,就换成32m 的nor flash了。我下了几个论坛里的nor flash 镜像,发现也没有/dev/input, 可能大家没移植电阻触摸驱动吧(为什么感觉大家的触摸屏都好使的样子....)
要飞线的话应该怎么飞呢?论坛11页逛好多遍了,就找到荔枝派none板子的一个飞线帖子。
咱们论坛有相关的帖子么?
原谅小白刚摸到嵌入式linux的门槛....
电阻触摸? tiny200 第一版?
1. make menuconfig 开启 tsc2007,
2. dts 使能 i2c 和 tsc2007
才会出现 /dev/input/event* 设备
小二大佬,我做了如下修改还是不好使
1、make menuconfig 开启 tsc2007
2、在suniv-f1c100s-licheepi-nano.dts中添加下面代码(看荔枝派Zero这样写的,也不知对不对)
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
&i2c0 {
status = "okay";
ns2009: ns2009@48 {
compatible = "nsiway,ns2009";
reg = <0x48>;
};
};
&pio {
ts_reset_pin: ts_reset_pin@0 {
pins = "PE9";
function = "gpio_out";
};
};
3、编译设备树报错,按照官方教程在suniv.dtsi中添加下面代码,(当时编译系统的时候,看到是电容触摸适配就跳过了这一步)
// 添加在soc节点下
// 此处添加的属性与配置,来自于查找用户手册以及兼容设备
i2c0: i2c@1C27000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01C27000 0x400>;
interrupts = <7>;
clocks = <&ccu CLK_BUS_I2C0>;
resets = <&ccu RST_BUS_I2C0>;
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
// 在pio节点下,添加i2c引脚定义
i2c0_pins: i2c0 {
pins = "PE11", "PE12";
function = "i2c0";
};
4、重新打包镜像文件,烧录还是没有/dev/input文件夹
按照官方步骤编译完系统,然后编译出LittleVGL的Demo,在F1C200s上跑可以显示画面,但触摸不好使。
用的是4.3寸电阻触摸屏
提示unable open evdev interface:: No such file or directory
没有/dev/input/event0
连/dev/input文件夹都没有
内核配置已经勾选了Device Drivers->Input device support->Event interface && Event debugging
根文件系统也开启了tslib Target packages -> Libraries -> Hardware handling -> tslib
请教各位大佬,是我内核还有什么没有配置,还是根文件系统的问题呢?电阻触摸屏驱动是自带的还是要另外移植?
多谢诸位指点!
请问各位朋友们,我的板子是TINY200r2,我再TF卡中烧录镜像,linux启动后没有串口,并且一直输出ttyS: tty_port_close_start:tty-> count= 1 portcount= 2
我是参考论坛大神的帖子,使用 write_to_TF.sh烧写TF卡的
烧写TF卡时,将rootfs/media/rootfs/etc/inittab文件的
console::respawn:/abin/getty -L cinsole 0 vt100
改为
ttyS1::respawn:/abin/getty -L ttyS1 115200 vt100
请问,是我在哪一步的配置出了问题么?
Starting logging:OK
Starting network:OK
ttyS: tty_port_close_start:tty-> count= 1 portcount= 2
ttyS: tty_port_close_start:tty-> count= 1 portcount= 2
ttyS: tty_port_close_start:tty-> count= 1 portcount= 2
ttyS: tty_port_close_start:tty-> count= 1 portcount= 2
页次: 1