-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Introduce Bouffalo Lab SoC's [patch 1] #84173
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
Merged
kartben
merged 8 commits into
zephyrproject-rtos:main
from
nandojve:bflb/bflb_upstream_v1
Apr 23, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
df28d8f
west: Introduce hal bouffalo lab
nandojve 44b939a
dts: bindings: vendor-prefixes: Add Bouffalo Lab prefix
nandojve 398fedd
dts: riscv: bouffalolab: Add bl60x series cpu
nandojve ada9ce3
soc: riscv: bouffalolab: Add bl60x series cpu
nandojve 2187a32
drivers: pinctrl: bouffalolab: Add bflb pinctrl driver
nandojve 35a401e
drivers: serial: bouffalolab: Add bflb serial driver
nandojve 2ce920b
boards: riscv: Introduce bl604e_iot_dvk
nandojve 2770da0
MAINTAINERS.yml: Add Bouffalo Lab entries
nandojve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
boards/bouffalolab/bl60x/bl604e_iot_dvk/Kconfig.bl604e_iot_dvk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright (c) 2022-2025 ATL Electronics | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config BOARD_BL604E_IOT_DVK | ||
| select SOC_BL604E20Q2I |
26 changes: 26 additions & 0 deletions
26
boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk-pinctrl.dtsi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright (c) 2021-2025 ATL Electronics | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <dt-bindings/pinctrl/bl604x-pinctrl.h> | ||
|
|
||
| &pinctrl { | ||
| uart0_default: uart0_default { | ||
| group1 { | ||
| pinmux = <GPIO7_UART0_RX>, | ||
| <GPIO16_UART0_TX>; | ||
| bias-pull-up; | ||
| input-schmitt-enable; | ||
| }; | ||
| }; | ||
|
|
||
| uart0_sleep: uart0_sleep { | ||
| group1 { | ||
| pinmux = <GPIO7_UART0_RX>, | ||
| <GPIO16_UART0_TX>; | ||
| bias-high-impedance; | ||
| }; | ||
| }; | ||
| }; |
52 changes: 52 additions & 0 deletions
52
boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (c) 2022-2025 ATL Electronics | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
|
|
||
| #include <bouffalolab/bl60x.dtsi> | ||
| #include "bl604e_iot_dvk-pinctrl.dtsi" | ||
|
|
||
| / { | ||
| model = "BL604E IOT DVK development board"; | ||
| compatible = "bflb,bl604"; | ||
|
|
||
| chosen { | ||
| zephyr,flash = &flash0; | ||
| zephyr,itcm = &itcm; | ||
| zephyr,dtcm = &dtcm; | ||
| zephyr,sram = &sram0; | ||
| zephyr,console = &uart0; | ||
| zephyr,shell-uart = &uart0; | ||
| }; | ||
| }; | ||
|
|
||
| &cpu0 { | ||
| clock-frequency = <DT_FREQ_M(192)>; | ||
| }; | ||
|
|
||
| &spi1 { | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
| reg = <0x4000b000 0x1000 0x23000000 0xc00000>; | ||
|
|
||
| flash0: flash@0 { | ||
| compatible = "issi,is25lp128", "jedec,spi-nor"; | ||
| status = "disabled"; | ||
| size = <DT_SIZE_M(128)>; | ||
| jedec-id = [96 60 18]; | ||
| reg = <0>; | ||
| spi-max-frequency = <DT_FREQ_M(133)>; | ||
| }; | ||
| }; | ||
|
|
||
| &uart0 { | ||
| status = "okay"; | ||
| current-speed = <115200>; | ||
|
|
||
| pinctrl-0 = <&uart0_default>; | ||
| pinctrl-1 = <&uart0_sleep>; | ||
| pinctrl-names = "default", "sleep"; | ||
| }; | ||
19 changes: 19 additions & 0 deletions
19
boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2022-2025 ATL Electronics | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| identifier: bl604e_iot_dvk | ||
| name: BL604E IOT DVK development board | ||
| type: mcu | ||
| arch: riscv | ||
| ram: 64 | ||
| toolchain: | ||
| - zephyr | ||
| testing: | ||
| ignore_tags: | ||
| - net | ||
| - bluetooth | ||
| supported: | ||
| - pinctrl | ||
| - uart | ||
| vendor: bflb |
9 changes: 9 additions & 0 deletions
9
boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk_defconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Copyright (c) 2022-2025 ATL Electronics | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| CONFIG_CONSOLE=y | ||
| CONFIG_SERIAL=y | ||
|
|
||
| CONFIG_UART_CONSOLE=y | ||
| CONFIG_UART_BFLB=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright (c) 2022-2025 ATL Electronics | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| board_runner_args(openocd --cmd-pre-init "source [find bl60x.cfg]") | ||
|
|
||
| board_runner_args(openocd --use-elf --no-load --no-init) | ||
| board_runner_args(openocd --gdb-init "set mem inaccessible-by-default off") | ||
| board_runner_args(openocd --gdb-init "set architecture riscv:rv32") | ||
| board_runner_args(openocd --gdb-init "set remotetimeout 250") | ||
| board_runner_args(openocd --gdb-init "set print asm-demangle on") | ||
| board_runner_args(openocd --gdb-init "set backtrace limit 32") | ||
| board_runner_args(openocd --gdb-init "mem 0x22008000 0x22014000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x42008000 0x42014000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x22014000 0x22020000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x42014000 0x42020000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x22020000 0x2203C000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x42020000 0x4203C000 rw") | ||
| board_runner_args(openocd --gdb-init "mem 0x23000000 0x23400000 ro") | ||
| include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| board: | ||
| name: bl604e_iot_dvk | ||
| full_name: BL604E IOT DVK development board | ||
| vendor: bflb | ||
| socs: | ||
| - name: bl604e20q2i |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| .. zephyr:board:: bl604e_iot_dvk | ||
|
|
||
| Overview | ||
| ******** | ||
|
|
||
| BL602/BL604 is a Wi-Fi+BLE chipset introduced by Bouffalo Lab, which is used | ||
| for low power consumption and high performance application development. The | ||
| wireless subsystem includes 2.4G radio, Wi-Fi 802.11b/g/n and BLE 5.0 | ||
| baseband/MAC design. The microcontroller subsystem includes a 32-bit RISC CPU | ||
| with low power consumption, cache and memory. The power management unit | ||
| controls the low power consumption mode. In addition, it also supports | ||
| various security features. The external interfaces include SDIO, SPI, UART, | ||
| I2C, IR remote, PWM, ADC, DAC, PIR and GPIO. | ||
|
|
||
| The BL602 Development Board features a SiFive E24 32 bit RISC-V CPU with FPU, | ||
| it supports High Frequency clock up to 192Mhz, have 128k ROM, 276kB RAM, | ||
| 2.4 GHz WIFI 1T1R mode, support 20 MHz, data rate up to 72.2 Mbps, BLE 5.0 | ||
| with 2MB phy. It is a secure MCU which supports Secure boot, ECC-256 signed | ||
| image, QSPI/SPI Flash On-The-Fly AES Decryption and PKA (Public Key | ||
| Accelerator). | ||
|
|
||
| Hardware | ||
| ******** | ||
|
|
||
| For more information about the Bouffalo Lab BL-60x MCU: | ||
|
|
||
| - `Bouffalo Lab BL60x MCU Website`_ | ||
| - `Bouffalo Lab BL60x MCU Datasheet`_ | ||
| - `Bouffalo Lab Development Zone`_ | ||
| - `The RISC-V BL602 Book`_ | ||
|
|
||
| Supported Features | ||
| ================== | ||
|
|
||
| .. zephyr:board-supported-hw:: | ||
|
|
||
| The default configuration can be found in the Kconfig | ||
| :zephyr_file:`boards/bouffalolab/bl60x/bl604e_iot_dvk/bl604e_iot_dvk_defconfig`. | ||
|
|
||
| System Clock | ||
| ============ | ||
|
|
||
| The BL604E Development Board is configured to run at max speed (192MHz). | ||
|
|
||
| Serial Port | ||
| =========== | ||
|
|
||
| The ``bl604e_iot_dvk`` board uses UART0 as default serial port. It is connected | ||
| to USB Serial converter and port is used for both program and console. | ||
|
|
||
|
|
||
| Programming and Debugging | ||
| ************************* | ||
|
|
||
| Samples | ||
| ======= | ||
|
|
||
| #. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample | ||
| application: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/hello_world | ||
| :board: bl604e_iot_dvk | ||
| :goals: build flash | ||
|
|
||
| #. Run your favorite terminal program to listen for output. Under Linux the | ||
| terminal should be :code:`/dev/ttyACM0`. For example: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| $ minicom -D /dev/ttyACM0 -o | ||
|
|
||
| The -o option tells minicom not to send the modem initialization | ||
| string. Connection should be configured as follows: | ||
|
|
||
| - Speed: 115200 | ||
| - Data: 8 bits | ||
| - Parity: None | ||
| - Stop bits: 1 | ||
|
|
||
| Then, press and release RST button | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| *** Booting Zephyr OS build v4.1.0 *** | ||
| Hello World! bl604e_iot_dvk/bl604e20q2i | ||
|
|
||
| Congratulations, you have ``bl604e_iot_dvk`` configured and running Zephyr. | ||
|
|
||
|
|
||
| .. _Bouffalo Lab BL60x MCU Website: | ||
| https://en.bouffalolab.com/product/?type=detail&id=6 | ||
|
|
||
| .. _Bouffalo Lab BL60x MCU Datasheet: | ||
| https://github.com/bouffalolab/bl_docs/tree/main/BL602_DS/en | ||
|
|
||
| .. _Bouffalo Lab Development Zone: | ||
| https://dev.bouffalolab.com/home?id=guest | ||
|
|
||
| .. _The RISC-V BL602 Book: | ||
| https://lupyuen.github.io/articles/book | ||
|
|
||
| .. _Flashing Firmware to BL602: | ||
| https://lupyuen.github.io/articles/book#flashing-firmware-to-bl602 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Copyright (c) 2022-2025 ATL Electronics | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| if { [info exists CHIPNAME] } { | ||
| set _CHIPNAME $CHIPNAME | ||
| } else { | ||
| set _CHIPNAME riscv | ||
| } | ||
|
|
||
| if { [info exists WORKAREASIZE] } { | ||
| set _WORKAREASIZE $WORKAREASIZE | ||
| } else { | ||
| set _WORKAREASIZE 0x10000 | ||
| } | ||
|
|
||
| if { [info exists WORKAREAADDR] } { | ||
| set _WORKAREAADDR $WORKAREAADDR | ||
| } else { | ||
| set _WORKAREAADDR 0x22020000 | ||
| } | ||
|
|
||
| if { [info exists CPUTAPID] } { | ||
| set _CPUTAPID $CPUTAPID | ||
| } else { | ||
| set _CPUTAPID 0x20000c05 | ||
| } | ||
|
|
||
| transport select jtag | ||
| jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID | ||
|
|
||
| set _TARGETNAME $_CHIPNAME.cpu | ||
| target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME | ||
|
|
||
| $_TARGETNAME.0 configure -work-area-phys $_WORKAREAADDR -work-area-size $_WORKAREASIZE -work-area-backup 1 | ||
|
|
||
| echo "Ready for Remote Connections" | ||
|
|
||
| $_TARGETNAME.0 configure -event reset-assert-pre { | ||
| echo "reset-assert-pre" | ||
| adapter speed 100 | ||
| } | ||
|
|
||
| $_TARGETNAME.0 configure -event reset-deassert-post { | ||
| echo "reset-deassert-post" | ||
|
|
||
| adapter speed 100 | ||
|
|
||
| reg mstatus 0x7800 | ||
| reg mie 0x0 | ||
| # reg pc 0x23000000 | ||
| } | ||
|
|
||
| $_TARGETNAME.0 configure -event reset-init { | ||
| echo "reset-init" | ||
|
|
||
| adapter speed 3000 | ||
| } | ||
|
|
||
| $_TARGETNAME.0 configure -event gdb-attach { | ||
| echo "Debugger attaching: halting execution" | ||
| reset halt | ||
| gdb_breakpoint_override hard | ||
| } | ||
|
|
||
| $_TARGETNAME.0 configure -event gdb-detach { | ||
| echo "Debugger detaching: resuming execution" | ||
| resume | ||
| } | ||
|
|
||
| gdb_memory_map enable | ||
| gdb_flash_program enable | ||
|
|
||
| # 'progbuf', 'sysbus' or 'abstract' | ||
| riscv set_mem_access sysbus | ||
| riscv set_command_timeout_sec 1 | ||
|
|
||
| init | ||
| reset init |
19 changes: 19 additions & 0 deletions
19
boards/bouffalolab/bl60x/bl604e_iot_dvk/support/openocd.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # OpenOCD Script for PineCone connected via Sipeed JTAG Debugger (FTDI FT2232D) | ||
| # Ref: bl_iot_sdk/tools/debug/if_bflb_link.cfg | ||
| # source [find interface/if_bflb_link.cfg] | ||
|
|
||
| # Uncomment to enable debug messages | ||
| # debug_level 4 | ||
|
|
||
| # BouffaloLab USB-JTAG/TTL adapter | ||
| # Or Sipeed JTAG Debugger based on FTDI FT2232D | ||
|
|
||
| adapter driver ftdi | ||
| ftdi vid_pid 0x0403 0x6010 | ||
|
|
||
| # Sipeed JTAG Debugger uses FTDI Channel 0, not 1 | ||
| ftdi channel 0 | ||
| # ftdi_channel 1 | ||
|
|
||
| ftdi layout_init 0x00f8 0x00fb | ||
| adapter speed 4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| .. _boards-bouffalolab: | ||
|
|
||
| Bouffalo Lab Intelligent Technology (Nanjing) Co., Ltd. | ||
| ####################################################### | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 1 | ||
| :glob: | ||
|
|
||
| **/* |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.