Skip to content

Commit

Permalink
cmake: deprecation of board names
Browse files Browse the repository at this point in the history
This commit introduces boards/deprecated.cmake to allow deprecation
of existing boards, when a board is renamed.

This allows users to still specify the old board name, and let Zephyr
build system to select the new board name.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
  • Loading branch information
tejlmand authored and carlescufi committed Mar 24, 2020
1 parent f3807f1 commit 1bc640b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
/boards/arm/stm32f3_disco/ @ydamigos
/boards/arm/stm32*_eval/ @erwango
/boards/common/ @mbolivar-nordic
/boards/deprecated.cmake @tejlmand
/boards/nios2/ @wentongwu
/boards/nios2/altera_max10/ @wentongwu
/boards/arm/stm32_min_dev/ @cbsiddharth
Expand Down
11 changes: 11 additions & 0 deletions boards/deprecated.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

# This file contains boards in Zephyr which has been replaced with a new board
# name.
# This allows the system to automatically change the board while at the same
# time prints a warning to the user, that the board name is deprecated.
#
# To add a board rename, add a line in following format:
# set(<old_board_name>_DEPRECATED <new_board_name>)

set(nrf51_pca10028_DEPRECATED nrf51dk_nrf51422)
9 changes: 8 additions & 1 deletion cmake/app/boilerplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if(CACHED_BOARD)
# Warn the user if it looks like he is trying to change the board
# without cleaning first
if(board_cli_argument)
if(NOT (CACHED_BOARD STREQUAL board_cli_argument))
if(NOT ((CACHED_BOARD STREQUAL board_cli_argument) OR (BOARD_DEPRECATED STREQUAL board_cli_argument)))
message(WARNING "The build directory must be cleaned pristinely when changing boards")
# TODO: Support changing boards without requiring a clean build
endif()
Expand All @@ -181,6 +181,13 @@ endif()
assert(BOARD "BOARD not set")
message(STATUS "Board: ${BOARD}")

include(${ZEPHYR_BASE}/boards/deprecated.cmake)
if(${BOARD}_DEPRECATED)
set(BOARD_DEPRECATED ${BOARD} CACHE STRING "Deprecated board name, provided by user")
set(BOARD ${${BOARD}_DEPRECATED})
message(WARNING "Deprecated BOARD=${BOARD_DEPRECATED} name specified, board automatically changed to: ${BOARD}.")
endif()

# Store the selected board in the cache
set(CACHED_BOARD ${BOARD} CACHE STRING "Selected board")

Expand Down

0 comments on commit 1bc640b

Please sign in to comment.