Milk-V Duo 256M - 01

Finally, I got duo-buildroot-sdk built today. So, yes, happy Chinese new year of Dragon, 2024. Let's have some fun of Milk-V Duo 256M.

1. Introduction

From Milk-V Duo 256M's official website, the following picture clearly shows it has

MilkV Duo 256M Core chips

The detailed specifications are also highlighted in the table on the official website of Milk-V Duo 256M.

2. Build duo-buildroot-sdk

2.1 Failed to build duo-buildroot-sdk using Ubuntu 22.04

Even if I strictly followed the manual on duo-buildroot-sdk's official documentation Compiled using Ubuntu 22.04, I still failed to build an image out for flashing, with the following error messages inside the log file build/br.log:

1
2
3
4
5
6
7
8
......
2024-02-08T13:34:11 tic: symbol lookup error: tic: undefined symbol: _nc_disable_period
2024-02-08T13:34:11 ? tic could not build ....../duo-buildroot-sdk-Duo-V1.0.8/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/per-package/ncurses/host/riscv64-buildroot-linux-musl/sysroot/usr/share/terminfo
2024-02-08T13:34:11 make[4]: *** [Makefile:92: install.data] Error 1
2024-02-08T13:34:12 make[3]: *** [Makefile:122: install] Error 2
2024-02-08T13:34:12 make[2]: *** [package/pkg-generic.mk:289: ....../duo-buildroot-sdk-Duo-V1.0.8/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/build/ncurses-6.1/.stamp_staging_installed] Error 2
2024-02-08T13:34:12 make[2]: *** Waiting for unfinished jobs....
......

A possible solution is found at: https://lore.kernel.org/buildroot/bug-15685-163-ecW1EgIyRW@https.bugs.busybox.net%2F/T/.

2.2 Successfully build duo-buildroot-sdk using Docker

