LicheeRV Nano

I got a LicheeRV Nano before I left China for Canada a couple of weeks ago. Nowadays China is amazing. Let’s take a look at my hometown Wuhan of year 2024.

Sunset @ Yangtze River 2nd Bridge Sunset @ Yangtze River TianXingZhou Bridge
Yangtze River 2nd Bridge Sunset Yangtze River TianXingZhou Bridge Sunset
Yangtze River Grove Sunset Yangtze River Embankment Grassland Constructions
YuChiYuZui 01 YuChiYuZui 02

Now, let’s start our today’s topic: LicheeRV Nano.

1. Introduction

1.1 First Look

LicheeRV Nano LicheeRV Nano with N2425D
LicheeRV Nano 01 LicheeRV Nano 01

1.2 Official Documentation

Actually, ALL you need can be found at:

1.3 LicheeRV-Nano-WE

According to the LicheeRV Nano Version Comparison, there are 4 versions totally.

  • LicheeRV-Nano-B
  • LicheeRV-Nano-E
  • LicheeRV-Nano-W
  • LicheeRV-Nano-WE

Clearly, the one I purchased is a LicheeRV-Nano-WE.

2. lsusb

1
2
3
4
➜  ~ lsusb
......
Bus 009 Device 010: ID 3346:1009 sipeed licheervnano
......

3. WiFi Setup

After LicheeRV Nano is connected to your host computer via USB Type-C, enter the mounted rootfs and add the following new file:

1
2
3
4
5
➜  rootfs sudo vim ./etc/network/wpa_supplicant.conf
network={
ssid="XXXXX"
psk="YYYYY"
}

Then, reboot. Now, you should be able to find out your LicheeRV Nano by sudo nmap -sN 192.168.1.254/24.

4. LicheeRV Nano Overview

4.1 ssh Into LicheeRV Nano

Both the default username and password of LicheeRV Nano are root.

1
2
3
4
5
6
7
8
➜  ~ ssh root@192.168.1.78
root@192.168.1.78's password:

# uname -a
Linux licheervnano-8c93 5.10.4-tag- #1 PREEMPT Mon Apr 22 11:13:44 HKT 2024 riscv64 GNU/Linux

# hostname
licheervnano-8c93

4.2 CPU and Memory

Clearly, LicheeRV Nano is armed with only 1 single Risc-V 64bit CPU, and about 160M flash memory.

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
# cat /proc/cpuinfo
processor : 0
hart : 0
isa : rv64imafdvcsu
mmu : sv39

# cat /proc/meminfo
MemTotal: 162672 kB
MemFree: 98276 kB
MemAvailable: 128976 kB
Buffers: 3416 kB
Cached: 28776 kB
SwapCached: 0 kB
Active: 11792 kB
Inactive: 26892 kB
Active(anon): 144 kB
Inactive(anon): 6592 kB
Active(file): 11648 kB
Inactive(file): 20300 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 6508 kB
Mapped: 10092 kB
Shmem: 248 kB
KReclaimable: 5164 kB
Slab: 13988 kB
SReclaimable: 5164 kB
SUnreclaim: 8824 kB
KernelStack: 1248 kB
PageTables: 524 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 81336 kB
Committed_AS: 9868 kB
VmallocTotal: 67108863 kB
VmallocUsed: 5468 kB
VmallocChunk: 0 kB
Percpu: 64 kB
CmaTotal: 0 kB
CmaFree: 0 kB

4.3 Python

By default, Python 3.11.6 has been installed on LicheeRV Nano.

1
2
# python --version
Python 3.11.6

5. LicheeRV-Nano-Build

The default LicheeRV-Nano-Build README.md seems to be problematic. I did it in my way:

5.1 Clone LicheeRV-Nano-Build

1
2
3
➜  git clone https://github.com/sipeed/LicheeRV-Nano-Build --depth=1
➜ cd LicheeRV-Nano-Build
➜ LicheeRV-Nano-Build git:(main)

5.2 Setup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
➜  LicheeRV-Nano-Build git:(main) ✗ source build/cvisetup.sh
/proc/self/fd/19:7: cv1800b_board_sel: assignment to invalid subscript range
-------------------------------------------------------------------------------------------------------
Usage:
(1) menuconfig - Use menu to configure your board.
ex: $ menuconfig

(2) defconfig $CHIP_ARCH - List EVB boards($BOARD) by CHIP_ARCH.
** sg200x ** -> ['sg2000', 'sg2002']
** cv181x ** -> ['cv1812cp', 'cv1812h', 'cv1813h']
** cv180x ** -> ['cv1800b']
ex: $ defconfig cv181x

(3) defconfig $BOARD - Choose EVB board settings.
ex: $ defconfig cv1813h_wevb_0007a_spinor
ex: $ defconfig cv1812cp_wevb_0006a_spinor
-------------------------------------------------------------------------------------------------------

5.3 GUI-based menuconfig

I personally prefer the GUI-based configuration.

5.3.1 Copy menuconfig.py

1
2
3
➜  LicheeRV-Nano-Build git:(main) ✗ cd build/scripts 
➜ scripts git:(main) ✗ cp menuconfig.py .py
➜ scripts git:(main) ✗

5.3.2 Modify ./build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig

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
diff --git a/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig b/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
index 4138f665b..58a5ea02d 100644
--- a/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
+++ b/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
@@ -2,12 +2,12 @@ CONFIG_CHIP_sg2002=y
CONFIG_BOARD_licheervnano_sd=y
CONFIG_DDR_CFG_ddr3_1866_x16=y
CONFIG_ARCH="riscv"
-CONFIG_CROSS_COMPILE="riscv64-unknown-linux-musl-"
+CONFIG_CROSS_COMPILE="riscv64-linux-gnu-"
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_KERNEL_ENTRY_HACK=y
CONFIG_KERNEL_ENTRY_HACK_ADDR="0x80200000"
CONFIG_TOOLCHAIN_MUSL_RISCV64=y
-CONFIG_FLASH_SIZE_SHRINK=y
+# CONFIG_FLASH_SIZE_SHRINK=y
CONFIG_BOOT_IMAGE_SINGLE_DTB=y
# CONFIG_FLASH_SIZE_SHRINK is not set
CONFIG_CP_EXT_WIRELESS=y
@@ -16,7 +16,7 @@ CONFIG_MIPI_PANEL_ZCT2133V1=y
CONFIG_SENSOR_GCORE_GC4653=y
CONFIG_SENSOR_OV_OS04A10=y
CONFIG_UBOOT_2021_10=y
-CONFIG_KERNEL_SRC_5.10=y
+CONFIG_KERNEL_SRC="linux_5.10"
CONFIG_KERNEL_UNCOMPRESSED=y
# CONFIG_SKIP_RAMDISK is not set
CONFIG_SENSOR_TUNING_PARAM_cv181x_src_gcore_gc4653=y

By the way, even until now, I’ve got NO idea what the MIPI_PANEL should be?

5.3.3 Run menuconfig

1
➜  LicheeRV-Nano-Build git:(main) ✗ menuconfig

LicheeRV Nano Build menuconfig

5.4 Build

5.4.1 Exports

1
2
3
➜  LicheeRV-Nano-Build git:(main) ✗ export IMGTOOL_PATH=tools/common/image_tool                      
➜ LicheeRV-Nano-Build git:(main) ✗ export COMMON_TOOLS_PATH=tools/common
➜ LicheeRV-Nano-Build git:(main) ✗ export FLASH_PARTITION_XML=boards/default/partition/partition_none.xml