cmake: modules: boards: Enhance board aliases for HWMv2
To address concerns about lengthy board identifiers in HWMv2, the
proposal is to apply the existing BOARD_ALIAS feature, like so:
set(<alias>_BOARD_ALIAS <board>/<soc>)
It should then be possible to build with either:
-DBOARD=<alias> # expands to <board>/<soc>
-DBOARD=<alias>/<variant> # expands to <board>/<soc>/<variant>
However, this wouldn't work out of the box. A board alias can only be
expanded to a board name, without revision or identifier, because the
alias substitution happens after having parsed BOARD as user input -
namely, into BOARD (name), BOARD_REVISION, and BOARD_IDENTIFIER.
Furthermore, this means that in the legacy model, it was possible to
build with `-DBOARD=<alias>@<revision>`, and it would resolve to the
actual board name + revision.
To support both the old and new use cases, we can parse the alias just
like BOARD itself, then concatenate their identifiers as shown above.
Adding a revision works as before, but now it is also possible for the
alias to set its own revision. In this example:
set(<alias>_BOARD_ALIAS <board>@<rev-A>/<soc>/<variant>)
`<rev-A>` is treated as the default revision, and it can be overridden:
-DBOARD=<alias> # expands to <board>@<rev-A>/<soc>/<variant>
-DBOARD=<alias>@<rev-B> # expands to <board>@<rev-B>/<soc>/<variant>
Signed-off-by:
Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
Loading
Please sign in to comment