Skip to content
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

Introduce Bouffalo Lab SoC's #78795

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b169a89
drivers: timer: Enable clic riscv machine timer
nandojve Aug 31, 2024
c71987d
west: Introduce hal bouffalo lab
nandojve Jul 18, 2021
0d79fd0
dts: bindings: vendor-prefixes: Add Bouffalo Lab prefix
nandojve Oct 14, 2024
60d4562
dts: riscv: bouffalolab: Add bl6 series cpu
nandojve Aug 3, 2021
5318a75
soc: riscv: bouffalolab: Add bl6 series cpu
nandojve Aug 3, 2021
d3ac8c9
soc: riscv: bouffalolab: Change to riscv-privileged
nandojve Jan 29, 2024
ba4daeb
drivers: pinctrl: bouffalolab: Add bflb pinctrl driver
nandojve Jan 27, 2024
784efc1
drivers: serial: bouffalolab: Add bflb serial driver
nandojve Aug 3, 2021
df8f88d
drivers: serial: bouffalolab: Add support to interrupts
nandojve Nov 11, 2021
b20d5ad
scripts: runner: Introduce blflash runner
nandojve Aug 7, 2021
2757196
boards: riscv: Introduce bl604e_iot_dvk
nandojve Apr 2, 2022
01828de
west.yml: Drop bouffalolab SDK dependency
VynDragon Aug 31, 2024
b45434d
soc: riscv: Rework bl60x to be SDK independent
VynDragon Aug 31, 2024
d032c73
dts: riscv: bouffalolab: Update bl60x series cpu
VynDragon Aug 31, 2024
902bb4e
drivers: pinctrl: bouffalolab: Update pinctrl driver
VynDragon Aug 31, 2024
dcaf4eb
drivers: gpio: bouffalolab: Add bflb gpio driver
VynDragon Aug 31, 2024
a32c5ce
drivers: serial: bouffalolab: Update serial driver
VynDragon Aug 31, 2024
3173294
scripts: runner: Introduce bflb_mcu_tool runner
VynDragon Aug 31, 2024
a699d4f
boards: riscv: bl604e_iot_dvk: Move to bl60x directory
nandojve Sep 9, 2024
5613e36
scripts: runner: Drop blflash in favor of bflb_mcu_tool
nandojve Sep 9, 2024
6cfc420
MAINTAINERS.yml: Add Bouffalo Lab entries
nandojve Sep 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
scripts: runner: Introduce bflb_mcu_tool runner
Add Bouffalo Lab ISP console flash runner.  This tool enable bootloader
to flash devices using serial port.

The blflash Rust tool can be found at
    https://pypi.org/project/bflb-mcu-tool

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
  • Loading branch information
VynDragon authored and nandojve committed Jan 5, 2025
commit 317329444ae460c719d0c955a99ba74d97b570ef
4 changes: 4 additions & 0 deletions boards/common/bflb_mcu_tool.board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

board_set_flasher_ifnset(bflb_mcu_tool)
board_finalize_runner_args(bflb_mcu_tool)
1 change: 1 addition & 0 deletions scripts/west_commands/runners/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def _import_runner_module(runner_name):

_names = [
# zephyr-keep-sorted-start
'bflb_mcu_tool',
'blackmagicprobe',
'blflash',
'bossac',
Expand Down
89 changes: 89 additions & 0 deletions scripts/west_commands/runners/bflb_mcu_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
#
# SPDX-License-Identifier: Apache-2.0

'''Runner for the Official Bouffalo Lab open source command-line flash tool (bflb-mcu-tool)'''

import shutil

from runners.core import RunnerCaps, ZephyrBinaryRunner

DEFAULT_PORT = '/dev/ttyUSB0'
DEFAULT_SPEED = '115200'
DEFAULT_CHIP = 'bl602'
BFLB_SDK_MODULE_NAME = 'hal_bouffalolab'
DEFAULT_EXECUTABLE = "bflb-mcu-tool"


class BlFlashCommandBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for bflb-mcu-tool.'''

def __init__(
self, cfg, port=DEFAULT_PORT, baudrate=DEFAULT_SPEED, chipname=DEFAULT_CHIP, erase=False
):
super().__init__(cfg)
self.port = port
self.baudrate = baudrate
self.chipname = chipname
self.erase = bool(erase)

@classmethod
def name(cls):
return 'bflb_mcu_tool'

@classmethod
def capabilities(cls):
return RunnerCaps(commands={'flash'}, erase=True)

@classmethod
def do_add_parser(cls, parser):
parser.add_argument(
'-p',
'--port',
default=DEFAULT_PORT,
help='serial port to use, default is ' + str(DEFAULT_PORT),
)
parser.add_argument(
'-b',
'--baudrate',
default=DEFAULT_SPEED,
help='serial port speed to use, default is ' + DEFAULT_SPEED,
)
parser.add_argument(
'-ch',
'--chipname',
default=DEFAULT_CHIP,
help='chip model, default is ' + DEFAULT_CHIP,
choices=['bl602', 'bl606p', 'bl616', 'bl702', 'bl702l', 'bl808'],
)

@classmethod
def do_create(cls, cfg, args):
print(args)
if shutil.which(DEFAULT_EXECUTABLE) is None:
raise ValueError(
"Couldnt find bflb-mcu-tool in PATH, please install with pip install \
bflb-mcu-tool"
)
return BlFlashCommandBinaryRunner(
cfg, port=args.port, baudrate=args.baudrate, chipname=args.chipname, erase=args.erase
)

def do_run(self, command, **kwargs):
self.ensure_output('bin')
cmd_flash = [
DEFAULT_EXECUTABLE,
'--interface',
'uart',
'--port',
self.port,
'--baudrate',
self.baudrate,
'--chipname',
self.chipname,
'--firmware',
self.cfg.bin_file,
]
if self.erase is True:
cmd_flash.append("--erase")
self.check_call(cmd_flash)
1 change: 1 addition & 0 deletions scripts/west_commands/tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_runner_imports():
expected = set((
# zephyr-keep-sorted-start
'arc-nsim',
'bflb_mcu_tool',
'blackmagicprobe',
'blflash',
'bossac',
Expand Down