By strictly following the manual on duo-buildroot-sdk's official documentation Compiled using Docker, I now am able to build an image out as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
......
mkfs.fat: Warning: lowercase labels might not work properly on some systems
INFO: vfat(boot.vfat): adding file 'fip.bin' as 'fip.bin' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '~/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '~/install/soc_cv1812cp_milkv_duo256m_sd/fip.bin' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'rawimages/boot.sd' as 'rawimages/boot.sd' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '~/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '~/install/soc_cv1812cp_milkv_duo256m_sd/rawimages/boot.sd' '::'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "genext2fs -d '~/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root' --size-in-blocks=786432 -i 16384 '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4' " (stderr):
copying from directory ~/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root
INFO: ext4(rootfs.ext4): cmd: "tune2fs -O 'extents,uninit_bg,dir_index,has_journal' '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "tune2fs -L 'rootfs' '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "e2fsck -pvfD '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: hdimage(milkv-duo256m.img): adding partition 'boot' (in MBR) from 'boot.vfat' ...
INFO: hdimage(milkv-duo256m.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(milkv-duo256m.img): writing MBR
gnimage for milkv-duo256m success!
~/build
~
Create SD image successful: out/milkv-duo256m-20240208-1949.img

And, the last couple of lines in the log file build/br.log are:

1
2
3
4
5
6
7
8
9
10
11
......
2024-02-08T19:48:15
2024-02-08T19:48:15 Allocating group tables: 0/25 done
2024-02-08T19:48:15 Writing inode tables: 0/25 done
2024-02-08T19:48:15 Creating journal (4096 blocks): done
2024-02-08T19:48:15 Copying files into the device: PATH="~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/host/bin:~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/host/sbin:~/host-tools/gcc/riscv64-linux-musl-x86_64/bin:~/host-tools/gcc/riscv64-linux-x86_64/bin:~/host-tools/gcc/riscv64-elf-x86_64/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-elf/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/host-tools/gcc/arm-cvitek-linux-uclibcgnueabihf/bin" xz -9 -C crc32 -c -T 9 ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.tar > ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.tar.xz
2024-02-08T19:48:16 done
2024-02-08T19:48:16 Writing superblocks and filesystem accounting information: 0/25 done
2024-02-08T19:48:16
2024-02-08T19:48:16 ln -sf rootfs.ext2 ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.ext4
2024-02-08T19:49:28 make[1]: Leaving directory '~/buildroot-2021.05'

3. Boot after Flashing

After flashing the generated out/milkv-duo256m-20240208-1949.img into the SD card, we can now boot up Milk-V Duo 256M by connecting it with my laptop via a USB cable.

3.1 lsusb

1
2
3
......
Bus 001 Device 009: ID 3346:1009 Cvitek RNDIS
......

3.2 SSH into Milk-V Duo 256M via USB Connection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
➜  ~ ssh root@192.168.42.1
The authenticity of host '192.168.42.1 (192.168.42.1)' can't be established.
ED25519 key fingerprint is SHA256:NyuhOwhRh9sfzW+C2D5OIaTIbGCuVI1v1jrJv4DaM+U.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.42.1' (ED25519) to the list of known hosts.
root@192.168.42.1's password:
[root@milkv-duo]~# ls
[root@milkv-duo]~# pwd
/root
[root@milkv-duo]~# uname -a
Linux milkv-duo 5.10.4-tag- #1 PREEMPT Thu Feb 8 19:28:21 CST 2024 riscv64 GNU/Linux
[root@milkv-duo]~# lsb_release -a
-sh: lsb_release: not found
[root@milkv-duo]~# neofetch
-sh: neofetch: not found
[root@milkv-duo]~# ll /
total 33
drwxr-xr-x 18 root root 1024 Feb 8 2024 ./
drwxr-xr-x 18 root root 1024 Feb 8 2024 ../
drwxr-xr-x 2 root root 3072 Feb 8 2024 bin/
drwxr-xr-x 7 root root 1540 Jan 1 00:00 dev/
drwxr-xr-x 8 root root 1024 Jan 1 00:00 etc/
drwxr-xr-x 3 root root 1024 Jan 30 2024 lib/
lrwxrwxrwx 1 root root 3 Feb 8 2024 lib64 -> lib/
lrwxrwxrwx 1 root root 11 Feb 8 2024 linuxrc -> bin/busybox*
drwx------ 2 root root 16384 Feb 8 2024 lost+found/
drwxr-xr-x 2 root root 1024 Jan 30 2024 media/
drwxr-xr-x 6 root root 1024 Jan 30 2024 mnt/
drwxr-xr-x 2 root root 1024 Jan 30 2024 opt/
dr-xr-xr-x 122 root root 0 Jan 1 00:00 proc/
drwx------ 2 root root 1024 Jan 1 00:03 root/
drwxr-xr-x 4 root root 200 Jan 1 00:00 run/
drwxr-xr-x 2 root root 3072 Feb 8 2024 sbin/
dr-xr-xr-x 11 root root 0 Jan 1 00:00 sys/
drwxrwxrwt 3 root root 160 Jan 1 00:00 tmp/
drwxr-xr-x 8 root root 1024 Feb 8 2024 usr/
drwxr-xr-x 5 root root 1024 Feb 8 2024 var/
[root@milkv-duo]~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 752.0M 152.6M 557.0M 22% /
devtmpfs 83.1M 0 83.1M 0% /dev
tmpfs 83.1M 0 83.1M 0% /dev/shm
tmpfs 83.1M 48.0K 83.1M 0% /tmp
tmpfs 83.1M 32.0K 83.1M 0% /run
[root@milkv-duo]~# cat /proc/cpuinfo
processor : 0
hart : 0
isa : rv64imafdvcsu
mmu : sv39

[root@milkv-duo]~# cat /proc/meminfo
MemTotal: 170288 kB
MemFree: 147812 kB
MemAvailable: 148580 kB
Buffers: 872 kB
Cached: 3024 kB
SwapCached: 0 kB
Active: 2520 kB
Inactive: 2808 kB
Active(anon): 72 kB
Inactive(anon): 1440 kB
Active(file): 2448 kB
Inactive(file): 1368 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 44 kB
Writeback: 0 kB
AnonPages: 1444 kB
Mapped: 2532 kB
Shmem: 80 kB
KReclaimable: 2664 kB
Slab: 7220 kB
SReclaimable: 2664 kB
SUnreclaim: 4556 kB
KernelStack: 1024 kB
PageTables: 404 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 85144 kB
Committed_AS: 5004 kB
VmallocTotal: 67108863 kB
VmallocUsed: 4408 kB
VmallocChunk: 0 kB
Percpu: 32 kB
CmaTotal: 0 kB
CmaFree: 0 kB
[root@milkv-duo]~#

3.3 SSH into Milk-V Duo 256M via Wired Connection

After my clumsy soldering, Milk-V Duo 256M is now able to be connected via my home Intranet. Now, let's ssh into Milk-V Duo 256M via its IP address.

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@milkv-duo]~# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 0a:95:ef:1e:ec:c2 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.51/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
valid_lft 259082sec preferred_lft 226682sec
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 5e:59:d4:f7:99:f7 brd ff:ff:ff:ff:ff:ff
inet 192.168.42.1/24 brd 192.168.42.255 scope global usb0
valid_lft forever preferred_lft forever

