Skip to content

Commit 9f12f8a

Browse files
nordicjmfabiobaltieri
authored andcommitted
infrastructure: Remove hwmv1 support
Removes support for the deprecated hardware model version 1 Signed-off-by: Jamie McCrae <[email protected]>
1 parent 4bb5ffd commit 9f12f8a

23 files changed

+131
-387
lines changed

arch/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Include these first so that any properties (e.g. defaults) below can be
99
# overridden (by defining symbols in multiple locations)
1010

11-
source "$(ARCH_DIR)/Kconfig.$(HWM_SCHEME)"
11+
source "$(KCONFIG_BINARY_DIR)/arch/Kconfig"
1212

1313
# ToDo: Generate a Kconfig.arch for loading of additional arch in HWMv2.
1414
osource "$(KCONFIG_BINARY_DIR)/Kconfig.arch"

arch/Kconfig.v1

Lines changed: 0 additions & 5 deletions
This file was deleted.

arch/Kconfig.v2

Lines changed: 0 additions & 5 deletions
This file was deleted.

boards/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
config BOARD
44
string
5-
# When using hw model v2, then the board is inherited from CMake.
6-
default "$(BOARD)" if "$(HWM_SCHEME)" = "v2"
5+
default "$(BOARD)"
76
help
87
This option holds the name of the board and is used to locate the files
98
related to the board in the source tree (under boards/).
@@ -53,7 +52,7 @@ config NET_DRIVERS
5352
When building for a qemu target then NET_DRIVERS will be default
5453
enabled to allow for easy use of SLIP or PPP
5554

56-
rsource "Kconfig.$(HWM_SCHEME)"
55+
rsource "Kconfig.v2"
5756

5857
# Parse shields references
5958
# Don't do it as a menuconfig, as shield selection is a CMake feature.

boards/Kconfig.v1

Lines changed: 0 additions & 14 deletions
This file was deleted.
File renamed without changes.

cmake/modules/arch_v1.cmake

Lines changed: 0 additions & 54 deletions
This file was deleted.

cmake/modules/boards.cmake

Lines changed: 47 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ Hints:
141141
endif()
142142
endforeach()
143143

144-
if((HWMv1 AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig)
145-
OR (HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml))
144+
if(HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml)
146145
message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. "
147146
"Trying to find new location."
148147
)
@@ -209,9 +208,8 @@ if(NOT "${ret_board}" STREQUAL "")
209208
endforeach()
210209

