cmake: armfvp: Improve the FVP version check

Print a warning message on 'west build -t run', if the FVP does not meet
the minimal requirement. The check acts as a reminder instead of an
entrance guard. So, the check won't stop executing the FVP program.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This commit is contained in:
Jaxson Han 2022-03-15 17:37:39 +08:00 committed by Maureen Helm
commit 1a682680a7

View file

@ -10,7 +10,7 @@ find_program(
NAMES ${ARMFVP_BIN_NAME} NAMES ${ARMFVP_BIN_NAME}
) )
if ((NOT "${ARMFVP}" STREQUAL "ARMFVP-NOTFOUND") AND (DEFINED ARMFVP_MIN_VERSION)) if(ARMFVP AND (DEFINED ARMFVP_MIN_VERSION))
execute_process( execute_process(
COMMAND ${ARMFVP} --version COMMAND ${ARMFVP} --version
OUTPUT_VARIABLE out OUTPUT_VARIABLE out
@ -19,8 +19,13 @@ if ((NOT "${ARMFVP}" STREQUAL "ARMFVP-NOTFOUND") AND (DEFINED ARMFVP_MIN_VERSION
string(REPLACE "\n" "" out ${out}) string(REPLACE "\n" "" out ${out})
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" armfvp_version ${out}) string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" armfvp_version ${out})
if(${armfvp_version} VERSION_LESS ${ARMFVP_MIN_VERSION}) if(${armfvp_version} VERSION_LESS ${ARMFVP_MIN_VERSION})
message(WARNING "Found FVP version is \"${armfvp_version}\", " set(armfvp_warning_message "Found FVP version is \"${armfvp_version}\", "
"the minimum required by the current board is \"${ARMFVP_MIN_VERSION}\".") "the minimum required by the current board is \"${ARMFVP_MIN_VERSION}\".")
message(WARNING "${armfvp_warning_message}")
set(ARMFVP
COMMAND ${CMAKE_COMMAND} -E echo ${armfvp_warning_message}
COMMAND ${ARMFVP}
)
endif() endif()
endif() endif()
@ -54,8 +59,8 @@ add_custom_target(run_armfvp
COMMAND COMMAND
${ARMFVP} ${ARMFVP}
${ARMFVP_FLAGS} ${ARMFVP_FLAGS}
DEPENDS ${ARMFVP} ${logical_target_for_zephyr_elf} DEPENDS ${logical_target_for_zephyr_elf}
WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
COMMENT "FVP: ${ARMFVP}" COMMENT "${ARMFVP_BIN_NAME}: ${armfvp_version}"
USES_TERMINAL USES_TERMINAL
) )