diff --git a/cmake/toolchains/stm32h750xx.cmake b/cmake/toolchains/stm32h750xx.cmake index 5e955d148..dccbdec28 100644 --- a/cmake/toolchains/stm32h750xx.cmake +++ b/cmake/toolchains/stm32h750xx.cmake @@ -33,6 +33,13 @@ set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -Wno-register" CACHE INTERNAL "C++ Compiler options") set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options") +# Ensure the ar plugin is loaded (needed for LTO) +set(CMAKE_AR ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc-ar) +set(CMAKE_C_ARCHIVE_CREATE " qcs ") +set(CMAKE_C_ARCHIVE_FINISH true) +set(CMAKE_CXX_ARCHIVE_CREATE " qcs ") +set(CMAKE_CXX_ARCHIVE_FINISH true) + add_compile_definitions( CORE_CM7 STM32H750xx