Skip to content

Commit 61ca49c

Browse files
committed
boards: milkv: Bring up Milk-V Duo S
Duo S is another development board by Milk-V, shipped with SOPHGO SG2000. Signed-off-by: Chen Xingyu <[email protected]>
1 parent ac07e55 commit 61ca49c

File tree

8 files changed

+178
-0
lines changed

8 files changed

+178
-0
lines changed

boards/milkv/duos/Kconfig.milkv_duos

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

boards/milkv/duos/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/duos/board.yml

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

boards/milkv/duos/doc/index.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. zephyr:board:: milkv_duos
2+
3+
Overview
4+
********
5+
6+
See https://milkv.io/duo-s
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_duos/sg2000/c906_1
28+
:goals: build flash
29+
:flash-args: --fiptool /path/to/duo-buildroot-sdk/fsbl/plat/cv181x/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 (A16/A17) for the console,
39+
while to avoid conflict, the Zephyr application (in the default board
40+
configuration) uses UART2 (A19/A18).
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`_. Note that U-Boot boots
44+
several seconds after Zephyr.
45+
46+
.. _official SDK:
47+
https://github.com/milkv-duo/duo-buildroot-sdk
48+
49+
.. _PINMUX configs:
50+
https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/build/boards/cv181x/cv1813h_milkv_duos_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) 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(JTAG_CPU_TMS, UART1_TX)>, /* A19 */
10+
<CVI_PINMUX(JTAG_CPU_TCK, UART1_RX)>; /* A18 */
11+
};
12+
};
13+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
#include <zephyr/dt-bindings/input/input-event-codes.h>
11+
12+
#include "milkv_duos-pinctrl.dtsi"
13+
14+
/ {
15+
model = "Milk-V Duo S";
16+
compatible = "milkv,duo-s";
17+
18+
chosen {
19+
zephyr,sram = &sram;
20+
zephyr,console = &uart1;
21+
zephyr,shell-uart = &uart1;
22+
};
23+
24+
aliases {
25+
led0 = &led;
26+
sw0 = &button;
27+
};
28+
29+
leds {
30+
compatible = "gpio-leds";
31+
32+
led: led {
33+
gpios = <&gpioa 29 GPIO_ACTIVE_HIGH>;
34+
};
35+
};
36+
37+
keys {
38+
compatible = "gpio-keys";
39+
40+
button: button {
41+
label = "RECOVERY";
42+
gpios = <&gpiob 4 GPIO_ACTIVE_LOW>;
43+
zephyr,code = <INPUT_KEY_0>;
44+
};
45+
};
46+
47+
soc {
48+
/*
49+
* Memory region reserved for the RTOS core.
50+
*
51+
* Keep in sync with FREERTOS_ADDR and FREERTOS_SIZE in
52+
* build/boards/cv181x/cv1813h_milkv_duos_sd/memmap.py
53+
*
54+
* see: https://github.com/milkv-duo/duo-buildroot-sdk
55+
*/
56+
sram: memory@9fe00000 {
57+
compatible = "mmio-sram";
58+
reg = <0x9fe00000 DT_SIZE_M(2)>;
59+
};
60+
};
61+
};
62+
63+
&gpioa {
64+
status = "okay";
65+
};
66+
67+
&gpiob {
68+
status = "okay";
69+
};
70+
71+
&uart1 {
72+
status = "okay";
73+
pinctrl-0 = <&uart1_default>;
74+
pinctrl-names = "default";
75+
current-speed = <115200>;
76+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
identifier: milkv_duos/sg2000/c906_1
2+
name: Milk-V Duo S 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
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 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

0 commit comments

Comments
 (0)