Skip to content

Commit 235b7b5

Browse files
committed
boards: custom_plank: Add demo out-of-tree runner
Demonstrate how to use an out-of-tree runner with the custom_plank board. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent b2d670a commit 235b7b5

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

boards/vendor/custom_plank/board.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
board_runner_args(jlink "--device=nrf52" "--speed=4000")
55
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
6+
board_runner_args(example "--param=custom_plank")
67

78
set(OPENOCD_NRF5_SUBFAMILY "nrf52")
89

910
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
1011
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
1112
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
1213
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
14+
include(${CMAKE_CURRENT_LIST_DIR}/example_runner.board.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
board_set_sim_runner_ifnset(example)
4+
board_finalize_runner_args(example) # No default arguments to provide.

scripts/example_runner.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2024 Basalte bv
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
from runners.core import RunnerCaps, ZephyrBinaryRunner
6+
7+
8+
class ExampleRunner(ZephyrBinaryRunner):
9+
"""Dummy example runner."""
10+
11+
def __init__(self, cfg, param):
12+
super().__init__(cfg)
13+
self.param = param
14+
15+
@classmethod
16+
def name(cls):
17+
return "example"
18+
19+
@classmethod
20+
def capabilities(cls):
21+
return RunnerCaps(commands=({"simulate"}))
22+
23+
@classmethod
24+
def do_add_parser(cls, parser):
25+
parser.add_argument("--param", action="store", help="An example parameter")
26+
27+
@classmethod
28+
def do_create(cls, cfg, args):
29+
return cls(cfg, param=args.param)
30+
31+
def do_run(self, command, **kwargs):
32+
self.logger.info(f"Running {command} on {self.param}")

west.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ manifest:
1212
projects:
1313
- name: zephyr
1414
remote: zephyrproject-rtos
15-
revision: main
15+
revision: pull/83190/head
1616
import:
1717
# By using name-allowlist we can clone only the modules that are
1818
# strictly needed by the application.

zephyr/module.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ build:
1818
# `<dts_root>/dts/bindings` for additional dts binding files. The `.` is
1919
# the root of this repository.
2020
dts_root: .
21+
runners:
22+
# Additional runners, Zephyr will import these when discovering
23+
# subclasses of the `ZephyrBinaryRunner` class.
24+
- file: scripts/example_runner.py

0 commit comments

Comments
 (0)