Skip to content

Commit ac07e55

Browse files
committed
boards: milkv: Bring up Milk-V Duo
Milk-V Duo is a tiny development board shipped with SOPHGO CV1800B. Signed-off-by: Chen Xingyu <[email protected]>
1 parent 7ce7ba7 commit ac07e55

12 files changed

+271
-0
lines changed

boards/milkv/duo/Kconfig.milkv_duo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2023-2024 Chen Xingyu <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MILKV_DUO
5+
select SOC_CV1800B if BOARD_MILKV_DUO_CV1800B_C906_1
6+
select SOC_SG2002 if BOARD_MILKV_DUO_SG2002_C906_1

boards/milkv/duo/board.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
include(${ZEPHYR_BASE}/boards/common/cvi-fiptool.board.cmake)

boards/milkv/duo/board.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
board:
2+
name: milkv_duo
3+
full_name: Duo
4+
vendor: milkv
5+
socs:
6+
- name: cv1800b
7+
- name: sg2002

boards/milkv/duo/doc/index.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. zephyr:board:: milkv_duo
2+
3+
Overview
4+
********
5+
6+
See https://milkv.io/duo
7+
8+
Supported Features
9+
==================
10+
11+
.. zephyr:board-supported-hw::
12+
13+
Programming and Debugging
14+
*************************
15+
16+
Prepare a TF card and follow the instructions in the `official SDK`_ to build
17+
and flash the image.
18+
19+
After that, you will get a ``fip.bin`` file at the root of the TF card, where
20+
the RTOS image is packed.
21+
22+
The following steps demonstrate how to build the blinky sample and update the
23+
``fip.bin`` file on the TF card.
24+
25+
.. zephyr-app-commands::
26+
:zephyr-app: samples/basic/blinky
27+
:board: milkv_duo/cv1800b/c906_1
28+
:goals: build flash
29+
:flash-args: --fiptool /path/to/duo-buildroot-sdk/fsbl/plat/cv180x/fiptool.py --fip-bin /path/to/tfcard/fip.bin
30+
31+
Eject the TF card and insert it into the board. Power on the board and you will
32+
see the LED blinking.
33+
34+
.. note::
35+
36+
Notes for the official buildroot SDK
37+
38+
1. The Linux running on the big core uses UART0 (GP12/GP13) for the console,
39+
while to avoid conflict, the Zephyr application (in the default board
40+
configuration) uses UART1 (GP0/GP1).
41+
2. Pin multiplexing can be handled either by U-Boot or Zephyr. To utilize
42+
Zephyr's pin multiplexing, enable :kconfig:option:`CONFIG_PINCTRL` and
43+
recompile U-Boot without the PINMUX configs. The source code for the
44+
PINMUX configs varies by SoC:
45+
46+
* For Duo (CV1800B), see `PINMUX configs (Duo)`_
47+
* For Duo 256M (SG2002), see `PINMUX configs (Duo 256M)`_
48+
49+
Note that U-Boot boots several seconds after Zephyr.
50+
3. By default, the Linux running on the big core will blink the LED on the
51+
board. To demonstrate Zephyr (specifically, the ``samples/basic/blinky``
52+
sample), you should remove the script from the Linux filesystem located at
53+
``/mnt/system/blink.sh``.
54+
55+
.. _official SDK:
56+
https://github.com/milkv-duo/duo-buildroot-sdk
57+
58+
.. _PINMUX configs (Duo):
59+
https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/cv180x/cv1800b_milkv_duo_sd/u-boot/cvi_board_init.c
60+
61+
.. _PINMUX configs (Duo 256M):
62+
https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/cv181x/cv1812cp_milkv_duo256m_sd/u-boot/cvi_board_init.c
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2023-2024 Chen Xingyu <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
&pinctrl {
7+
uart1_default: uart1_default {
8+
group1 {
9+
pinmux = <CVI_PINMUX(IIC0_SCL, UART1_TX)>, /* GP0 */
10+
<CVI_PINMUX(IIC0_SDA, UART1_RX)>; /* GP1 */
11+
};
12+
};
13+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2023-2024 Chen Xingyu <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include <sophgo/cv180x.dtsi>
9+
#include <zephyr/dt-bindings/gpio/gpio.h>
10+
11+
#include "milkv_duo-pinctrl.dtsi"
12+
13+
/ {
14+
model = "Milk-V Duo coprocessor";
15+
compatible = "milkv,duo";
16+
17+
chosen {
18+
zephyr,sram = &sram;
19+
zephyr,console = &uart1;
20+
zephyr,shell-uart = &uart1;
21+
};
22+
23+
aliases {
24+
led0 = &led;
25+
};
26+
27+
leds {
28+
compatible = "gpio-leds";
29+
30+
led: led {
31+
gpios = <&gpioc 24 GPIO_ACTIVE_HIGH>;
32+
};
33+
};
34+
35+
soc {
36+
/*
37+
* Memory region reserved for the RTOS core.
38+
*
39+
* Keep in sync with FREERTOS_ADDR and FREERTOS_SIZE in
40+
* build/boards/cv180x/cv1800b_milkv_duo_sd/memmap.py
41+
*
42+
* see: https://github.com/milkv-duo/duo-buildroot-sdk
43+
*/
44+
sram: memory@83f40000 {
45+
compatible = "mmio-sram";
46+
reg = <0x83f40000 DT_SIZE_K(768)>;
47+
};
48+
};
49+
};
50+
51+
&gpioc {
52+
status = "okay";
53+
};
54+
55+
&uart1 {
56+
status = "okay";
57+
pinctrl-0 = <&uart1_default>;
58+
pinctrl-names = "default";
59+
current-speed = <115200>;
60+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
identifier: milkv_duo/cv1800b/c906_1
2+
name: Milk-V Duo coprocessor
3+
type: mcu
4+
arch: riscv
5+
toolchain:
6+
- zephyr
7+
ram: 768
8+
supported:
9+
- clock
10+
- gpio
11+
- interrupt-controller
12+
- mailbox
13+
- pinctrl
14+
- pwm
15+
- serial
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2023-2024 Chen Xingyu <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_XIP=n
5+
6+
CONFIG_GPIO=y
7+
CONFIG_SERIAL=y
8+
9+
CONFIG_CONSOLE=y
10+
CONFIG_UART_CONSOLE=y
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2024 Chen Xingyu <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include <sophgo/cv181x.dtsi>
9+
#include <zephyr/dt-bindings/gpio/gpio.h>
10+
11+
#include "milkv_duo-pinctrl.dtsi"
12+
13+
/ {
14+
model = "Milk-V Duo 256M coprosessor";
15+
compatible = "milkv,duo";
16+
17+
chosen {
18+
zephyr,sram = &sram;
19+
zephyr,console = &uart1;
20+
zephyr,shell-uart = &uart1;
21+
};
22+
23+
aliases {
24+
led0 = &led;
25+
};
26+
27+
leds {
28+
compatible = "gpio-leds";
29+
30+
led: led {
31+
gpios = <&pwr_gpio 2 GPIO_ACTIVE_HIGH>;
32+
};
33+
};
34+
35+
soc {
36+
/*
37+
* Memory region reserved for the RTOS core.
38+
*
39+
* Keep in sync with FREERTOS_ADDR and FREERTOS_SIZE in
40+
* build/boards/cv181x/cv1812cp_milkv_duo256m_sd/memmap.py
41+
*
42+
* see: https://github.com/milkv-duo/duo-buildroot-sdk
43+
*/
44+
sram: memory@8fe00000 {
45+
compatible = "mmio-sram";
46+
reg = <0x8fe00000 DT_SIZE_M(2)>;
47+
};
48+
};
49+
};
50+
51+
&pwr_gpio {
52+
status = "okay";
53+
};
54+
55+
&uart1 {
56+
status = "okay";
57+
pinctrl-0 = <&uart1_default>;
58+
pinctrl-names = "default";
59+
current-speed = <115200>;
60+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
identifier: milkv_duo/sg2002/c906_1
2+
name: Milk-V Duo 256M coprocessor
3+
type: mcu
4+
arch: riscv
5+
toolchain:
6+
- zephyr
7+
ram: 2048
8+
supported:
9+
- clock
10+
- gpio
11+
- interrupt-controller
12+
- mailbox
13+
- pinctrl
14+
- pwm
15+
- serial

0 commit comments

Comments
 (0)