support cv181x-riscv for RT-SMART (#8724)

This commit is contained in:
flyingcys authored and Meco Man committed 2024-04-16 22:43:28 -04:00
1 parent 8b4c2f5cdf
commit 5c593e6789
25 files changed
+163 -181

No files matched your search

File diff suppressed because it is too large. Load diff
+4 -2
View File
@@ -29,7 +29,7 @@ $ sudo apt install -y scons libncurses5-dev wget flex bison
$ scons --menuconfig
```
选择当前需要编译的目标开发板类型
选择当前需要编译的目标开发板类型:
```shell
Board Type (milkv-duo) --->
( ) milkv-duo
@@ -66,4 +66,6 @@ HW_HEAP_BEGIN:83f74dc0 RT_HW_HEAP_END:84000000 size: 569920
2006 - 2022 Copyright by RT-Thread team
Hello, RISC-V!
msh />
```
```
> 注:c906 小核默认日志串口为 uart1
+70
View File
@@ -0,0 +1,70 @@
# c906_little bsp
This BSP is a coprocessor in the cv18xx series processor, using RISCV C906 @ 700Mhz.
Features:
- No MMU
- Integrated Floating-point Unit (FPU)
## Toolchain Download
Download the toolchain for `riscv64-unknown-elf-gcc`: [https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395512373/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1-20240115.tar.gz](https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395512373/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1-20240115.tar.gz)
> Note:
Current BSP only supports Linux compilation.
After correct decompression, add the local path of the `riscv64-unknown-elf-gcc` toolchain to `EXEC_PATH` in `rtconfig.py`, or specify the path through the `RTT_EXEC_PATH` environment variable.
```shell
$ export RTT_EXEC_PATH=/opt/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.1/bin
```
## Compilation
1. Dependency Installation
```shell
$ sudo apt install -y scons libncurses5-dev wget flex bison
```
2. On Linux platform, execute:
```shell
$ scons --menuconfig
```
Choose the target development board type that needs to be compiled:
```shell
Board Type (milkv-duo) --->
( ) milkv-duo
(X) milkv-duo256m
```
It will automatically download env related scripts to the ~/.env directory, then execute
```shell
$ source ~/.env/env.sh
$ pkgs --update
```
After updating the software packages, execute `scons -j10` or `scons -j10 --verbose` to compile this BSP. Or use the `scons --exec-path="GCC toolchain path"` command to compile directly while specifying the toolchain location. If the compilation is correct, the rtthread.elf file will be generated.
After the compilation is completed, the script automatically calls the `combine-fip.sh` script for packaging, and generates `fip.sd`, which is the c906_little file for SD card startup.
The first time the `combine-fip.sh` script is called, it will automatically download the required `opsbsbi`, `fsbl`, `uboot`, and other related files to the `bsp/cvitek/cvitek_bootloader` directory, please be patient.
After downloading, it will automatically decompress and compile. Subsequently, when compiling the same type of development board again, only the relevant files will be called to package and synthesize `fip.bin`. If you need to manually compile the related `cvitek_bootloader` files, you can execute `bash build.sh lunch` in the `bsp/cvitek/cvitek_bootloader` directory to choose the corresponding development board for compilation.
## Running
1. Divide the SD card into 2 partitions, the 1st partition is used to store bin files, and the 2nd partition is used as a data storage partition, with the partition format being `FAT32`.
2. Copy the `fip.bin` and `boot.sd` from the root directory into the 1st partition of the SD card. Subsequent firmware updates only require copying the `fip.sd` file.
Where:
- fip.bin: fsbl, opensbi, uboot, c906_little packaged bin file
- boot.sd: bin file packaged by the main kernel
After updating `fip.sd`, restarting will show the output information on the serial port:
```shell
HW_HEAP_BEGIN:83f74dc0 RT_HW_HEAP_END:84000000 size: 569920
\ | /
- RT - Thread Operating System
/ | \ 5.1.0 build Jan 27 2024 22:45:49
2006 - 2022 Copyright by RT-Thread team
Hello, RISC-V!
msh />
```
> Note: The default log serial port for the c906 little core is uart1
+3 -8
View File
@@ -195,20 +195,15 @@
/* peripheral libraries and drivers */
/* HAL & SDK Drivers */
/* STM32 HAL & SDK Drivers */
/* Kendryte SDK */
/* sensors drivers */
/* touch drivers */
/* Kendryte SDK */
/* AI packages */
-5
View File
@@ -1,5 +0,0 @@
cv1800b_milkv_duo_sd.dtb
Image
Image.lzma
multi.its
boot.sd
Binary file not shown.
-56
View File
@@ -1,56 +0,0 @@
/*
* U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs
*/
/dts-v1/;
/ {
description = "Various kernels, ramdisks and FDT blobs";
#address-cells = <2>;
images {
kernel-1 {
description = "cvitek kernel";
data = /incbin/("./Image.lzma");
type = "kernel";
arch = "riscv";
os = "linux";
compression = "lzma";
load = <0x0 0x80200000>;
entry = <0x0 0x80200000>;
hash-2 {
algo = "crc32";
};
};
/*FDT*/
fdt-cv1800b_milkv_duo_sd {
description = "cvitek device tree - cv1800b_milkv_duo_sd";
data = /incbin/("./cv1800b_milkv_duo_sd.dtb");
type = "flat_dt";
arch = "riscv";
compression = "none";
hash-1 {
algo = "sha256";
};
};
};
/*CFG*/
configurations {
config-cv1800b_milkv_duo_sd {
description = "boot cvitek system with board cv1800b_milkv_duo_sd";
kernel = "kernel-1";
fdt = "fdt-cv1800b_milkv_duo_sd";
};
};
};
File diff suppressed because it is too large. Load diff
+2
View File
@@ -0,0 +1,2 @@
dtb/
Image
@@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
source "board/Kconfig"
config BSP_USING_CV180X
config BSP_USING_CV18XX
bool
select ARCH_RISCV64
select RT_USING_SYSTEM_WORKQUEUE
@@ -48,8 +48,11 @@ config __STACKSIZE__
choice
prompt "Board Type"
default BOARD_TYPE_MILKV_DUO
default BOARD_TYPE_MILKV_DUO256M
config BOARD_TYPE_MILKV_DUO
bool "milkv-duo"
config BOARD_TYPE_MILKV_DUO256M
bool "milkv-duo256m"
endchoice
@@ -57,6 +57,13 @@ $ sudo apt install -y scons libncurses5-dev device-tree-compiler
$ scons --menuconfig
```
选择当前需要编译的目标开发板类型:
```shell
Board Type (milkv-duo) --->
( ) milkv-duo
(X) milkv-duo256m
```
它会自动下载env相关脚本到~/.env目录,然后执行
```shell
$ source ~/.env/env.sh
@@ -54,6 +54,14 @@ On the Linux platform, you can execute:
```shell
$ scons --menuconfig
```
Select the type of target board that you want to compile:
```shell
Board Type (milkv-duo) --->
( ) milkv-duo
(X) milkv-duo256m
```
It will automatically download environment-related scripts to the ~/.env directory, and then execute
```shell
$ source ~/.env/env.sh
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -90,6 +90,7 @@
#define DFS_FD_MAX 16
#define RT_USING_DFS_V2
#define RT_USING_DFS_DEVFS
#define RT_USING_DFS_PTYFS
#define RT_USING_PAGECACHE
/* page cache config */
@@ -112,7 +113,6 @@
#define RT_USING_SERIAL_V1
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_TTY
#define RT_USING_NULL
#define RT_USING_ZERO
#define RT_USING_RANDOM
@@ -172,6 +172,8 @@
#define LWP_TID_MAX_NR 64
#define RT_LWP_SHM_MAX_NR 64
#define RT_USING_LDSO
#define LWP_USING_TERMINAL
#define LWP_PTY_MAX_PARIS_LIMIT 64
/* Memory management */
@@ -242,20 +244,15 @@
/* peripheral libraries and drivers */
/* HAL & SDK Drivers */
/* STM32 HAL & SDK Drivers */
/* Kendryte SDK */
/* sensors drivers */
/* touch drivers */
/* Kendryte SDK */
/* AI packages */
@@ -311,11 +308,11 @@
#define BSP_USING_UART
#define RT_USING_UART0
#define UART_IRQ_BASE 44
#define BSP_USING_CV180X
#define BSP_USING_CV18XX
#define C906_PLIC_PHY_ADDR 0x70000000
#define IRQ_MAX_NR 64
#define TIMER_CLK_FREQ 25000000
#define __STACKSIZE__ 4096
#define BOARD_TYPE_MILKV_DUO
#define BOARD_TYPE_MILKV_DUO256M
#endif
File renamed without changes.
+2 -2
View File
@@ -31,7 +31,7 @@ get_board_type
echo "start compress kernel..."
lzma -c -9 -f -k ${PROJECT_PATH}/${IMAGE_NAME} > ${PROJECT_PATH}/Image.lzma
lzma -c -9 -f -k ${PROJECT_PATH}/${IMAGE_NAME} > ${PROJECT_PATH}/dtb/${BOARD_TYPE}/Image.lzma
mkdir -p ${ROOT_PATH}/output/${BOARD_TYPE}
./mkimage -f ${PROJECT_PATH}/multi.its -r ${ROOT_PATH}/output/${BOARD_TYPE}/boot.sd
./mkimage -f ${PROJECT_PATH}/dtb/${BOARD_TYPE}/multi.its -r ${ROOT_PATH}/output/${BOARD_TYPE}/boot.sd