@@ -141,8 +141,7 @@ Hints:
141
141
endif ()
142
142
endforeach ()
143
143
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)
146
145
message (WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. "
147
146
"Trying to find new location."
148
147
)
@@ -209,9 +208,8 @@ if(NOT "${ret_board}" STREQUAL "")
209
208
endforeach ()
210
209
211
210
# 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
215
213
set (HWM ${LIST_BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version" )
216
214
set (HWM${HWM} True CACHE INTERNAL "Zephyr hardware model" )
217
215
elseif (BOARD_DIR)
@@ -228,86 +226,67 @@ else()
228
226
message (FATAL_ERROR "Invalid BOARD; see above." )
229
227
endif ()
230
228
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
-
238
229
cmake_path(IS_PREFIX ZEPHYR_BASE "${BOARD_DIR} " NORMALIZE in_zephyr_tree)
239
230
if (NOT in_zephyr_tree)
240
231
set (USING_OUT_OF_TREE_BOARD 1)
241
232
endif ()
242
233
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" )
246
236
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 ()
275
238
if (EXISTS ${BOARD_DIR} /revision.cmake)
276
239
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 '"
278
241
)
279
242
endif ()
280
243
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'"
283
260
)
284
261
endif ()
285
262
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 ()
298
267
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} " )
307
278
endif ()
308
279
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 ()
311
290
endif ()
312
291
313
292
set (board_message "Board: ${BOARD} " )
0 commit comments