generating stripped executable now
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...

This commit is contained in:
Robin Müller 2021-08-14 15:25:30 +02:00
parent 95c06d5a09
commit cfbacd4d80
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 6 additions and 13 deletions

View File

@ -11,17 +11,6 @@ if(LINK_LWIP)
endif()
endif()
if(LINK_HAL)
message(STATUS "Linking against ${LIB_HAL_NAME} HAL library")
if(LIB_HAL_NAME)
target_link_libraries(${TARGET_NAME} PUBLIC
${LIB_HAL_NAME}
)
else()
message(WARNING "HAL library name not set!")
endif()
endif()
if(LINKER_SCRIPT)
target_link_options(${TARGET_NAME} PRIVATE
-T${LINKER_SCRIPT}
@ -52,11 +41,14 @@ target_compile_options(${TARGET_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
)
set(STRIPPED_TARGET_NAME ${TARGET_NAME}-stripped)
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET_NAME} ${TARGET_NAME}.bin
COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin.."
COMMAND ${CMAKE_STRIP} --strip-all ${TARGET_NAME} -o ${STRIPPED_TARGET_NAME}
BYPRODUCTS ${STRIPPED_TARGET_NAME}
COMMENT "Generating stripped executable ${STRIPPED_TARGET_NAME}.."
)
endfunction()

View File

@ -42,6 +42,7 @@ find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED)
# Useful utilities, not strictly necessary
find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
find_program(CMAKE_STRIP ${CROSS_COMPILE_STRIP})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")