Skip to content

Commit 073ae1d

Browse files
rajkan01hugueskamba
authored andcommitted
CMake: Validate selected application profile (#13856)
Check if the selected application profile is supported by the selected Mbed Target
1 parent 66f65c0 commit 073ae1d

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

CMakeLists.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function(mbed_generate_map_file target)
205205
TARGET
206206
${target}
207207
POST_BUILD
208-
COMMAND ${Python3_EXECUTABLE} ${MBED_ROOT}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
208+
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
209209
WORKING_DIRECTORY
210210
${CMAKE_BINARY_DIR}
211211
COMMENT
@@ -214,9 +214,27 @@ function(mbed_generate_map_file target)
214214
endfunction()
215215

216216
#
217-
# Generate executables
217+
# Validate selected application profile.
218218
#
219-
function(mbed_generate_executable target)
219+
function(mbed_validate_application_profile target)
220+
get_target_property(app_link_libraries ${target} LINK_LIBRARIES)
221+
string(FIND "${app_link_libraries}" "mbed-baremetal" string_found_position)
222+
if(${string_found_position} GREATER_EQUAL 0)
223+
if(NOT "bare-metal" IN_LIST MBED_TARGET_SUPPORTED_APPLICATION_PROFILES)
224+
message(FATAL_ERROR
225+
"Use full profile as baremetal profile is not supported for this Mbed target")
226+
endif()
227+
elseif(NOT "full" IN_LIST MBED_TARGET_SUPPORTED_APPLICATION_PROFILES)
228+
message(FATAL_ERROR
229+
"The full profile is not supported for this Mbed target")
230+
endif()
231+
endfunction()
232+
233+
#
234+
# Set post build operations
235+
#
236+
function(mbed_set_post_build target)
237+
mbed_validate_application_profile(${target})
220238
mbed_generate_bin_hex(${target})
221239
mbed_generate_map_file(${target})
222240
endfunction()

0 commit comments

Comments
 (0)