Skip to content

Commit bf3105b

Browse files
committed
[nrf noup] build: fix TF-M version
The TF-M build system retrieves the latest tag to figure out the TF-M version. It ends up being wrong because for example as of TF-M 2.1.2 in the commit history the latest tag is TF-Mv2.1.0. We don't have tags from upstream, but for some reason still have some of them, which makes it confusing. Completely stop relying on the tags and only use TFM_VERSION_MANUAL as the version. This fixes the TF-M version printed on boot. Signed-off-by: Tomi Fontanilles <[email protected]>
1 parent 7e9fe7c commit bf3105b

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

cmake/version.cmake

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,9 @@
88
# The 'TFM_VERSION_MANUAL' is used for fallback when Git tags are not available
99
set(TFM_VERSION_MANUAL "2.1.2")
1010

11-
execute_process(COMMAND git describe --tags --always
12-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
13-
OUTPUT_VARIABLE TFM_VERSION_FULL
14-
OUTPUT_STRIP_TRAILING_WHITESPACE)
15-
16-
# In a repository cloned with --no-tags option TFM_VERSION_FULL will be a hash
17-
# only hence checking it for a tag format to accept as valid version.
18-
19-
string(FIND ${TFM_VERSION_FULL} "TF-M" TFM_TAG)
20-
if(TFM_TAG EQUAL -1)
21-
set(TFM_VERSION_FULL v${TFM_VERSION_MANUAL})
22-
endif()
11+
set(TFM_VERSION_FULL v${TFM_VERSION_MANUAL})
2312

2413
string(REGEX REPLACE "TF-M" "" TFM_VERSION_FULL ${TFM_VERSION_FULL})
2514
# remove a commit number
2615
string(REGEX REPLACE "-[0-9]+-g" "+" TFM_VERSION_FULL ${TFM_VERSION_FULL})
2716
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" TFM_VERSION ${TFM_VERSION_FULL})
28-
29-
# Check that manually set version is up to date
30-
if (NOT TFM_VERSION_MANUAL STREQUAL TFM_VERSION)
31-
message(WARNING "TFM_VERSION_MANUAL mismatches to actual TF-M version. Please update TFM_VERSION_MANUAL in cmake/version.cmake")
32-
endif()

0 commit comments

Comments
 (0)