页次: 1
本人参加工作一直从事嵌入式开发,从湾湾的8位机,STC51,STM32,NUC972一路走来,磕磕碰碰不少。过完虎年春节,项目需求在B站上偶然看上了全志的V3S。正好适合现在的一个项目需求。于是毫不犹豫的买各式各样V3S开发板,奈何做这个的没STM32多。只找到两款。废话不说到手后开整。
准备采用linux+BSP方式构建系统。应用界面用QT完成。
主要问题在系统构建上,还好有论坛各位大牛热心帮忙。最最感谢@晕哥,无数次不厌其烦的解答些小白问题。
所以发个帖子记录一下,也让跟我一样从零入手V3S的人有个大概的了解。步骤如下(可能不完整或者表述错误,请见谅):
1.安装虚拟机我用的是 VMware Workstation Pro(当然是和谐版的);
2.在虚拟机上安装ubuntu18.04,硬件配置选择最好CPU 4核心以上,内存4G以上,网络选择桥接复制硬件连接方式,硬盘要40G以上;
3.装好Ubuntu后第一件事就是安装 vmtools,好处是可以在windows和 linux下任意复制粘贴文件或者文字;
4.安装vim
5.更改镜像源
sudo mv /etc/apt/sources.list /etc/apt/sourses.list.backup
sudo vim /etc/apt/sources.list
我选择的是阿里云的镜像:
#-------------------------------
deb [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic main restricted universe multiverse
deb [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-security main restricted universe multiverse
deb [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-updates main restricted universe multiverse
deb [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-proposed main restricted universe multiverse
deb [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-backports main restricted universe multiverse
deb-src [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic main restricted universe multiverse
deb-src [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-security main restricted universe multiverse
deb-src [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-updates main restricted universe multiverse
deb-src [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-proposed main restricted universe multiverse
deb-src [url]http://mirrors.aliyun.com/ubuntu/[/url] bionic-backports main restricted universe multiverse
#---------------------------------
更改完镜像源后当然是 apt update && apt upgrade
6.安装交叉编译环境,我用的是gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
tar xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf /opt/x
vim /etc/bash.bashrc
# add:
PATH="$PATH:/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin"
source /etc/bash.bashrc
arm-linux-gnueabihf-gcc -v
如果显示出正确版本,则交叉编译器安装正确。
7.安装依赖库
sudo apt install gcc build-essential bison flex gettext tcl sharutils libncurses-dev zlib1g-dev exuberant-ctags g++ texinfo patch libtool bc git python3 unzip python3-distutils swig python-dev python3-dev
sudo apt install device-tree-compiler
sudo apt install module-init-tools
sudo apt install qemu-user-static -y
sudo apt install debootstrap -y
sudo apt-get install libssl-dev
sudo apt install qtchooser
8.参照 https://whycan.com/t_7248.html 小智开发板的配置。配置U-boot
git clone https://github.com/u-boot/u-boot -b v2021.07
补丁包下载: smallwitpi_lite_v3x_uboot_patch_for_202107.diff
patch -p1 < smallwitpi_lite_v3x_uboot_patch_for_202107.diff
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make smallwitpi_lite_v3s_ddr2_debug_uart0_pb8_pb9_defconfig
如果还需要其他 u-boot 配置执行:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make menuconfig
编译:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make
9.buildroot(同样参照小智的)
git clone https://github.com/buildroot/buildroot -b 2020.02.4
buildroot patch: br2_v3_uart0_pb8_pb9-spinor-tfcard-20211026132800.tgz
解压:
tar xvf br2_v3_uart0_pb8_pb9-spinor-tfcard-20211026132800.tgz
生成 V3x / S3 固件:
make br2_smallwitpi_lite_v2_ddr2_uart0_pb8_pb9_tfcard_spinor_defconfig
make
生成的镜像文件在buildroot的output/目录下。
10.烧录测试:
windows下,先用SD Card Formatter将SD卡格式化。然后用 Win32DiskImager 将镜像写入SD(TF)卡,将烧好的卡插上开发板。上电就可以运行了。
putty监控波特率115200. TTL转USB串口工具接 V3S的 UART0.
至此基本的运行环境可以跑起来了,后面还要解决RGB LCD的显示问题,音频播放的问题,触摸的问题。待续
启动日志如下:
U-Boot SPL 2021.07 (Feb 14 2022 - 22:35:08 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2021.07 (Feb 14 2022 - 22:35:08 +0800) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Smallwit Pi Lite
DRAM: 64 MiB
MMC: mmc@1c0f000: 0
Loading Environment from nowhere... OK
In: serial@1c28000
Out: serial@1c28000
Err: serial@1c28000
Net: No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
MMC Device 1 not found
no mmc device at slot 1
jedec_spi_nor spi_flash@0:0: unrecognized JEDEC id bytes: 0b, 40, 18
Failed to initialize SPI flash at 0:0 (error -2)
Unknown command 'mtd' - try 'help'
=========================
Boot Device: mmc0
Boot Slot 0: mmc0
Boot Slot 1: empty
=========================
DFU waiting on MMC0...
switch to partitions #0, OK
mmc0 is current device
Unknown command 'dfu' - try 'help'
switch to partitions #0, OK
mmc0 is current device
Booting from MMC0...
4214168 bytes read in 235 ms (17.1 MiB/s)
13415 bytes read in 2 ms (6.4 MiB/s)
Kernel image @ 0x40000000 [ 0x000000 - 0x404d98 ]
## Flattened Device Tree blob at 40700000
Booting using the fdt blob at 0x40700000
Loading Device Tree to 416f9000, end 416ff466 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.70-smallwitpi (ddd@ddd-virtual-machine) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #1 SMP Mon Feb 14 22:36:17 CST 2022
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: YKHMI
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 16 MiB at 0x42c00000
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: Using PSCI v0.1 Function IDs from DT
[ 0.000000] percpu: Embedded 15 pages/cpu s30668 r8192 d22580 u61440
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0 root=/dev/mmcblk0p3
[ 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: 38512K/65536K available (6144K kernel code, 409K rwdata, 1756K rodata, 1024K init, 251K bss, 10640K reserved, 16384K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set
[ 0.000000] random: get_random_bytes called from start_kernel+0x2b4/0x44c with crng_init=0
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000012] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.000030] Switching to timer-based delay loop, resolution 41ns
[ 0.000424] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000867] Console: colour dummy device 80x30
[ 0.000967] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[ 0.000989] pid_max: default: 32768 minimum: 301
[ 0.001267] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001291] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001458] *** VALIDATE tmpfs ***
[ 0.002483] *** VALIDATE proc ***
[ 0.002780] *** VALIDATE cgroup1 ***
[ 0.002804] *** VALIDATE cgroup2 ***
[ 0.002831] CPU: Testing write buffer coherency: ok
[ 0.003739] /cpus/cpu@0 missing clock-frequency property
[ 0.003784] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.005086] Setting up static identity map for 0x40100000 - 0x40100060
[ 0.005463] rcu: Hierarchical SRCU implementation.
[ 0.006394] smp: Bringing up secondary CPUs ...
[ 0.006432] smp: Brought up 1 node, 1 CPU
[ 0.006444] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[ 0.006454] CPU: All CPU(s) started in HYP mode.
[ 0.006461] CPU: Virtualization extensions available.
[ 0.007561] devtmpfs: initialized
[ 0.013520] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.014066] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.014111] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.015355] pinctrl core: initialized pinctrl subsystem
[ 0.017418] NET: Registered protocol family 16
[ 0.019255] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.021550] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.021583] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.048165] SCSI subsystem initialized
[ 0.048648] usbcore: registered new interface driver usbfs
[ 0.048741] usbcore: registered new interface driver hub
[ 0.048914] usbcore: registered new device driver usb
[ 0.049275] mc: Linux media interface: v0.10
[ 0.049336] videodev: Linux video capture interface: v2.00
[ 0.049392] pps_core: LinuxPPS API ver. 1 registered
[ 0.049401] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.049432] PTP clock support registered
[ 0.052408] clocksource: Switched to clocksource arch_sys_counter
[ 0.052923] *** VALIDATE ramfs ***
[ 0.071671] thermal_sys: Registered thermal governor 'step_wise'
[ 0.072636] NET: Registered protocol family 2
[ 0.073877] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.073937] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.073977] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.074009] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.074293] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.074378] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.074804] NET: Registered protocol family 1
[ 0.077765] Initialise system trusted keyrings
[ 0.078394] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.088932] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.089525] utf8_selftest: All 154 tests passed
[ 0.089543] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.090429] *** VALIDATE jffs2 ***
[ 0.138843] Key type asymmetric registered
[ 0.138874] Asymmetric key parser 'x509' registered
[ 0.139027] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[ 0.139047] io scheduler mq-deadline registered
[ 0.139055] io scheduler kyber registered
[ 0.139063] test_strscpy: loaded.
[ 0.139094] test_strscpy: all 32 tests passed
[ 0.140774] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[ 0.147409] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.148360] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pb not found, using dummy regulator
[ 0.149695] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[ 0.331114] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.338438] printk: console [ttyS0] disabled
[ 0.358915] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 31, base_baud = 1500000) is a U6_16550A
[ 0.969421] printk: console [ttyS0] enabled
[ 0.974942] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 1.007143] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 32, base_baud = 1500000) is a U6_16550A
[ 1.039427] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 33, base_baud = 1500000) is a U6_16550A
[ 1.084344] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 1.096885] spi-nor spi0.0: unrecognized JEDEC id bytes: 0b 40 18 0b 40 18
[ 1.105183] libphy: Fixed MDIO Bus: probed
[ 1.109890] dwmac-sun8i 1c30000.ethernet: IRQ eth_wake_irq not found
[ 1.116411] dwmac-sun8i 1c30000.ethernet: IRQ eth_lpi not found
[ 1.122667] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[ 1.128501] dwmac-sun8i 1c30000.ethernet: No regulator found
[ 1.135345] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[ 1.142717] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[ 1.149938] dwmac-sun8i 1c30000.ethernet: COE Type 2
[ 1.154935] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[ 1.161721] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[ 1.167396] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[ 1.173096] dwmac-sun8i 1c30000.ethernet: device MAC address 0a:aa:34:e5:f5:f1
[ 1.180756] libphy: stmmac: probed
[ 1.185414] dwmac-sun8i 1c30000.ethernet: Found internal PHY node
[ 1.191826] libphy: mdio_mux: probed
[ 1.195604] dwmac-sun8i 1c30000.ethernet: Switch mux to internal PHY
[ 1.201970] dwmac-sun8i 1c30000.ethernet: Powering internal PHY
[ 1.210545] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.217301] ehci-platform: EHCI generic platform driver
[ 1.223062] ehci-platform 1c1a000.usb: EHCI Host Controller
[ 1.228711] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[ 1.237254] ehci-platform 1c1a000.usb: irq 23, io mem 0x01c1a000
[ 1.272370] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[ 1.280252] hub 1-0:1.0: USB hub found
[ 1.284368] hub 1-0:1.0: 1 port detected
[ 1.289344] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.295776] ohci-platform: OHCI generic platform driver
[ 1.301553] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[ 1.308395] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[ 1.316755] ohci-platform 1c1a400.usb: irq 24, io mem 0x01c1a400
[ 1.400879] hub 2-0:1.0: USB hub found
[ 1.404978] hub 2-0:1.0: 1 port detected
[ 1.410173] usbcore: registered new interface driver usb-storage
[ 1.417707] mousedev: PS/2 mouse device common for all mice
[ 1.424317] i2c /dev entries driver
[ 1.431491] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.440841] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.478953] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.487688] usbcore: registered new interface driver usbhid
[ 1.493421] usbhid: USB HID core driver
[ 1.498633] IPv4 over IPsec tunneling driver
[ 1.504208] NET: Registered protocol family 17
[ 1.508790] Key type dns_resolver registered
[ 1.513402] Registering SWP/SWPB emulation handler
[ 1.519859] Loading compiled-in X.509 certificates
[ 1.535995] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pg not found, using dummy regulator
[ 1.548703] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.560934] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.566910] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[ 1.577476] hub 3-0:1.0: USB hub found
[ 1.581460] hub 3-0:1.0: 1 port detected
[ 1.587948] hctosys: unable to open rtc device (rtc0)
[ 1.595412] Waiting for root device /dev/mmcblk0p3...
[ 1.626213] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.636373] mmc0: new high speed SDHC card at address b368
[ 1.643991] mmcblk0: mmc0:b368 LEXAR 7.46 GiB
[ 1.653354] mmcblk0: p1 p2 p3
[ 1.691226] EXT4-fs (mmcblk0p3): INFO: recovery required on readonly filesystem
[ 1.698796] EXT4-fs (mmcblk0p3): write access will be enabled during recovery
[ 1.723550] random: fast init done
[ 1.809748] EXT4-fs (mmcblk0p3): recovery complete
[ 1.819596] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
[ 1.828022] VFS: Mounted root (ext4 filesystem) readonly on device 179:3.
[ 1.836348] devtmpfs: mounted
[ 1.841715] Freeing unused kernel memory: 1024K
[ 1.846604] Run /sbin/init as init process
[ 2.080891] EXT4-fs (mmcblk0p3): re-mounted. Opts: (null)
Mounting OverlayFS: Skip
Populating /dev using udev: [ 2.415235] udevd[80]: starting version 3.2.9
[ 2.449150] random: udevd: uninitialized urandom read (16 bytes read)
[ 2.466479] random: udevd: uninitialized urandom read (16 bytes read)
[ 2.482295] random: udevd: uninitialized urandom read (16 bytes read)
[ 2.607387] udevd[81]: starting eudev-3.2.9
open /dev/fb0: No such file or directory
[ 3.686394] rtc-hym8563 0-0051: could not init device, -6
[ 3.699266] input: TSC2007 Touchscreen as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input0
done
Initializing random number generator: OK
Saving random seed: [ 5.836686] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: OK
[ 8.962454] random: crng init done
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Starting sshd: Privilege separation user sshd does not exist
OK
Starting DHCP server: FAIL
# [ 31.842391] vcc3v0: disabling
[ 31.845409] vcc5v0: disabling
页次: 1