Skip to content

Commit 36d60d2

Browse files
committed
boards: add ai_m62_12
Introduce a BL61x board Signed-off-by: Camille BAUD <[email protected]>
1 parent 71856fe commit 36d60d2

File tree

11 files changed

+320
-0
lines changed

11 files changed

+320
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config BOARD_AI_M62_12F
6+
select SOC_BL616C50Q2I
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/bl616x-pinctrl.h>
8+
9+
&pinctrl {
10+
uart0_default: uart0_default {
11+
group1 {
12+
pinmux = <GPIO22_UART0_RX>,
13+
<GPIO21_UART0_TX>;
14+
bias-pull-up;
15+
input-schmitt-enable;
16+
};
17+
};
18+
19+
uart0_sleep: uart0_sleep {
20+
group1 {
21+
pinmux = <GPIO22_UART0_RX>,
22+
<GPIO21_UART0_TX>;
23+
bias-high-impedance;
24+
};
25+
};
26+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <bflb/bl616.dtsi>
10+
#include "ai_m62_12f-pinctrl.dtsi"
11+
12+
/ {
13+
model = "Ai-Thinker M62-12F development board";
14+
compatible = "bflb,bl616";
15+
16+
chosen {
17+
zephyr,flash = &flash0;
18+
zephyr,code-partition = &slot0_partition;
19+
zephyr,itcm = &sram1;
20+
zephyr,sram = &sram0;
21+
zephyr,console = &uart0;
22+
zephyr,shell-uart = &uart0;
23+
};
24+
};
25+
26+
&cpu0 {
27+
clock-frequency = <DT_FREQ_M(320)>;
28+
};
29+
30+
&flashctrl {
31+
flash0: flash@A0000000 {
32+
compatible = "soc-nv-flash", "gd,25lq32d";
33+
reg = <0xA0000000 (0x400000 - 0x2000)>;
34+
write-block-size = <256>;
35+
erase-block-size = <DT_SIZE_K(4)>;
36+
37+
partitions {
38+
compatible = "fixed-partitions";
39+
#address-cells = <1>;
40+
#size-cells = <1>;
41+
42+
slot0_partition: partition@0 {
43+
label = "image-0";
44+
reg = <0x00000000 0x00100000>;
45+
read-only;
46+
};
47+
48+
storage_partition: partition@100000 {
49+
label = "storage";
50+
reg = <0x00100000 (0x300000 - 0x2000)>;
51+
};
52+
};
53+
};
54+
};
55+
56+
&uart0 {
57+
status = "okay";
58+
current-speed = <115200>;
59+
60+
pinctrl-0 = <&uart0_default>;
61+
pinctrl-1 = <&uart0_sleep>;
62+
pinctrl-names = "default", "sleep";
63+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
identifier: ai_m62_12f
6+
name: Ai-Thinker M62-12F development board
7+
type: mcu
8+
arch: riscv
9+
ram: 480
10+
toolchain:
11+
- zephyr
12+
testing:
13+
ignore_tags:
14+
- net
15+
- bluetooth
16+
supported:
17+
- pinctrl
18+
- uart
19+
vendor: bflb
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
CONFIG_CONSOLE=y
6+
CONFIG_SERIAL=y
7+
8+
CONFIG_UART_CONSOLE=y
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2024-2025 MASSDRIVER EI (massdriver.space)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
board_runner_args(openocd --cmd-pre-init "source [find bl61x.cfg]")
6+
7+
board_runner_args(openocd --use-elf --no-load --no-init)
8+
board_runner_args(openocd --gdb-init "set mem inaccessible-by-default off")
9+
board_runner_args(openocd --gdb-init "set architecture riscv:rv32")
10+
board_runner_args(openocd --gdb-init "set remotetimeout 250")
11+
board_runner_args(openocd --gdb-init "set print asm-demangle on")
12+
board_runner_args(openocd --gdb-init "set backtrace limit 32")
13+
board_runner_args(openocd --gdb-init "mem 0x22FC0000 0x23010000 rw")
14+
board_runner_args(openocd --gdb-init "mem 0x62FC0000 0x63010000 rw")
15+
board_runner_args(openocd --gdb-init "mem 0x90000000 0x90020000 ro")
16+
board_runner_args(openocd --gdb-init "mem 0xA8000000 0xA8800000 rw")
17+
board_runner_args(openocd --gdb-init "mem 0xA0000000 0xA0400000 ro")
18+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
19+
20+
board_runner_args(bflb_mcu_tool --chipname bl616)
21+
include(${ZEPHYR_BASE}/boards/common/bflb_mcu_tool.board.cmake)
22+
23+
board_set_flasher(bflb_mcu_tool)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: ai_m62_12f
3+
full_name: Ai-Thinker M62-12F development board
4+
vendor: aithinker
5+
socs:
6+
- name: bl616c50q2i
77.3 KB
Loading
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
.. zephyr:board:: ai_m62_12f
2+
3+
Overview
4+
********
5+
6+
Ai-M62-12F is a Wi-Fi 6 + BLE5.3 module developed by Shenzhen Ai-Thinker Technology
7+
Co., Ltd. The module is equipped with BL616 chip as the core processor, supports Wi-Fi
8+
802.11b/g/n/ax protocol and BLE protocol, and supports Thread protocol. The BL616 system
9+
includes a low-power 32-bit RISC-V CPU with floating-point unit, DSP unit, cache and
10+
memory, with a maximum dominant frequency of 320M.
11+
12+
Hardware
13+
********
14+
15+
For more information about the Bouffalo Lab BL-60x MCU:
16+
17+
- `Bouffalo Lab BL61x MCU Datasheet`_
18+
- `Bouffalo Lab Development Zone`_
19+
- `ai_m62_12f Schematics`_
20+
21+
Supported Features
22+
==================
23+
24+
.. zephyr:board-supported-hw::
25+
26+
System Clock
27+
============
28+
29+
The WB2 (BL602) Development Board is configured to run at max speed (192MHz).
30+
31+
Serial Port
32+
===========
33+
34+
The ``ai_m62_12f`` board uses UART0 as default serial port. It is connected
35+
to USB Serial converter and port is used for both program and console.
36+
37+
38+
Programming and Debugging
39+
*************************
40+
41+
Samples
42+
=======
43+
44+
#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample
45+
application:
46+
47+
.. zephyr-app-commands::
48+
:zephyr-app: samples/hello_world
49+
:board: ai_m62_12f
50+
:goals: build flash
51+
52+
#. Run your favorite terminal program to listen for output. Under Linux the
53+
terminal should be :code:`/dev/ttyUSB0`. For example:
54+
55+
.. code-block:: console
56+
57+
$ screen /dev/ttyUSB0 115200
58+
59+
The -o option tells minicom not to send the modem initialization
60+
string. Connection should be configured as follows:
61+
62+
- Speed: 115200
63+
- Data: 8 bits
64+
- Parity: None
65+
- Stop bits: 1
66+
67+
Then, press and release RST button
68+
69+
.. code-block:: console
70+
71+
*** Booting Zephyr OS build v4.2.0 ***
72+
Hello World! ai_m62_12f/bl616c50q2i
73+
74+
Congratulations, you have ``ai_m62_12f`` configured and running Zephyr.
75+
76+
77+
.. _Bouffalo Lab BL61x MCU Datasheet:
78+
https://github.com/bouffalolab/bl_docs/tree/main/BL616_DS/en
79+
80+
.. _Bouffalo Lab Development Zone:
81+
https://dev.bouffalolab.com/home?id=guest
82+
83+
.. _ai_m62_12f Schematics:
84+
https://docs.ai-thinker.com/en/ai_m62/
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
if { [info exists CHIPNAME] } {
6+
set _CHIPNAME $CHIPNAME
7+
} else {
8+
set _CHIPNAME riscv
9+
}
10+
11+
if { [info exists WORKAREASIZE] } {
12+
set _WORKAREASIZE $WORKAREASIZE
13+
} else {
14+
set _WORKAREASIZE 0x10000
15+
}
16+
17+
if { [info exists WORKAREAADDR] } {
18+
set _WORKAREAADDR $WORKAREAADDR
19+
} else {
20+
set _WORKAREAADDR 0x40000000
21+
}
22+
23+
if { [info exists CPUTAPID] } {
24+
set _CPUTAPID $CPUTAPID
25+
} else {
26+
set _CPUTAPID 0x10000b6f
27+
}
28+
29+
transport select jtag
30+
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID
31+
32+
set _TARGETNAME $_CHIPNAME.cpu
33+
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
34+
35+
$_TARGETNAME.0 configure -work-area-phys $_WORKAREAADDR -work-area-size $_WORKAREASIZE -work-area-backup 0
36+
37+
echo "Ready for Remote Connections"
38+
39+
$_TARGETNAME.0 configure -event reset-assert-pre {
40+
echo "reset-assert-pre"
41+
adapter speed 400
42+
}
43+
44+
$_TARGETNAME.0 configure -event reset-deassert-post {
45+
echo "reset-deassert-post"
46+
47+
adapter speed 400
48+
49+
reg mstatus 0x7880
50+
reg mie 0
51+
}
52+
53+
$_TARGETNAME.0 configure -event reset-init {
54+
echo "reset-init"
55+
56+
adapter speed 400
57+
reg mstatus 0x1880
58+
reg mie 0
59+
reg pc 0xA0000000
60+
}
61+
62+
$_TARGETNAME.0 configure -event gdb-attach {
63+
echo "Debugger attaching: halting execution"
64+
halt
65+
gdb_breakpoint_override hard
66+
}
67+
68+
$_TARGETNAME.0 configure -event gdb-detach {
69+
echo "Debugger detaching: resuming execution"
70+
resume
71+
}
72+
73+
gdb_memory_map enable
74+
gdb_flash_program enable
75+
76+
# 'progbuf', 'sysbus' or 'abstract'
77+
riscv set_mem_access sysbus
78+
riscv set_command_timeout_sec 1
79+
80+
init

0 commit comments

Comments
 (0)