cmake/linker: replace --script= with -T to enhance compatibility

Some niche toolchains do not support the "--script=" option, such as tricore-elf-gcc

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-07-17 21:04:49 +08:00 committed by Xiang Xiao
parent 000b0ec4a1
commit cab82e0a02

View File

@ -637,7 +637,7 @@ if(NOT CONFIG_ARCH_SIM)
# TODO: nostart/nodefault not applicable to nuttx toolchain
target_link_libraries(
nuttx PRIVATE -Wl,--script=${ldscript} -Wl,--start-group ${nuttx_libs}
nuttx PRIVATE -T${ldscript} -Wl,--start-group ${nuttx_libs}
${nuttx_extra_libs} -Wl,--end-group)
# generate binary outputs in different formats (.bin, .hex, etc)
@ -770,7 +770,7 @@ if(CONFIG_BUILD_PROTECTED)
get_property(nuttx_apps_libs GLOBAL PROPERTY NUTTX_APPS_LIBRARIES)
get_property(user_ldscript GLOBAL PROPERTY LD_SCRIPT_USER)
list(TRANSFORM user_ldscript PREPEND "-Wl,--script=")
list(TRANSFORM user_ldscript PREPEND "-T")
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS}