The long-awaited milk-v duo RTOS system is here!!!
On June 6th, 2023, I dug a hole on rt-thread forum and looked for someone who could port rt-smart to milk-v duo. Since the post was made, I received positive feedback from group members and more people joined the group and bought the board. Currently, there are more than 30 risc-v enthusiasts in the group (no indoctrination).
In order to get everyone started (I dug my own hole), I have decided to create the basic BS P for the milk-v duo development board (CV1800B chip). Of course, CV1800B has been officially merged into the RT-Thread main repository, so everyone can taste and experience it. Currently, only rt-smart has been successfully tested and can support msh function. Other functions still need interested people to join in and improve together. (If you think the basic BSP is too bad to play with, you can wait a little longer.)
Repository address: https://github.com/RT-Thread/rt-thread/tree/master/bsp/cv1800b
Below is a brief introduction to the basic situation of the CV1800B BSP (copied from the readme in the BSP).
Overview
CV180ZB/CV1800B/CV1801B is a high-performance, low-power chip for consumer consumer monitoring IP cameras, smart homes, and other product areas, integrating H.264/H.265 video compression codecs and ISP; supporting digital wide dynamic, 3D noise reduction, dehumidification, lens distortion correction and other image enhancement and correction algorithms to provide customers with professional-level video image quality.
- Processor core
- Main processor RISCV C906 @ 1.0Ghz
- 32KB I-cache, 64KB D-Cache
- Integrated vector (Vector) and floating point (FPU).
- Coprocessor RISCV C906 @ 700Mhz
- Integrated floating point (FPU)
- Memory interface
- Built-in DRAM: DDR2 16bitx1, with a maximum rate of 1333Mbps and a capacity of 512Mbit (64MB)
- Support SPI NOR flash interface (1.8V / 3.0V)
- Supports 1, 2, 4 line modes
- Maximum support of 256MByte
- Support SPI Nand flash interface (1.8V / 3.0V)
- Supports 1KB/2KB/4KB page (corresponding to a maximum capacity of 16GB/32GB/64GB)
- Uses the ECC module built into the device itself
- Peripherals
- Up to 26 GPIO pins on the MilkV-Duo 40-pin header provide access to internal peripherals such as SDIO, I2C, PWM, SPI, J-TAG, and UART
- Up to 3x I2C
- Up to 5x UART
- Up to 1x SDIO1
- Up to 1x SPI
- Up to 2x ADC
- Up to 7x PWM
- Up to 1x RUN
- Up to 1x JTAG
- Integrated MAC PHY supports 10/100Mbps full duplex or half duplex mode
- An USB Host / device interface
Toolchain Download
Download the toolchain riscv64-unknown-linux-musl-gcc
: https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2
Note:
The current BSP only supports Linux compilation.
After successfully extracting the files, add the local path of theriscv64-unknown-linux-musl-gcc
toolchain to theEXEC_PATH
in thertconfig.py
file or specify the path through theRTT_EXEC_PATH
environment variable.
$ export RTT_EXEC_PATH=/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin
Compilation
- Dependency Installation
$ sudo apt install -y device-tree-compiler
- On a Linux platform, you can execute the following:
$ scons --menuconfig
It will automatically download environment-related scripts to the ~/.env
directory. Then execute:
$ source ~/.env/env.sh
$ pkgs --update
After updating the software packages, execute scons -j10
or scons -j10 --verbose
to compile this board support package. Alternatively, you can compile directly while specifying the toolchain location using the scons --exec-path="GCC toolchain path"
command. If the compilation is successful, it will produce the rtthread.elf
file.
Once the compilation is complete, the script will automatically call the ./mksdimg.sh
script for packaging and generate boot.sd
, which is the kernel file for SD card booting.
Running
-
Divide the SD card into 2 partitions. The first partition is used to store bin files, and the second partition serves as a data storage partition with the
FAT32
format. -
Copy the
fip.bin
andboot.sd
files from the root directory to the first partition of the SD card. For subsequent firmware updates, you only need to copy theboot.sd
file. These files are defined as follows:
fip.bin
: A binary file containing fsbl, opensbi, and uboot after packaging.boot.sd
: A binary file containing the kernel after packaging.
After updating boot.sd
, power up the device again to view the serial output information.
U-Boot 2021.10 (Jun 26 2023 - 14:09:06 +0800)cvitek_cv180x
DRAM: 63.3 MiB
gd->relocaddr=0x82435000. offset=0x2235000
MMC: cv-sd@4310000: 0
Loading Environment from <NULL>... OK
In: serial
Out: serial
Err: serial
Net:
Warning: ethernet@4070000 (eth0) using random MAC address - 62:80:19:6c:d4:64
eth0: ethernet@4070000
Hit any key to stop autoboot: 0
Boot from SD ...
switch to partitions #0, OK
mmc0 is current device
132692 bytes read in 12 ms (10.5 MiB/s)
## Loading kernel from FIT Image at 81400000 ...
Using 'config-cv1800b_milkv_duo_sd' configuration
Trying 'kernel-1' kernel subimage
Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 81400000 ...
Using 'config-cv1800b_milkv_duo_sd' configuration
Trying 'fdt-cv1800b_milkv_duo_sd' fdt subimage
Verifying Hash Integrity ... sha256+ OK
Booting using the fdt blob at 0x8141b590
Uncompressing Kernel Image
Decompressing 296768 bytes used 42ms
Loading Device Tree to 0000000081be5000, end 0000000081becb60 ... OK
Starting kernel ...
heap: [0x802766b0 - 0x812766b0]
\ | /
- RT - Thread Smart Operating System
/ | \ 5.0.1 build Jun 28 2023 23:44:36
2006 - 2022 Copyright by RT-Thread team
Hello RT-Smart!
msh />
Driver Support List
Driver | Support Status | Note |
---|---|---|
UART | Supported | Default baud rate is 115200 |
Supported Development Boards
- milk-v duo: https://milkv.io/duo 13
1094×726 794 KB
advertisement
If you are interested in RISC-V, milk-v duo rtsmart, rt-thread, and dual-core adaptation, you are welcome to scan the QR code to join our group chat. There are experts in the group who can provide guidance for porting adaptation.
Or add my WeChat account "flyingcys " to add you into the group