Skip to content

Commit 3ba74ac

Browse files
committed
boards: riscv: Introduce bl604e_iot_dvk
Add initial version. Signed-off-by: Gerson Fernando Budke <[email protected]>
1 parent b0f865b commit 3ba74ac

File tree

12 files changed

+350
-0
lines changed

12 files changed

+350
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2022-2025 ATL Electronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config BOARD_BL604E_IOT_DVK
6+
select SOC_BL604E20Q2I
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2021-2025 ATL Electronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/bl604x-pinctrl.h>
8+
9+
&pinctrl {
10+
uart0_default: uart0_default {
11+
group1 {
12+
pinmux = <GPIO7_UART0_RX>,
13+
<GPIO16_UART0_TX>;
14+
bias-pull-up;
15+
input-schmitt-enable;
16+
};
17+
};
18+
19+
uart0_sleep: uart0_sleep {
20+
group1 {
21+
pinmux = <GPIO7_UART0_RX>,
22+
<GPIO16_UART0_TX>;
23+
bias-high-impedance;
24+
};
25+
};
26+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2022-2025 ATL Electronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <bouffalolab/bl60x.dtsi>
10+
#include "bl604e_iot_dvk-pinctrl.dtsi"
11+
12+
/ {
13+
model = "BL604E IOT DVK development board";
14+
compatible = "bflb,bl604";
15+
16+
chosen {
17+
zephyr,flash = &flash0;
18+
zephyr,itcm = &itcm;
19+
zephyr,dtcm = &dtcm;
20+
zephyr,sram = &sram0;
21+
zephyr,console = &uart0;
22+
zephyr,shell-uart = &uart0;
23+
};
24+
};
25+
26+
&cpu0 {
27+
clock-frequency = <DT_FREQ_M(192)>;
28+
};
29+
30+
&spi1 {
31+
#address-cells = <1>;
32+
#size-cells = <0>;
33+
reg = <0x4000b000 0x1000 0x23000000 0xc00000>;
34+
35+
flash0: flash@0 {
36+
compatible = "issi,is25lp128", "jedec,spi-nor";
37+
status = "disabled";
38+
size = <DT_SIZE_M(128)>;
39+
jedec-id = [96 60 18];
40+
reg = <0>;
41+
spi-max-frequency = <DT_FREQ_M(133)>;
42+
};
43+
};
44+
45+
&uart0 {
46+
status = "okay";
47+
current-speed = <115200>;
48+
49+
pinctrl-0 = <&uart0_default>;
50+
pinctrl-1 = <&uart0_sleep>;
51+
pinctrl-names = "default", "sleep";
52+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2022-2025 ATL Electronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
identifier: bl604e_iot_dvk
6+
name: BL604E IOT DVK development board
7+
type: mcu
8+
arch: riscv
9+
ram: 64
10+
toolchain:
11+
- zephyr
12+
testing:
13+
ignore_tags:
14+
- net
15+
- bluetooth
16+
supported:
17+
- pinctrl
18+
- uart
19+
vendor: bflb
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2022-2025 ATL Electronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
CONFIG_CONSOLE=y
6+
CONFIG_SERIAL=y
7+
8+
CONFIG_UART_CONSOLE=y
9+
CONFIG_UART_BFLB=y
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2022-2025 ATL Electronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
board_runner_args(openocd --cmd-pre-init "source [find bl60x.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 0x22008000 0x22014000 rw")
14+
board_runner_args(openocd --gdb-init "mem 0x42008000 0x42014000 rw")
15+
board_runner_args(openocd --gdb-init "mem 0x22014000 0x22020000 rw")
16+
board_runner_args(openocd --gdb-init "mem 0x42014000 0x42020000 rw")
17+
board_runner_args(openocd --gdb-init "mem 0x22020000 0x2203C000 rw")
18+
board_runner_args(openocd --gdb-init "mem 0x42020000 0x4203C000 rw")
19+
board_runner_args(openocd --gdb-init "mem 0x23000000 0x23400000 ro")
20+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: bl604e_iot_dvk
3+
full_name: BL604E IOT DVK development board
4+
vendor: bflb
5+
socs:
6+
- name: bl604e20q2i
75.1 KB
Loading
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
.. zephyr:board:: bl604e_iot_dvk
2+
3+
Overview
4+
********
5+
6+
BL602/BL604 is a Wi-Fi+BLE chipset introduced by Bouffalo Lab, which is used
7+
for low power consumption and high performance application development. The
8+
wireless subsystem includes 2.4G radio, Wi-Fi 802.11b/g/n and BLE 5.0
9+
baseband/MAC design. The microcontroller subsystem includes a 32-bit RISC CPU
10+
with low power consumption, cache and memory. The power management unit
11+
controls the low power consumption mode. In addition, it also supports
12+
various security features. The external interfaces include SDIO, SPI, UART,
13+
I2C, IR remote, PWM, ADC, DAC, PIR and GPIO.
14+
15+
The BL602 Development Board features a SiFive E24 32 bit RISC-V CPU with FPU,
16+
it supports High Frequency clock up to 192Mhz, have 128k ROM, 276kB RAM,
17+
2.4 GHz WIFI 1T1R mode, support 20 MHz, data rate up to 72.2 Mbps, BLE 5.0
18+
with 2MB phy. It is a secure MCU which supports Secure boot, ECC-256 signed
19+
image, QSPI/SPI Flash On-The-Fly AES Decryption and PKA (Public Key
20+
Accelerator).
21+
22+
Hardware
23+
********
24+
25+
For more information about the Bouffalo Lab BL-60x MCU:
26+
27+
- `Bouffalo Lab BL60x MCU Website`_
28+
- `Bouffalo Lab BL60x MCU Datasheet`_
29+
- `Bouffalo Lab Development Zone`_
30+
- `The RISC-V BL602 Book`_
31+
32+
Supported Features
33+
==================
34+
35+
.. zephyr:board-supported-hw::
36+
37+
The default configuration can be found in the Kconfig
38+
:zephyr_file:`boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk_defconfig`.
39+
40+
System Clock
41+
============
42+
43+
The BL604E Development Board is configured to run at max speed (192MHz).
44+
45+
Serial Port
46+
===========
47+
48+
The ``bl604e_iot_dvk`` board uses UART0 as default serial port. It is connected
49+
to USB Serial converter and port is used for both program and console.
50+
51+
52+
Programming and Debugging
53+
*************************
54+
55+
Samples
56+
=======
57+
58+
#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample
59+
application:
60+
61+
.. zephyr-app-commands::
62+
:zephyr-app: samples/hello_world
63+
:board: bl604e_iot_dvk
64+
:goals: build flash
65+
66+
#. Run your favorite terminal program to listen for output. Under Linux the
67+
terminal should be :code:`/dev/ttyACM0`. For example:
68+
69+
.. code-block:: console
70+
71+
$ minicom -D /dev/ttyACM0 -o
72+
73+
The -o option tells minicom not to send the modem initialization
74+
string. Connection should be configured as follows:
75+
76+
- Speed: 115200
77+
- Data: 8 bits
78+
- Parity: None
79+
- Stop bits: 1
80+
81+
Then, press and release RST button
82+
83+
.. code-block:: console
84+
85+
*** Booting Zephyr OS build v4.1.0 ***
86+
Hello World! bl604e_iot_dvk/bl604e20q2i
87+
88+
Congratulations, you have ``bl604e_iot_dvk`` configured and running Zephyr.
89+
90+
91+
.. _Bouffalo Lab BL60x MCU Website:
92+
https://en.bouffalolab.com/product/?type=detail&id=6
93+
94+
.. _Bouffalo Lab BL60x MCU Datasheet:
95+
https://github.com/bouffalolab/bl_docs/tree/main/BL602_DS/en
96+
97+
.. _Bouffalo Lab Development Zone:
98+
https://dev.bouffalolab.com/home?id=guest
99+
100+
.. _The RISC-V BL602 Book:
101+
https://lupyuen.github.io/articles/book
102+
103+
.. _Flashing Firmware to BL602:
104+
https://lupyuen.github.io/articles/book#flashing-firmware-to-bl602
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright (c) 2022-2025 ATL Electronics
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 0x22020000
21+
}
22+
23+
if { [info exists CPUTAPID] } {
24+
set _CPUTAPID $CPUTAPID
25+
} else {
26+
set _CPUTAPID 0x20000c05
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 1
36+
37+
echo "Ready for Remote Connections"
38+
39+
$_TARGETNAME.0 configure -event reset-assert-pre {
40+
echo "reset-assert-pre"
41+
adapter speed 100
42+
}
43+
44+
$_TARGETNAME.0 configure -event reset-deassert-post {
45+
echo "reset-deassert-post"
46+
47+
adapter speed 100
48+
49+
reg mstatus 0x7800
50+
reg mie 0x0
51+
# reg pc 0x23000000
52+
}
53+
54+
$_TARGETNAME.0 configure -event reset-init {
55+
echo "reset-init"
56+
57+
adapter speed 3000
58+
}
59+
60+
$_TARGETNAME.0 configure -event gdb-attach {
61+
echo "Debugger attaching: halting execution"
62+
reset halt
63+
gdb_breakpoint_override hard
64+
}
65+
66+
$_TARGETNAME.0 configure -event gdb-detach {
67+
echo "Debugger detaching: resuming execution"
68+
resume
69+
}
70+
71+
gdb_memory_map enable
72+
gdb_flash_program enable
73+
74+
# 'progbuf', 'sysbus' or 'abstract'
75+
riscv set_mem_access sysbus
76+
riscv set_command_timeout_sec 1
77+
78+
init
79+
reset init

0 commit comments

Comments
 (0)