-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards: canaan: Add initial support for canmv_k230 #74169
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_CANMV_K230 | ||
select SOC_CANAAN_K230 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board: | ||
name: canmv_k230 | ||
vendor: canaan | ||
socs: | ||
- name: k230 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2024 Junhui Liu <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include "canaan/k230.dtsi" | ||
|
||
/ { | ||
model = "Canaan CanMV-K230"; | ||
compatible = "cannan,canmv-k230"; | ||
|
||
ddr: memory@0 { | ||
device_type = "memory"; | ||
reg = <0x0 0x0 0x0 0x20000000>; | ||
}; | ||
|
||
chosen { | ||
zephyr,console = &uart3; | ||
zephyr,shell-uart = &uart3; | ||
zephyr,sram = &ddr; | ||
}; | ||
}; | ||
|
||
&uart3 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
identifier: canmv_k230 | ||
name: Canaan CanMV-K230 | ||
type: mcu | ||
arch: riscv | ||
toolchain: | ||
- zephyr | ||
- cross-compile | ||
supported: | ||
- uart |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Zephyr Kernel Configuration | ||
CONFIG_XIP=n | ||
|
||
# Serial Drivers | ||
CONFIG_SERIAL=y | ||
CONFIG_UART_INTERRUPT_DRIVEN=y | ||
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y | ||
|
||
# Enable Console | ||
CONFIG_CONSOLE=y | ||
CONFIG_UART_CONSOLE=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.. _canmv_k230: | ||
|
||
Canaan CanMV-K230 | ||
################# | ||
|
||
Overview | ||
******** | ||
|
||
The Canaan CanMV-K230 is a development board with a Canaan Kendryte K230 | ||
64bit RISC-V SoC. | ||
|
||
Programming and debugging | ||
************************* | ||
|
||
Zephyr binary can be loaded by U-Boot command in machine mode. | ||
|
||
.. code-block:: console | ||
|
||
fatload mmc 1:1 0x0 zephyr.bin | ||
go 0x0 | ||
|
||
Applications for the ``canmv_k230`` board configuration can be built as | ||
usual (see :ref:`build_an_application`) using the corresponding board name: | ||
|
||
.. zephyr-app-commands:: | ||
:board: canmv_k230 | ||
:goals: build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. _boards-canaan: | ||
|
||
Canaan | ||
###### | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:glob: | ||
|
||
**/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: T-Head C908 RISC-V CPU | ||
|
||
compatible: "thead,c908" | ||
|
||
include: riscv,cpus.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (c) 2024 Junhui Liu <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
#address-cells = <2>; | ||
#size-cells = <2>; | ||
compatible = "canaan,kendryte-k230"; | ||
model = "canaan,k230"; | ||
|
||
cpus { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
cpu0: cpu@0 { | ||
compatible = "thead,c908", "riscv"; | ||
device_type = "cpu"; | ||
mmu-type = "riscv,sv39"; | ||
reg = <0>; | ||
riscv,isa = "rv64imafdc_zicsr_zifencei"; | ||
status = "okay"; | ||
|
||
cpu0_intc: interrupt-controller { | ||
compatible = "riscv,cpu-intc"; | ||
#address-cells = <0>; | ||
#interrupt-cells = <1>; | ||
interrupt-controller; | ||
}; | ||
}; | ||
}; | ||
|
||
soc { | ||
#address-cells = <2>; | ||
#size-cells = <2>; | ||
compatible = "canaan,k230-soc", "simple-bus"; | ||
interrupt-parent = <&plic>; | ||
ranges; | ||
|
||
plic: interrupt-controller@f00000000 { | ||
compatible = "sifive,plic-1.0.0"; | ||
reg = <0xf 0x00000000 0x0 0x04000000>; | ||
interrupt-controller; | ||
interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; | ||
#address-cells = <0>; | ||
#interrupt-cells = <2>; | ||
riscv,max-priority = <7>; | ||
riscv,ndev = <208>; | ||
}; | ||
|
||
clint: clint@f04000000 { | ||
compatible = "thead,machine-timer"; | ||
reg = <0xf 0x04000000 0x0 0x00010000>; | ||
interrupts-extended = <&cpu0_intc 7>; | ||
}; | ||
|
||
uart0: serial@91400000 { | ||
compatible = "ns16550"; | ||
reg = <0x0 0x91400000 0x0 0x1000>; | ||
interrupts = <16 1>; | ||
reg-shift = <2>; | ||
clock-frequency = <50000000>; | ||
status = "disabled"; | ||
}; | ||
|
||
uart1: serial@91401000 { | ||
compatible = "ns16550"; | ||
reg = <0x0 0x91401000 0x0 0x1000>; | ||
interrupts = <17 1>; | ||
reg-shift = <2>; | ||
clock-frequency = <50000000>; | ||
status = "disabled"; | ||
}; | ||
|
||
uart2: serial@91402000 { | ||
compatible = "ns16550"; | ||
reg = <0x0 0x91402000 0x0 0x1000>; | ||
interrupts = <18 1>; | ||
reg-shift = <2>; | ||
clock-frequency = <50000000>; | ||
status = "disabled"; | ||
}; | ||
|
||
uart3: serial@91403000 { | ||
compatible = "ns16550"; | ||
reg = <0x0 0x91403000 0x0 0x1000>; | ||
interrupts = <19 1>; | ||
reg-shift = <2>; | ||
clock-frequency = <50000000>; | ||
status = "disabled"; | ||
}; | ||
|
||
uart4: serial@91404000 { | ||
compatible = "ns16550"; | ||
reg = <0x0 0x91404000 0x0 0x1000>; | ||
interrupts = <20 1>; | ||
reg-shift = <2>; | ||
clock-frequency = <50000000>; | ||
status = "disabled"; | ||
}; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_subdirectory(${SOC_SERIES}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_FAMILY_CANAAN | ||
|
||
rsource "*/Kconfig" | ||
|
||
endif # SOC_FAMILY_CANAAN |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_FAMILY_CANAAN | ||
|
||
rsource "*/Kconfig.defconfig" | ||
|
||
endif # SOC_FAMILY_CANAAN |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SOC_FAMILY_CANAAN | ||
bool | ||
|
||
config SOC_FAMILY | ||
default "canaan" if SOC_FAMILY_CANAAN | ||
|
||
rsource "*/Kconfig.soc" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_include_directories(.) | ||
|
||
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SOC_SERIES_CANAAN_K230 | ||
select RISCV | ||
select RISCV_PRIVILEGED | ||
select RISCV_HAS_PLIC | ||
select RISCV_ISA_RV64I | ||
select RISCV_ISA_EXT_G | ||
select RISCV_ISA_EXT_C | ||
|
||
select INCLUDE_RESET_VECTOR | ||
select ATOMIC_OPERATIONS_C | ||
select 64BIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_SERIES_CANAAN_K230 | ||
|
||
config SYS_CLOCK_HW_CYCLES_PER_SEC | ||
default 27000000 | ||
|
||
config RISCV_SOC_INTERRUPT_INIT | ||
default y | ||
|
||
config RISCV_GP | ||
default y | ||
|
||
config 2ND_LVL_ISR_TBL_OFFSET | ||
default 12 | ||
|
||
config 2ND_LVL_INTR_00_OFFSET | ||
default 11 | ||
|
||
config NUM_IRQS | ||
default 208 | ||
|
||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) 2024 Junhui Liu <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SOC_SERIES_CANAAN_K230 | ||
bool | ||
select SOC_FAMILY_CANAAN | ||
|
||
config SOC_CANAAN_K230 | ||
bool | ||
select SOC_SERIES_CANAAN_K230 | ||
|
||
config SOC_SERIES | ||
default "k230" if SOC_SERIES_CANAAN_K230 | ||
|
||
config SOC | ||
default "k230" if SOC_CANAAN_K230 | ||
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the text here, it needs to match the symbol, if you have k230 then you need SOC_SERIES_K230/SOC_K230, if you have canaan_k280 then you need SOC_SERIES_CANAAN_K230/SOC_CANAAN_K230 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I'll update it when rebase |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
series: | ||
- name: k230 | ||
socs: | ||
- name: k230 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
family: | ||
- name: canaan | ||
series: | ||
- name: k230 | ||
socs: | ||
- name: k230 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update it when rebase