Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linker script incorrectly selected for bare-metal profile #342

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tools/cmake/mbed_target_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,21 @@ function(mbed_set_post_build target)
# add linker script. Skip for greentea test code, there the linker script is set in mbed_setup_linker_script()
if (NOT MBED_IS_STANDALONE)
if("${ARGN}" STREQUAL "")
if(TARGET mbed-os)
get_target_property(POST_BUILD_TARGET_LINK_LIBRARIES ${target} LINK_LIBRARIES)
if("mbed-os" IN_LIST POST_BUILD_TARGET_LINK_LIBRARIES)
get_target_property(LINKER_SCRIPT_PATH mbed-os LINKER_SCRIPT_PATH)
target_link_options(${target}
PRIVATE
"-T" "${LINKER_SCRIPT_PATH}"
)
elseif(TARGET mbed-baremetal)
elseif("mbed-baremetal" IN_LIST POST_BUILD_TARGET_LINK_LIBRARIES)
get_target_property(LINKER_SCRIPT_PATH mbed-baremetal LINKER_SCRIPT_PATH)
target_link_options(${target}
PRIVATE
multiplemonomials marked this conversation as resolved.
Show resolved Hide resolved
"-T" "${LINKER_SCRIPT_PATH}"
)
else()
message(FATAL_ERROR "Target ${target} used with mbed_set_post_build() but does not link to mbed-os or mbed-baremetal!")
endif()
else()
message(STATUS "${target} uses custom linker script ${ARGV1}")
Expand Down
Loading