211210
# Create two CMake variables identifying the hw model.
212-
# CMake variable: HWM=[v1,v2]
213-
# CMake variable: HWMv1=True, when HWMv1 is in use.
214-
# CMake variable: HWMv2=True, when HWMv2 is in use.
211+
# CMake variable: HWM=v2
212+
# CMake variable: HWMv2=True
215213
set(HWM ${LIST_BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version")
216214
set(HWM${HWM} True CACHE INTERNAL "Zephyr hardware model")
217215
elseif(BOARD_DIR)
@@ -228,86 +226,67 @@ else()
228226
message(FATAL_ERROR "Invalid BOARD; see above.")
229227
endif()
230228

231-
if(HWMv1 AND DEFINED BOARD_QUALIFIERS)
232-
message(FATAL_ERROR
233-
"Board '${BOARD}' does not support board qualifiers, ${BOARD}${BOARD_QUALIFIERS}.\n"
234-
"Please specify board without qualifiers.\n"
235-
)
236-
endif()
237-
238229
cmake_path(IS_PREFIX ZEPHYR_BASE "${BOARD_DIR}" NORMALIZE in_zephyr_tree)
239230
if(NOT in_zephyr_tree)
240231
set(USING_OUT_OF_TREE_BOARD 1)
241232
endif()
242233

243-
if(HWMv1)
244-
if(EXISTS ${BOARD_DIR}/revision.cmake)
245-
# Board provides revision handling.
234+
if(LIST_BOARD_REVISION_FORMAT)
235+
if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom")
246236
include(${BOARD_DIR}/revision.cmake)
247-
elseif(BOARD_REVISION)
248-
message(WARNING "Board revision ${BOARD_REVISION} specified for ${BOARD}, \
249-
but board has no revision so revision will be ignored.")
250-
endif()
251-
elseif(HWMv2)
252-
if(LIST_BOARD_REVISION_FORMAT)
253-
if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom")
254-
include(${BOARD_DIR}/revision.cmake)
255-
else()
256-
if(EXISTS ${BOARD_DIR}/revision.cmake)
257-
message(WARNING
258-
"revision.cmake ignored, revision.cmake is only used for revision format: 'custom'"
259-
)
260-
endif()
261-
262-
string(TOUPPER "${LIST_BOARD_REVISION_FORMAT}" rev_format)
263-
if(LIST_BOARD_REVISION_EXACT)
264-
set(rev_exact EXACT)
265-
endif()
266-
267-
board_check_revision(
268-
FORMAT ${rev_format}
269-
DEFAULT_REVISION ${LIST_BOARD_REVISION_DEFAULT}
270-
VALID_REVISIONS ${LIST_BOARD_REVISIONS}
271-
${rev_exact}
272-
)
273-
endif()
274-
elseif(DEFINED BOARD_REVISION)
237+
else()
275238
if(EXISTS ${BOARD_DIR}/revision.cmake)
276239
message(WARNING
277-
"revision.cmake is not used, revisions must be defined in '${BOARD_DIR}/board.yml'"
240+
"revision.cmake ignored, revision.cmake is only used for revision format: 'custom'"
278241
)
279242
endif()
280243

281-
message(FATAL_ERROR "Invalid board revision: ${BOARD_REVISION}\n"
282-
"Board '${BOARD}' does not define any revisions."
244+
string(TOUPPER "${LIST_BOARD_REVISION_FORMAT}" rev_format)
245+
if(LIST_BOARD_REVISION_EXACT)
246+
set(rev_exact EXACT)
247+
endif()
248+
249+
board_check_revision(
250+
FORMAT ${rev_format}
251+
DEFAULT_REVISION ${LIST_BOARD_REVISION_DEFAULT}
252+
VALID_REVISIONS ${LIST_BOARD_REVISIONS}
253+
${rev_exact}
254+
)
255+
endif()
256+
elseif(DEFINED BOARD_REVISION)
257+
if(EXISTS ${BOARD_DIR}/revision.cmake)
258+
message(WARNING
259+
"revision.cmake is not used, revisions must be defined in '${BOARD_DIR}/board.yml'"
283260
)
284261
endif()
285262

286-
if(LIST_BOARD_QUALIFIERS)
287-
# Allow users to omit the SoC when building for a board with a single SoC.
288-
list(LENGTH LIST_BOARD_SOCS socs_length)
289-
if(socs_length EQUAL 1)
290-
set(BOARD_SINGLE_SOC TRUE)
291-
set(BOARD_${BOARD}_SINGLE_SOC TRUE)
292-
if(NOT DEFINED BOARD_QUALIFIERS)
293-
set(BOARD_QUALIFIERS "/${LIST_BOARD_SOCS}")
294-
elseif("${BOARD_QUALIFIERS}" MATCHES "^//.*")
295-
string(REGEX REPLACE "^//" "/${LIST_BOARD_SOCS}/" BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
296-
endif()
297-
endif()
263+
message(FATAL_ERROR "Invalid board revision: ${BOARD_REVISION}\n"
264+
"Board '${BOARD}' does not define any revisions."
265+
)
266+
endif()
298267

299-
set(board_targets ${LIST_BOARD_QUALIFIERS})
300-
list(TRANSFORM board_targets PREPEND "${BOARD}/")
301-
if(NOT ("${BOARD}${BOARD_QUALIFIERS}" IN_LIST board_targets))
302-
string(REPLACE ";" "\n" board_targets "${board_targets}")
303-
unset(CACHED_BOARD CACHE)
304-
message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \
305-
`${BOARD}` not found. Please specify a valid board target.\n"
306-
"Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n")
268+
if(LIST_BOARD_QUALIFIERS)
269+
# Allow users to omit the SoC when building for a board with a single SoC.
270+
list(LENGTH LIST_BOARD_SOCS socs_length)
271+
if(socs_length EQUAL 1)
272+
set(BOARD_SINGLE_SOC TRUE)
273+
set(BOARD_${BOARD}_SINGLE_SOC TRUE)
274+
if(NOT DEFINED BOARD_QUALIFIERS)
275+
set(BOARD_QUALIFIERS "/${LIST_BOARD_SOCS}")
276+
elseif("${BOARD_QUALIFIERS}" MATCHES "^//.*")
277+
string(REGEX REPLACE "^//" "/${LIST_BOARD_SOCS}/" BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
307278
endif()
308279
endif()
309-
else()
310-
message(FATAL_ERROR "Unknown hw model (${HWM}) for board: ${BOARD}.")
280+
281+
set(board_targets ${LIST_BOARD_QUALIFIERS})
282+
list(TRANSFORM board_targets PREPEND "${BOARD}/")
283+
if(NOT ("${BOARD}${BOARD_QUALIFIERS}" IN_LIST board_targets))
284+
string(REPLACE ";" "\n" board_targets "${board_targets}")
285+
unset(CACHED_BOARD CACHE)
286+
message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \
287+
`${BOARD}` not found. Please specify a valid board target.\n"
288+
"Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n")
289+
endif()
311290
endif()
312291

313292
set(board_message "Board: ${BOARD}")

cmake/modules/kconfig.cmake

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,6 @@ set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig)
2424
set(KCONFIG_BOARD_DIR ${KCONFIG_BINARY_DIR}/boards)
2525
file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR})
2626

27-
if(HWMv1)
28-
# HWMv1 only supoorts a single board dir which points directly to the board dir.
29-
set(KCONFIG_BOARD_DIR ${BOARD_DIR})
30-
# Support multiple SOC_ROOT
31-
file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}/soc)
32-
set(kconfig_soc_root ${SOC_ROOT})
33-
list(REMOVE_ITEM kconfig_soc_root ${ZEPHYR_BASE})
34-
set(soc_defconfig_file ${KCONFIG_BINARY_DIR}/soc/Kconfig.defconfig)
35-
36-
set(OPERATION WRITE)
37-
foreach(root ${kconfig_soc_root})
38-
file(APPEND ${soc_defconfig_file}
39-
"osource \"${root}/soc/$(ARCH)/*/Kconfig.defconfig\"\n")
40-
file(${OPERATION} ${KCONFIG_BINARY_DIR}/soc/Kconfig.soc.choice
41-
"osource \"${root}/soc/$(ARCH)/*/Kconfig.soc\"\n"
42-
)
43-
file(${OPERATION} ${KCONFIG_BINARY_DIR}/soc/Kconfig.soc.arch
44-
"osource \"${root}/soc/$(ARCH)/Kconfig\"\n"
45-
"osource \"${root}/soc/$(ARCH)/*/Kconfig\"\n"
46-
)
47-
set(OPERATION APPEND)
48-
endforeach()
49-
endif()
50-
5127
# Support multiple shields in BOARD_ROOT, remove ZEPHYR_BASE as that is always sourced.
5228
set(kconfig_board_root ${BOARD_ROOT})
5329
list(REMOVE_ITEM kconfig_board_root ${ZEPHYR_BASE})
@@ -176,20 +152,13 @@ set(COMMON_KCONFIG_ENV_SETTINGS
176152
${ZEPHYR_KCONFIG_MODULES_DIR}
177153
)
178154

