Skip to content

Commit

Permalink
scripts: west_commands: Fix west boards for SoC and arch in modules
Browse files Browse the repository at this point in the history
Fixes #71761

The `west boards` command parses extra BOARD_ROOTs from Zephyr modules,
so that the boards defined in those modules are automatically listed.

In HWMv2, OOT boards can be described in terms of OOT SoCs, which means
that extra SOC_ROOTs must also be provided. Otherwise, an error message
will be displayed when attempting to list all boards. Therefore, every
Zephyr module SOC_ROOT should be included as well.

In HWMv1 (deprecated), OOT boards can be defined in terms of OOT archs,
but module ARCH_ROOTs had never been included automatically. The fix for
this is long overdue, but it's included for symmetry.

Signed-off-by: Grzegorz Swiderski <[email protected]>
  • Loading branch information
57300 authored and aescolar committed Jul 5, 2024
1 parent c9708ff commit 7a10c7d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/west_commands/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,21 @@ def do_run(self, args, _):
else:
name_re = None

args.arch_roots = [ZEPHYR_BASE]
args.soc_roots = [ZEPHYR_BASE]
modules_board_roots = [ZEPHYR_BASE]
module_settings = {
'arch_root': [ZEPHYR_BASE],
'board_root': [ZEPHYR_BASE],
'soc_root': [ZEPHYR_BASE],
}

for module in zephyr_module.parse_modules(ZEPHYR_BASE, self.manifest):
board_root = module.meta.get('build', {}).get('settings', {}).get('board_root')
if board_root is not None:
modules_board_roots.append(Path(module.project) / board_root)

args.board_roots += modules_board_roots
for key in module_settings:
root = module.meta.get('build', {}).get('settings', {}).get(key)
if root is not None:
module_settings[key].append(Path(module.project) / root)

args.arch_roots += module_settings['arch_root']
args.board_roots += module_settings['board_root']
args.soc_roots += module_settings['soc_root']

for board in list_boards.find_boards(args):
if name_re is not None and not name_re.search(board.name):
Expand Down

0 comments on commit 7a10c7d

Please sign in to comment.