cmake: modules: boards: Fix board deprecation for HWMv2
Deprecating boards comes with similar challenges as with board aliases, since BOARD_DEPRECATED is also set after parsing BOARD as user input. With this patch, a deprecated board can be properly translated to a board with identifiers. This opens up the possibility of recording all legacy board names in `boards/deprecated.cmake`, such as: set(mps2_an521_remote_DEPRECATED mps2/an521/cpu1) Unlike with aliases, though, there are additional restrictions for building with BOARD=<deprecated>, which only makes this feature suitable for deprecating v1 boards: * BOARD=<deprecated>/<identifier> is never allowed. * BOARD=<deprecated>@<revision> is not allowed if the old board already corresponds to a new board revision: set(<deprecated>_DEPRECATED <new-board>@<new-revision>) Future enhancements will be needed for deprecating v2 boards. Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
This commit is contained in:
committed by
Carles Cufi
parent
dca54e000a
commit
105a2bae84
@@ -92,11 +92,30 @@ if(DEFINED ZEPHYR_BOARD_ALIASES)
|
|||||||
set(BOARD_IDENTIFIER ${BOARD_ALIAS_IDENTIFIER}${BOARD_IDENTIFIER})
|
set(BOARD_IDENTIFIER ${BOARD_ALIAS_IDENTIFIER}${BOARD_IDENTIFIER})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(${ZEPHYR_BASE}/boards/deprecated.cmake)
|
include(${ZEPHYR_BASE}/boards/deprecated.cmake)
|
||||||
if(${BOARD}_DEPRECATED)
|
if(${BOARD}_DEPRECATED)
|
||||||
set(BOARD_DEPRECATED ${BOARD} CACHE STRING "Deprecated board name, provided by user")
|
set(BOARD_DEPRECATED ${BOARD} CACHE STRING "Deprecated board name, provided by user")
|
||||||
set(BOARD ${${BOARD}_DEPRECATED})
|
parse_board_components(${BOARD}_DEPRECATED BOARD BOARD_DEPRECATED_REVISION BOARD_DEPRECATED_IDENTIFIER)
|
||||||
message(WARNING "Deprecated BOARD=${BOARD_DEPRECATED} name specified, board automatically changed to: ${BOARD}.")
|
message(WARNING "Deprecated BOARD=${BOARD_DEPRECATED} name specified, board automatically changed to: ${BOARD}.")
|
||||||
|
if(DEFINED BOARD_DEPRECATED_REVISION)
|
||||||
|
if(DEFINED BOARD_REVISION)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Invalid board revision: ${BOARD_REVISION}\n"
|
||||||
|
"Deprecated board '${BOARD_DEPRECATED}' is now implemented as a revision of another board "
|
||||||
|
"(${BOARD}@${BOARD_DEPRECATED_REVISION}), so the specified revision does not apply. "
|
||||||
|
"Please consult the documentation for '${BOARD}' to see how to build for the new board."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
set(BOARD_REVISION ${BOARD_DEPRECATED_REVISION})
|
||||||
|
endif()
|
||||||
|
if(DEFINED BOARD_IDENTIFIER)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Deprecated boards cannot have board identifiers: ${BOARD_DEPRECATED}${BOARD_IDENTIFIER}.\n"
|
||||||
|
"Please consult the documentation for '${BOARD}' to see how to build for the new board."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
set(BOARD_IDENTIFIER ${BOARD_DEPRECATED_IDENTIFIER})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
zephyr_boilerplate_watch(BOARD)
|
zephyr_boilerplate_watch(BOARD)
|
||||||
|
|||||||
Reference in New Issue
Block a user