Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: improved board handling for revisions #68702

Merged

Conversation

tejlmand
Copy link
Collaborator

@tejlmand tejlmand commented Feb 7, 2024

This commit improves board handling for boards in HWMv2. On a CMake rerun, then BOARD_DIR is passed to list_boards.py which is extended to take such parameter.

This allows to run list_boards.py whenever CMake reruns without the penalty of searching for all board.yml files, as only the board.yml of the current BOARD_DIR is processed.

This allows list_boards.py to be invoked and from there obtain list of valid revisions and board identifiers for further board validation.

This removes the need for caching additional CMake variables related to the board identifier and revision and thereby remove the risk of settings becoming out of sync as only the board provided by user is needed.

This work further ensure that use-cases described in #50536 is still supported.

@tejlmand tejlmand requested review from nordicjm and 57300 February 7, 2024 15:18
Comment on lines +118 to 120
OR (HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml))
message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. "
"Trying to find new location."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but we should also handle the case where this board.yml still exists, but ${BOARD} is no longer in it. Hence, we'd need to redo the full search to find the board if it was moved to a different yaml.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but we should also handle the case where this board.yml still exists, but ${BOARD} is no longer in it.

that is handle, but is handled inside list_boards.py.
So in case board is removed, then CMake will fail with a board not valid.
If board is renamed (and properly deprecated in deprecated.cmake, then the new board name will be used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the case where the board has been moved, not removed or renamed. So far, this is caught if the cached ${BOARD_DIR}/board.yml doesn't exist, but imagine moving another board.yml in its place, with different boards.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should place a watch on that file for an update you mean? I think that's a reasonable request

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but imagine moving another board.yml in its place, with different boards.

so if board folder is named foo containing the board foo then you would move foo board to another place and instead move / update board.yml with the content of board bar without also renaming the board folder ?

Except for common names for qemu boards, then I don't see this as a very likely situation, although it shouldn't be hard to handle this use-case as should just use the board_list output failure, and re-run with no board dir arg.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a real possibility that there is a folder containing multiple boards and one of those boards is removed entirely or moved somewhere else, thus the boards.yml file is updated, the old location for the board has changed. This is not some rare occurrence

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and one of those boards is removed entirely

Which is handled, cause you get an error stating the removed board does not exists.

moved somewhere else

and in this case the error of the non-existing board this is imprecise.
A user will need to do a pristine build to pickup the new location.

This is not some rare occurrence

Guess it depends on your definition of rare.
And it's not like it isn't handled, if you read above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved error message added for this situation.

scripts/list_boards.py Outdated Show resolved Hide resolved
cmake/modules/boards.cmake Show resolved Hide resolved
@tejlmand tejlmand force-pushed the hwmv2_boards_handling_revision branch from 1283216 to 288ddcf Compare February 15, 2024 11:25
@nordicjm
Copy link
Collaborator

Need rebase

@tejlmand tejlmand force-pushed the hwmv2_boards_handling_revision branch 5 times, most recently from cb818b9 to 3062a4b Compare February 16, 2024 13:08
This commit improves board handling for boards in HWMv2.
On a CMake rerun, then BOARD_DIR is passed to `list_boards.py` which
is extended to take such parameter.

This allows to run `list_boards.py` whenever CMake reruns without the
penalty of searching for all board.yml files, as only the board.yml of
the current BOARD_DIR is processed.

This allows `list_boards.py` to be invoked and from there obtain list
of valid revisions and board identifiers for further board validation.

This removes the need for caching additional CMake variables related to
the board identifier and revision and thereby remove the risk of
settings becoming out of sync as only the board provided by user is
needed.

This work further ensure that use-cases described in zephyrproject-rtos#50536 is still
supported.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
@tejlmand tejlmand force-pushed the hwmv2_boards_handling_revision branch from 3062a4b to acba025 Compare February 16, 2024 13:26
@zephyrbot zephyrbot added the area: Twister Twister label Feb 16, 2024
@nashif nashif merged commit 240d35f into zephyrproject-rtos:collab-hwm Feb 19, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants