(一)引言
本篇文章主要分析TDA4VM板卡的启动过程,对于TDA4VM板卡加深了解。TDA4VM板卡通过u-boot启动,引导内核后进入TI的edgeAI界面,在下文对此进行详细分析。
(二)ROM-Boot
RomBoot是厂商固化在芯片内部的一小段程序,类似于PC机上的BIOS引导程序。
在原理图中或有boot模式选择拨码开关,在此按照sdk中指引的设置是均拨到下方,也就是均为GND,根据Bootmode Table,板卡会从SD卡启动;
(三)SPL-Boot
SPL是uboot第一阶段执行的代码。 主要负责初始化芯片,搬移uboot第二阶段的代码到外部
内存中运行。
首先u-boot SPL打印当前板卡信息:
U-Boot SPL 2021.01-g62a9e51344 (Mar 03 2023 - 23:01:15 +0000)
Model: Texas Instruments J721E SK R5
Board: J721EX-EAIK rev A1
SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.3--v08.06.03 (Chill Capybar')
Trying to boot from MMC2
Starting ATF on ARM64 core...
可以看出u-boot SPL是从mmc2拷贝过来的,在SPL-Boot设置完成硬件后会启动真正的u-boot;
(四)U-Boot
U-Boot 2021.01-g62a9e51344 (Mar 03 2023 - 22:59:37 +0000)
SoC: J721E SR1.1 GP
Model: Texas Instruments J721E SK A72
Board: J721EX-EAIK rev A1
DRAM: 4 GiB
Flash: 0 Bytes
MMC: sdhci@4fb0000: 1
Loading Environment from FAT... OK
In: serial@2800000
Out: serial@2800000
Err: serial@2800000
am65_cpsw_nuss ethernet@46000000: K3 CPSW: nuss_ver: 0x6BA00101 cpsw_ver: 0x6BA80100 ale_ver: 0x00293904 Ports:1 mdio_freq:1000000
cdns,sierra serdes@5000000: sierra probed
Net: eth0: ethernet@46000000port@1
Hit any key to stop autoboot: 0
开始3秒的倒计时,此时按下空格键可以进入u-boot,如果不按下任何按键,在计时结束后u-boot开始拷贝kernel;
switch to partitions #0, OK
mmc1 is current device
SD/MMC found on device 1
Failed to load 'boot.scr'
1107 bytes read in 9 ms (120.1 KiB/s)
Loaded env from uEnv.txt
Importing environment from mmc1 ...
Running uenvcmd ...
可以看出来,kernel会从mmc1拷贝,mmc1也就是已经插入的SD卡。
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 000000008fee2000, end 000000008fffffff ... OK
Starting kernel ...
这时要启动kernel了。
(五)Kernel
kernel 5.10启动:
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd080]
[ 0.000000] Linux version 5.10.162-g76b3e88d56 (oe-user@oe-host) (aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025, GNU ld (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 2.33.1.20191209) #1 SMP PREEMPT Fri Mar 3 23:00:40 UTC 2023
[ 0.000000] Machine model: Texas Instruments J721E SK
[ 0.000000] earlycon: ns16550a0 at MMIO32 0x0000000002800000 (options '')
[ 0.000000] printk: bootconsole [ns16550a0] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created DMA memory pool at 0x00000000a0000000, size 1 MiB
kernel会设置大部分外设,这部分就略过。
[ 5.416071] mmc0: SDHCI controller on 4fb0000.mmc [4fb0000.mmc] using ADMA 64-bit
[ 5.423854] Waiting for root device PARTUUID=871090a6-02...
[ 5.482051] mmc0: new ultra high speed DDR50 SDHC card at address aaaa
[ 5.488929] mmcblk0: mmc0:aaaa SL32G 29.7 GiB
[ 5.497505] mmcblk0: p1 p2
[ 5.533391] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 5.541509] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 5.551008] devtmpfs: mounted
[ 5.554852] Freeing unused kernel memory: 1856K
[ 5.559478] Run /sbin/init as init process
[ 5.752241] systemd[1]: System time before build time, advancing clock.
[ 5.801673] NET: Registered protocol family 10
[ 5.806586] Segment Routing with IPv6
[ 5.837487] systemd[1]: systemd 244.5+ running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR -SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid)
[ 5.859209] systemd[1]: Detected architecture arm64.
最终kernel会挂载ext4格式的文件系统 Arago:
(六)Arago
Welcome to Arago 2021.09!
[ 5.899867] systemd[1]: Set hostname to <tda4vm-sk>.
[ 6.068135] systemd[1]: /lib/systemd/system/irqbalanced.service:6: Unknown key name 'ConditionCPUs' in section 'Unit', ignoring.
[ 6.093006] systemd[1]: /lib/systemd/system/docker.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/docker.sock → /run/docker.sock; please update the unit file accordingly.
[ 6.158244] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.166576] systemd[1]: Created slice system-getty.slice.
[ OK ] Created slice system-getty.slice.
[ 6.189336] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.196723] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ OK ] Created slice system-serial\x2dgetty.slice.
[ 6.217328] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.224581] systemd[1]: Created slice User and Session Slice.
[ OK ] Created slice User and Session Slice.
[ 6.245463] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[ OK ] Started Dispatch Password …ts to Console Directory Watch.
[ 6.269381] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
这部分操作会启动一系列的服务,挂载不同的分区等等,这部分也是通用的。
[ 7.706216] k3-dsp-rproc 4d80800000.dsp: assigned reserved memory node vision-apps-c66-dma-memory@a9000000
[ 7.716880] img_enc 4200000.video-encoder: vxe_enc_probe: using heap 1 for internal alloc
[ 7.725870] k3-dsp-rproc 4d80800000.dsp: configured DSP for IPC-only mode
[ 7.731786] img_enc 4200000.video-encoder: encoder registered as /dev/video0
[ 7.733366] remoteproc remoteproc0: 4d80800000.dsp is available
[ 7.747665] remoteproc remoteproc0: attaching to 4d80800000.dsp
[ 7.783426] k3-dsp-rproc 4d80800000.dsp: DSP initialized in IPC-only mode
[ 7.836795] [drm] Initialized tidss 1.0.0 20180215 for 4a00000.dss on minor 0
[ 7.844531] platform 41000000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
[ 7.865291] platform 41000000.r5f: configured R5F for IPC-only mode
[ 7.872240] remoteproc0#vdev0buffer: assigned reserved memory node vision-apps-c66-dma-memory@a9000000
[ 7.878004] platform 41000000.r5f: assigned reserved memory node vision-apps-r5f-dma-memory@a0000000
这里回启动DSP和R5F核(应当是2+4+2中的后2个r5f);
If you do not wish to distribute GPLv3 components please remove
the above packages prior to distribution. This can be done using
the opkg remove command. i.e.:
opkg remove <package>
Where <package> is the name printed in the list above
NOTE: If the package is a dependency of another package you
will be notified of the dependent packages. You should
use the --force-removal-of-dependent-packages option to
also remove the dependent packages as well
这里指出可以使用opkg管理包,和Openwrt有点相似;
[ OK ] Started Print notice about GPLv3 packages.
[ 13.550072] am65-cpsw-nuss 46000000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 13.558951] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ OK ] Started weston.service.
Starting DEMO...
Starting EdgeAI OOB demos...
Starting telnetd.service...
[ OK ] Started DEMO.
[ OK ] Started telnetd.service.
[ 15.143032] PVR_K: 969: RGX Firmware image 'rgx.fw.22.104.208.318' loaded
[ 15.171568] PVR_K: 969: Shader binary image 'rgx.sh.22.104.208.318' loaded
这里就启动TI的 demo了,会出现TI的一张壁纸,然后进入到QT界面。
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project tda4vm-sk ttyS2
Arago 2021.09 tda4vm-sk ttyS2
tda4vm-sk login: [ 20.333309] Initializing XFRM netlink socket
[ 22.157999] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[ 22.177221] Bridge firewalling registered
[ 23.011245] process 'docker/tmp/qemu-check092791992/check' started with executable stack
tda4vm-sk login: root
USB Camera 0 detected
device = /dev/video2
format = jpeg
至此,板卡已经启动成功,如果已连接HDMI或者DVI显示屏,再连接一个免驱的USB相机和一个鼠标,那么可以使用鼠标操作进行模型的测试。