Skip to content

Commit

Permalink
scripts: west_commands: board_actions: add BICR generation action
Browse files Browse the repository at this point in the history
Add an action to invoke bicrgen.py to generate the BICR hex file.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
  • Loading branch information
gmarull committed Nov 26, 2024
1 parent 17c17a2 commit 0d063a5
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions scripts/west_commands/ncs-board-actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
import json
import os
import re
import sys
from pathlib import Path

from west.commands import WestCommand


SCRIPT_DIR = Path(__file__).absolute().parent
BICRGEN = (
SCRIPT_DIR.parents[2]
/ "zephyr"
/ "soc"
/ "nordic"
/ "nrf54h"
/ "bicr"
/ "bicrgen.py"
)


def soc_series_detect(board_dir):
found_defconfig = None
for defconfig in board_dir.glob("Kconfig.*"):
Expand Down Expand Up @@ -44,7 +57,10 @@ def do_add_parser(self, parser_adder):
)

parser.add_argument(
"-d", "--board-dir", type=Path, help="Target board directory"
"-d",
"--board-dir",
type=Path,
help="Target board directory (defaults to current working directory)",
)

return parser
Expand All @@ -68,7 +84,20 @@ def do_run(self, args, unknown_args):
"name": "Create/Edit BICR",
"command": "west",
"args": ["ncs-bicr", "--board-dir", str(board_dir.resolve())],
}
},
{
"name": "Generate BICR binary",
"command": sys.executable,
"args": [
str(BICRGEN),
"--svd",
"${SVD_FILE}",
"--input",
str((board_dir / "bicr.json").resolve()),
"--output",
"${BICR_HEX_FILE}",
],
},
]
)

Expand Down

0 comments on commit 0d063a5

Please sign in to comment.