Prepare the Compilation Environment. Using a local Ubuntu system, the officially supported compilation environment is `Ubuntu Jammy 22.04.x amd64` only!
If you are using other Linux distributions, we strongly recommend that you use the Docker environment to compile to reduce the probability of compilation errors.
-`mobaXterm`とか`Xshell`のようなシリアルポートツールをインストールしてください
### Ubuntu 22.04 LTSに必要なツール
The following describes the compilation methods in the two environments.
*Note: The first compilation will automatically download the required toolchain, which is approximately 840MB in size. Once downloaded, it will be automatically extracted to the `host-tools` directory in the SDK directory. For subsequent compilations, if the `host-tools` directory is detected, the download will not be performed again*.
### 手動コンパイル
### <2>. Step-by-step Compilation
手動コンパイルをしたい場合は以下のコマンドを順に実行します。
If you wish to perform step-by-step compilation, you can enter the following commands sequentially:
Location of the generated image: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`.
## 2. Compiled using Docker
Docker support is required on hosts running Linux systems. For how to use Docker, please refer to the [official documentation](https://docs.docker.com/) or other tutorials.
We put the SDK source code on the Linux host system and call the Docker image environment provided by Milk-V to compile it.
-`duodocker` The name of the running Docker must be consistent with the name set in the previous step.
-`"*"` In quotes is the shell command to be run in the Docker image.
-`cd /home/work` Switch to the /home/work directory. Since this directory has been bound to the host's code directory during runtime, the /home/work directory in Docker is the source code directory of the SDK.
-`cat /etc/issue` Displays the version number of the image used by Docker. It is currently Ubuntu 22.04.3 LTS and is used for debugging.
After successful compilation, you can see the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory.
### <2>. Compile step by step using Docker
Step-by-step compilation requires logging into Docker to operate. Use the command `docker ps -a` to view and record the ID number of the container, such as 8edea33c2239.
After compilation is completed, you can use the `exit` command to exit the Docker environment:
```
root@8edea33c2239:/home/work# exit
```
The generated firmware can also be seen in the host code directory.
### Stop Docker
After compilation is completed, if the above Docker running environment is no longer needed, you can stop it first and then delete it:
```
docker stop 8edea33c2239
docker rm 8edea33c2239
```
## Other compilation considerations
If you want to try to compile this SDK in an environment other than the above two environments, the following are things you may need to pay attention to, for reference only.
### cmake version
Note:`cmake` minimum version requirement is `3.16.5`.
Check the version of `cmake` in the system:
```bash
cmake --version
```
For example, the version of `cmake` installed using apt in the `Ubuntu 20.04` is:
```
cmake version 3.16.3
```
The minimum requirement of this SDK is not met. Manual installation of the latest version `3.27.6` is needed:
sudo sh cmake-3.27.6-linux-x86_64.sh --skip-license--prefix=/usr/local/
```
When manually installed, `cmake` is located in `/usr/local/bin`. To check its version, use the command `cmake --version`, which should display:
```
cmake version 3.27.6
```
### Compiling with Windows Linux Subsystem (WSL)
If you wish to perform the compilation with WSL, there's an small issue building the image.
The $PATH, due Windows interoperability, has Windows environment variables which include some spaces between the paths.
To solve this problem you need to change the `/etc/wsl.conf` file and add the following lines:
```
[interop]
appendWindowsPath = false
```
After that, you need to reboot the WSL with `wsl.exe --reboot`. Then you able to run the `./build_milkv.sh` script or the `build_all` line in the step-by-step compilation method.
To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true. To reboot the WSL, can you use the Windows PowerShell command `wsl.exe --shutdown` then `wsl.exe`, after that the Windows environment variables become avaliable again in $PATH.
@@ -32,12 +32,15 @@ Milk-V Duo is an ultra-compact embedded development platform based on the CV1800
...
@@ -32,12 +32,15 @@ Milk-V Duo is an ultra-compact embedded development platform based on the CV1800
# Quick Start
# Quick Start
## Prepare the Compilation Environment
Prepare the Compilation Environment. Using a local Ubuntu system, the officially supported compilation environment is `Ubuntu Jammy 22.04.x amd64` only!
- Using a local Ubuntu system, the officially supported compilation environment is `Ubuntu Jammy 22.04.x amd64` only!
If you are using other Linux distributions, we strongly recommend that you use the Docker environment to compile to reduce the probability of compilation errors.
- Install a serial port tool: `mobaXterm` or `Xshell` or others.
### Packages to be installed on Ubuntu 22.04 LTS
The following describes the compilation methods in the two environments.
## 1. Compiled using Ubuntu 20.04
### Packages to be installed
Install the packages that compile dependencies:
Install the packages that compile dependencies:
...
@@ -45,46 +48,109 @@ Install the packages that compile dependencies:
...
@@ -45,46 +48,109 @@ Install the packages that compile dependencies:
To solve this problem you need to change the `/etc/wsl.conf` file and add the following lines:
### <1>. One-click Compilation
```bash
- Execute the one-click compilation script `build_milkv.sh`:
[interop]
appendWindowsPath =false
```
cd duo-buildroot-sdk/
./build_milkv.sh
```
```
After that, you need to reboot the WSL with `wsl.exe --reboot`. Then you able to run the `./build_milkv.sh` script or the `build_all` line in the step-by-step compilation method.
- After a successful compilation, you can find the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory.
To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true. To reboot the WSL, can you use the Windows PowerShell command `wsl.exe --shutdown` then `wsl.exe`, after that the Windows environment variables become avaliable again in $PATH.
## Compile the Image
*Note: The first compilation will automatically download the required toolchain, which is approximately 840MB in size. Once downloaded, it will be automatically extracted to the `host-tools` directory in the SDK directory. For subsequent compilations, if the `host-tools` directory is detected, the download will not be performed again*.
### Get SDK Source Code
### <2>. Step-by-step Compilation
If you wish to perform step-by-step compilation, you can enter the following commands sequentially:
```bash
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
clean_all
build_all
pack_sd_image
```
Location of the generated image: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`.
## 2. Compiled using Docker
Docker support is required on hosts running Linux systems. For how to use Docker, please refer to the [official documentation](https://docs.docker.com/) or other tutorials.
We put the SDK source code on the Linux host system and call the Docker image environment provided by Milk-V to compile it.
-`duodocker` The name of the running Docker must be consistent with the name set in the previous step.
-`"*"` In quotes is the shell command to be run in the Docker image.
-`cd /home/work` Switch to the /home/work directory. Since this directory has been bound to the host's code directory during runtime, the /home/work directory in Docker is the source code directory of the SDK.
-`cat /etc/issue` Displays the version number of the image used by Docker. It is currently Ubuntu 22.04.3 LTS and is used for debugging.
After successful compilation, you can see the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory.
- After a successful compilation, you can find the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory
### <2>. Compile step by step using Docker
*Note: The first compilation will automatically download the required toolchain, which is approximately 840MB in size. Once downloaded, it will be automatically extracted to the `host-tools` directory in the SDK directory. For subsequent compilations, if the `host-tools` directory is detected, the download will not be performed again*
Step-by-step compilation requires logging into Docker to operate. Use the command `docker ps -a` to view and record the ID number of the container, such as 8edea33c2239.
### Step-by-step Compilation
Enter Docker:
```
docker exec -it 8edea33c2239 /bin/bash
```
If you wish to perform step-by-step compilation, you can enter the following commands sequentially
Enter the code directory bound in Docker:
```
root@8edea33c2239:/# cd /home/work/
```
Compile step by step:
```bash
```bash
export MILKV_BOARD=milkv-duo
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source milkv/boardconfig-milkv-duo.sh
...
@@ -96,29 +162,92 @@ build_all
...
@@ -96,29 +162,92 @@ build_all
pack_sd_image
pack_sd_image
```
```
Location of the generated image: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`
After compilation is completed, you can use the `exit` command to exit the Docker environment:
```
root@8edea33c2239:/home/work# exit
```
The generated firmware can also be seen in the host code directory.
### Stop Docker
After compilation is completed, if the above Docker running environment is no longer needed, you can stop it first and then delete it:
```
docker stop 8edea33c2239
docker rm 8edea33c2239
```
## Other compilation considerations
If you want to try to compile this SDK in an environment other than the above two environments, the following are things you may need to pay attention to, for reference only.
### cmake version
Note:`cmake` minimum version requirement is `3.16.5`.
Check the version of `cmake` in the system:
```bash
cmake --version
```
For example, the version of `cmake` installed using apt in the `Ubuntu 20.04` is:
```
cmake version 3.16.3
```
The minimum requirement of this SDK is not met. Manual installation of the latest version `3.27.6` is needed:
sudo sh cmake-3.27.6-linux-x86_64.sh --skip-license--prefix=/usr/local/
```
When manually installed, `cmake` is located in `/usr/local/bin`. To check its version, use the command `cmake --version`, which should display:
```
cmake version 3.27.6
```
### Compiling with Windows Linux Subsystem (WSL)
If you wish to perform the compilation with WSL, there's an small issue building the image.
The $PATH, due Windows interoperability, has Windows environment variables which include some spaces between the paths.
To solve this problem you need to change the `/etc/wsl.conf` file and add the following lines:
```
[interop]
appendWindowsPath = false
```
After that, you need to reboot the WSL with `wsl.exe --reboot`. Then you able to run the `./build_milkv.sh` script or the `build_all` line in the step-by-step compilation method.
To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true. To reboot the WSL, can you use the Windows PowerShell command `wsl.exe --shutdown` then `wsl.exe`, after that the Windows environment variables become avaliable again in $PATH.
## SD card burning
## SD card burning
> Note: Writing the image to the microSD card will erase the existing data on the card. Remember to back up important data before burning!!!
> Note: Writing the image to the microSD card will erase the existing data on the card. Remember to back up important data before burning!!!
- To write the generated image to a microSD card on Windows, you can use tools like `balenaEtcher`, `Rufus`, or `Win32 Disk Imager`
- To write the generated image to a microSD card on Windows, you can use tools like `balenaEtcher`, `Rufus`, or `Win32 Disk Imager`.
- To write the generated image to a microSD card on Linux, use the `dd` command. **Please make sure to carefully confirm that the `of` device `/dev/sdX` corresponds to the microSD card you want to burn**
- To write the generated image to a microSD card on Linux, use the `dd` command. **Please make sure to carefully confirm that the `of` device `/dev/sdX` corresponds to the microSD card you want to burn**:
```
```
sudo dd if=milkv-duo-*-*.img of=/dev/sdX
sudo dd if=milkv-duo-*-*.img of=/dev/sdX
```
```
## Power ON
## Power ON
- Insert the microSD card into the microSD card slot of the Milk-V Duo
- Insert the microSD card into the microSD card slot of the Milk-V Duo.
- Connect the serial cable (optional)
- Connect the serial cable (optional).
- Power on, the Duo will boot up and enter the system normally
- Power on, the Duo will boot up and enter the system normally.
- If a serial cable is connected, you can view the boot logs in the serial console. After entering the system, you can use the serial console to log in to the terminal and execute relevant Linux commands
- If a serial cable is connected, you can view the boot logs in the serial console (`mobarXterm`, `Xshell` or others). After entering the system, you can use the serial console to log in to the terminal and execute relevant Linux commands.
### The method to log in to the Duo terminal
### The method to log in to the Duo terminal
- Using a serial cable
- Using a serial cable.
- Using a USB network (RNDIS)
- Using a USB network (RNDIS).
- Using the Ethernet interface (requires the IO-Board)
- Using the Ethernet interface (requires the IO-Board).
The username and password for logging into the Duo terminal are as follows:
The username and password for logging into the Duo terminal are as follows:
Note that when using the IO-Board, the USB network (RNDIS) is not available, Please use the Ethernet interface on the IO-Board
Note that when using the IO-Board, the USB network (RNDIS) is not available, Please use the Ethernet interface on the IO-Board.
If you need to assign a fixed MAC address to the Ethernet port of the IO-Board, please execute the following command(**Replace the MAC address in the command with the MAC address you want to set, and please note that MAC addresses of different devices within the same network segment must not be duplicated**)
If you need to assign a fixed MAC address to the Ethernet port of the IO-Board, please execute the following command(**Replace the MAC address in the command with the MAC address you want to set, and please note that MAC addresses of different devices within the same network segment must not be duplicated**):
For example, if a USB flash drive is connected to the USB port on the IO-Board, you can use the command `ls /dev/sd*` to check if the device is detected
For example, if a USB flash drive is connected to the USB port on the IO-Board, you can use the command `ls /dev/sd*` to check if the device is detected.
To mount the USB drive and view its contents in the system (taking /dev/sda1 as an example):
To mount the USB drive and view its contents in the system (taking /dev/sda1 as an example):
...
@@ -174,19 +303,19 @@ mkdir /mnt/udisk
...
@@ -174,19 +303,19 @@ mkdir /mnt/udisk
mount /dev/sda1 /mnt/udisk
mount /dev/sda1 /mnt/udisk
```
```
Verify if the contents in the `/mnt/udisk` directory match the expectations
Verify if the contents in the `/mnt/udisk` directory match the expectations:
```bash
```bash
ls /mnt/udisk
ls /mnt/udisk
```
```
The command to unmount a USB flash drive
The command to unmount a USB flash drive:
```bash
```bash
umount /mnt/udisk
umount /mnt/udisk
```
```
To restore the functionality of the USB network (RNDIS) when not using the IO-Board, you can follow these steps
To restore the functionality of the USB network (RNDIS) when not using the IO-Board, you can follow these steps:
The CV1800B chip adopts a dual-core design. Currently, the Linux system runs on one of the cores, while the other core is used for running a real-time system. The SDK for this core has not been released yet and will be updated in the future
The CV1800B chip adopts a dual-core design. Currently, the Linux system runs on one of the cores, while the other core is used for running a real-time system. The SDK for this core has not been released yet and will be updated in the future.
2. Why does it only show 28M when viewing the RAM?
2. Why does it only show 28M when viewing the RAM?
Because a portion of the RAM is allocated to [ION](https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/default/dts/cv180x/cv180x_default_memmap.dtsi#L15), which is the memory used when running algorithms with the camera. If you're not using the camera, you can modify the value of this [ION_SIZE](https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/cv180x/cv1800b_milkv_duo_sd/memmap.py#L43) to 0 and then recompile to generate the image
Because a portion of the RAM is allocated to [ION](https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/default/dts/cv180x/cv180x_default_memmap.dtsi#L15), which is the memory used when running algorithms with the camera. If you're not using the camera, you can modify the value of this [ION_SIZE](https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/cv180x/cv1800b_milkv_duo_sd/memmap.py#L43) to 0 and then recompile to generate the image.
## Links to some documentation from the chip manufacturer
## Links to some documentation from the chip manufacturer
- CV181x/CV180x MMF SDK Development Documents (English and Chinese): [MultiMedia Framework Software Development Document](https://developer.sophgo.com/thread/471.html)
- CV181x/CV180x MMF SDK Development Documents (English and Chinese): [MultiMedia Framework Software Development Document](https://developer.sophgo.com/thread/471.html).
- CV Series Chip TPU SDK Development Documentation Compilation (Chinese): [CV series chip TPU SDK development data summary](https://developer.sophgo.com/thread/473.html)
- CV Series Chip TPU SDK Development Documentation Compilation (Chinese): [CV series chip TPU SDK development data summary](https://developer.sophgo.com/thread/473.html).