179-
if(HWMv1)
180-
list(APPEND COMMON_KCONFIG_ENV_SETTINGS
181-
ARCH=${ARCH}
182-
ARCH_DIR=${ARCH_DIR}
183-
)
184-
else()
185-
# For HWMv2 we should in future generate a Kconfig.arch.v2 which instead
186-
# glob-sources all arch roots, but for Zephyr itself, the current approach is
187-
# sufficient.
188-
list(APPEND COMMON_KCONFIG_ENV_SETTINGS
189-
ARCH=*
190-
ARCH_DIR=${ZEPHYR_BASE}/arch
191-
)
192-
endif()
155+
# For HWMv2 we should in future generate a Kconfig.arch.v2 which instead
156+
# glob-sources all arch roots, but for Zephyr itself, the current approach is
157+
# sufficient.
158+
list(APPEND COMMON_KCONFIG_ENV_SETTINGS
159+
ARCH=*
160+
ARCH_DIR=${ZEPHYR_BASE}/arch
161+
)
193162

194163
# Allow out-of-tree users to add their own Kconfig python frontend
195164
# targets by appending targets to the CMake list

cmake/modules/pre_dt.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,9 @@ function(pre_dt_module_run)
6060
# Finalize DTS_ROOT.
6161
list(REMOVE_DUPLICATES DTS_ROOT)
6262

63-
if(HWMv1)
64-
set(arch_include dts/${ARCH})
65-
else()
66-
foreach(arch ${ARCH_V2_NAME_LIST})
67-
list(APPEND arch_include dts/${arch})
68-
endforeach()
69-
endif()
63+
foreach(arch ${ARCH_V2_NAME_LIST})
64+
list(APPEND arch_include dts/${arch})
65+
endforeach()
7066

7167
# Finalize DTS_ROOT_SYSTEM_INCLUDE_DIRS.
7268
set(DTS_ROOT_SYSTEM_INCLUDE_DIRS)
File renamed without changes.

0 commit comments

Comments
 (0)