Skip to content

Commit 5ffd6e4

Browse files
committed
scripts: west_commands: board_actions: add BICR generation action
Add an action to invoke bicrgen.py to generate the BICR hex file. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent d1d0657 commit 5ffd6e4

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

scripts/west_commands/ncs-board-actions.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@
44
import json
55
import os
66
import re
7+
import sys
78
from pathlib import Path
89

910
from west.commands import WestCommand
1011

1112

13+
SCRIPT_DIR = Path(__file__).absolute().parent
14+
BICRGEN = (
15+
SCRIPT_DIR.parents[2]
16+
/ "zephyr"
17+
/ "soc"
18+
/ "nordic"
19+
/ "nrf54h"
20+
/ "bicr"
21+
/ "bicrgen.py"
22+
)
23+
24+
1225
def soc_series_detect(board_dir):
1326
found_defconfig = None
1427
for defconfig in board_dir.glob("Kconfig.*"):
@@ -44,7 +57,10 @@ def do_add_parser(self, parser_adder):
4457
)
4558

4659
parser.add_argument(
47-
"-d", "--board-dir", type=Path, help="Target board directory"
60+
"-d",
61+
"--board-dir",
62+
type=Path,
63+
help="Target board directory (defaults to current working directory)",
4864
)
4965

5066
return parser
@@ -71,7 +87,23 @@ def do_run(self, args, unknown_args):
7187
"properties": {
7288
"providesJsonSchema": True,
7389
}
74-
}
90+
},
91+
{
92+
"name": "Generate BICR binary",
93+
"command": sys.executable,
94+
"args": [
95+
str(BICRGEN),
96+
"--svd",
97+
"${SVD_FILE}",
98+
"--input",
99+
str((board_dir / "bicr.json").resolve()),
100+
"--output",
101+
"${BICR_HEX_FILE}",
102+
],
103+
"properties": {
104+
"providesJsonSchema": False,
105+
}
106+
},
75107
]
76108
)
77109

0 commit comments

Comments
 (0)