Summary
When a board's board.yml uses revision.format: number with exact: false, the fuzzy (fallback) revision matching silently fails and reports "Board revision not found" even when a valid lower revision exists.
Environment
-
nRF Connect SDK: v3.2.1
-
File:
zephyr/cmake/modules/extensions.cmake, functionboard_check_revision() -
Affected format:
number -
Not affected:
major.minor.patch,letter
Root Cause
In the fallback loop, the NUMBER branch uses CMake's GREATER operator — an integer comparison — to find the closest revision not exceeding the requested one:
elseif((BOARD_REV_FORMAT STREQUAL NUMBER) AND
(${BOARD_REVISION} GREATER ${TEST_REVISION}) AND
(${TEST_REVISION} GREATER "${ACTIVE_BOARD_REVISION}")
)
set(ACTIVE_BOARD_REVISION ${TEST_REVISION})
endif()The problem is that ACTIVE_BOARD_REVISION must be initialized to a sentinel value before the loop so the first valid candidate can always satisfy the GREATER condition. For integer comparison, the correct sentinel is -1:
set(ACTIVE_BOARD_REVISION -1)
"${ACTIVE_BOARD_REVISION}" expands to an empty string "". CMake's GREATER performs integer arithmetic and cannot parse an empty string as a number, so ${TEST_REVISION} GREATER "" evaluates to FALSE. The condition never fires, no ACTIVE_BOARD_REVISION is set, and the build aborts.