4. Camera Test - Face Detection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
[root@milkv-duo]~# cd /bin
[root@milkv-duo]/bin# ls
arch chattr cpio dumpkmap getopt link lsattr mount nuke pwd setarch su uname
ash chgrp date echo grep linux32 mk_cmds mountpoint pidof resume setpriv sync usleep
base32 chmod dd egrep gunzip linux64 mkdir mt ping rm setserial tar vi
base64 chown df false gzip ln mknod mv pipe_progress rmdir sh touch watch
busybox compile_et dmesg fdflush hostname login mktemp netstat printenv run-parts sleep true zcat
cat cp dnsdomainname fgrep kill ls more nice ps sed stty umount
[root@milkv-duo]/bin# camera-test.sh
[SAMPLE_COMM_SNS_ParseIni]-1950: Parse /mnt/data/sensor_cfg.ini
[parse_source_devnum]-1605: devNum = 1
[parse_sensor_name]-1686: sensor = GCORE_GC2083_MIPI_2M_30FPS_10BIT
[parse_sensor_busid]-1714: bus_id = 2
[parse_sensor_i2caddr]-1725: sns_i2c_addr = 37
[parse_sensor_mipidev]-1736: mipi_dev = 0
[parse_sensor_laneid]-1747: Lane_id = 1, 0, 2, -1, -1
[parse_sensor_pnswap]-1758: pn_swap = 0, 0, 0, 0, 0
MMF Version:7e0cc6a08-musl_riscv64
Create VBPool[0], size: (3110400 * 3) = 9331200 bytes
Create VBPool[1], size: (3110400 * 3) = 9331200 bytes
Create VBPool[2], size: (2764800 * 1) = 2764800 bytes
Total memory of VB pool: 21427200 bytes
Initialize SYS and VB
Initialize VI
ISP Vipipe(0) Allocate pa(0x8c771000) va(0x0x3fbed36000) size(291120)
stSnsrMode.u16Width 1920 stSnsrMode.u16Height 1080 25.000000 wdrMode 0 pstSnsObj 0x3fbf86b400
[SAMPLE_COMM_VI_StartMIPI]-483: sensor 0 stDevAttr.devno 0
awbInit ver 6.8@2021500
0 R:1400 B:3100 CT:2850
1 R:1500 B:2500 CT:3900
2 R:2300 B:1600 CT:6500
Golden 1024 1024 1024
WB Quadratic:0
isWdr:0
ViPipe:0,===GC2083 1080P 30fps 10bit LINE Init OK!===
********************************************************************************
cvi_bin_isp message
gerritId: 36403 commitId: c69c5863e
md5: cab880835a2ad5184de5ed7762404b84
sensorNum 1
sensorName0 2083

PQBIN message
gerritId: 80171 commitId: 5c9d8fc5d
md5: ba5a510e093ad42db6788e6c2d13169e
sensorNum 3
sensorName0 2053

author: wanqiang.he desc: 思博慧CV1812H_GC2083_RGB_mode_V1.0.0
createTime: 2023-08-04 16:48:08version: V1.1
tool Version: v3.0.5.24 mode:
********************************************************************************
sensorName(0) mismatch, mwSns:2083 != pqBinSns:2053
[SAMPLE_COMM_ISP_Thread]-95: ISP Dev 0 running!
Initialize VPSS
---------VPSS[0]---------
Input size: (1920x1080)
Input format: (19)
VPSS physical device number: 1
Src Frame Rate: -1
Dst Frame Rate: -1
--------CHN[0]-------
Output size: (1920x1080)
Depth: 1
Do normalization: 0
Src Frame Rate: -1
Dst Frame Rate: -1
----------------------
--------CHN[1]-------
Output size: (1920x1080)
Depth: 1
Do normalization: 0
Src Frame Rate: -1
Dst Frame Rate: -1
----------------------
------------------------
Bind VI with VPSS Grp(0), Chn(0)
Attach VBPool(0) to VPSS Grp(0) Chn(0)
Attach VBPool(1) to VPSS Grp(0) Chn(1)
Initialize VENC
venc codec: h264
venc frame size: 1920x1080
Initialize RTSP
rtsp://192.168.1.51/h264
prio:0
version: 1.4.0
scrfd768432 Build at 2023-12-25 01:21:44 For platform cv181x
Max SharedMem size:1658880
anchor:-8,-8,8,8
anchor:-16,-16,16,16
bbox:bbox_8_Conv_dequant
landmark:kps_8_Conv_dequant
score:score_8_Sigmoid_dequant
anchor:-32,-32,32,32
anchor:-64,-64,64,64
bbox:bbox_16_Conv_dequant
landmark:kps_16_Conv_dequant
score:score_16_Sigmoid_dequant
anchor:-128,-128,128,128
anchor:-256,-256,256,256
bbox:bbox_32_Conv_dequant
landmark:kps_32_Conv_dequant
score:score_32_Sigmoid_dequant
Enter TDL thread
Enter encoder thread
0 R:1165 B:3087 CT:2688
1 R:1464 B:2327 CT:3937
2 R:1974 B:1613 CT:7225
Golden 1464 1024 2327
wdrLEOnly:1
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
......

One captured image over rtsp://ipaddress/h264 is shown as follows:

MilkV Duo Streaming

Now, it's the time to go to bed. Happy Chinese new year's Eve. The new year's day of 2024 is February 10, 2024.