CMake: Validate selected application profile (#13856)

Check if the selected application profile is supported by the selected Mbed Target
pull/13566/head
Rajkumar Kanagaraj 2020-11-06 17:16:42 +00:00 committed by Hugues Kamba
parent 66f65c0e89
commit 073ae1d343
1 changed files with 21 additions and 3 deletions

View File

@ -205,7 +205,7 @@ function(mbed_generate_map_file target)
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${MBED_ROOT}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}
COMMENT
@ -214,9 +214,27 @@ function(mbed_generate_map_file target)
endfunction()
#
# Generate executables
# Validate selected application profile.
#
function(mbed_generate_executable target)
function(mbed_validate_application_profile target)
get_target_property(app_link_libraries ${target} LINK_LIBRARIES)
string(FIND "${app_link_libraries}" "mbed-baremetal" string_found_position)
if(${string_found_position} GREATER_EQUAL 0)
if(NOT "bare-metal" IN_LIST MBED_TARGET_SUPPORTED_APPLICATION_PROFILES)
message(FATAL_ERROR
"Use full profile as baremetal profile is not supported for this Mbed target")
endif()
elseif(NOT "full" IN_LIST MBED_TARGET_SUPPORTED_APPLICATION_PROFILES)
message(FATAL_ERROR
"The full profile is not supported for this Mbed target")
endif()
endfunction()
#
# Set post build operations
#
function(mbed_set_post_build target)
mbed_validate_application_profile(${target})
mbed_generate_bin_hex(${target})
mbed_generate_map_file(${target})
endfunction()