mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #13987 from multiplemonomials/cmake-global-options
CMake: Set required toolchain and processor flags globally, instead of per-targetpull/14019/head
commit
cca6652163
|
@ -6,7 +6,6 @@
|
|||
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||
|
||||
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
||||
include(${MBED_PATH}/tools/cmake/core.cmake)
|
||||
|
||||
add_library(mbed-core INTERFACE)
|
||||
|
||||
|
@ -55,8 +54,6 @@ endif()
|
|||
|
||||
mbed_set_cpu_core_definitions(mbed-core)
|
||||
if(${MBED_TOOLCHAIN_FILE_USED})
|
||||
mbed_set_cpu_core_options(mbed-core ${MBED_TOOLCHAIN})
|
||||
mbed_set_toolchain_options(mbed-core)
|
||||
mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN})
|
||||
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
|
||||
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
|
||||
|
|
|
@ -9,17 +9,13 @@ endif()
|
|||
|
||||
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
||||
|
||||
# Set default toolchain file
|
||||
# Load toolchain file
|
||||
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
|
||||
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE "${MBED_PATH}/tools/cmake/toolchain.cmake" CACHE INTERNAL "")
|
||||
|
||||
# Specify locations for toolchains and generic options
|
||||
include(${MBED_PATH}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
|
||||
|
||||
# Specify available build profiles and add options for the selected build profile
|
||||
include(${MBED_PATH}/tools/cmake/profile.cmake)
|
||||
include(${MBED_PATH}/tools/cmake/toolchain.cmake)
|
||||
endif()
|
||||
|
||||
# Specify available build profiles and add options for the selected build profile
|
||||
include(${MBED_PATH}/tools/cmake/profile.cmake)
|
||||
|
||||
enable_language(C CXX ASM)
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include(${MBED_PATH}/tools/cmake/cores/${MBED_CPU_CORE}.cmake)
|
|
@ -1,45 +1,26 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb-interwork"
|
||||
"-marm"
|
||||
"-march=armv7-a"
|
||||
"-mfpu=vfpv3"
|
||||
"-mfloat-abi=hard"
|
||||
"-mno-unaligned-access"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-a9"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-A9>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-A9"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb-interwork"
|
||||
"-marm"
|
||||
"-march=armv7-a"
|
||||
"-mfpu=vfpv3"
|
||||
"-mfloat-abi=hard"
|
||||
"-mno-unaligned-access"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-a9"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-A9"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-A9"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,40 +2,22 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m0plus"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m0plus"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M0plus>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M0plus"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m0plus"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m0plus"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M0plus"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M0plus"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,39 +2,21 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND options
|
||||
"-mcpu=cortex-m0"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M0>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"-cpu=Cortex-M0"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m0"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M0"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M0"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,39 +2,21 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND options
|
||||
"-mcpu=cortex-m1"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M1>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M1"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m1"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M1"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M1"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,39 +2,22 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
)
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m23"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M23"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M23"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m23"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M23>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M23"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,39 +2,22 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
)
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m23"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M23"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M23"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m23"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M23>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M23"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,39 +2,21 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m3"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M3>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M3"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m3"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M3"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M3"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,41 +2,23 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=none"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp.no_fp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=none"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,43 +2,23 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
list(APPEND options)
|
||||
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=none"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp.no_fp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=none"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,44 +2,27 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,44 +2,26 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33+nodsp"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33.no_dsp"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,42 +2,24 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main+dsp"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main+dsp"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,42 +2,24 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main+dsp"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m33"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M33"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-march=armv8-m.main+dsp"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m33"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M33"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M33"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,41 +2,23 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m4"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=none"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M4.no_fp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M4.no_fp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m4"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=none"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M4.no_fp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M4.no_fp"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,44 +2,26 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=fpv4-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=fpv4-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M4>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M4"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=fpv4-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m4"
|
||||
"-mfpu=fpv4-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M4"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M4"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,41 +2,23 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=none"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7.no_fp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M7.no_fp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=none"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M7.no_fp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M7.no_fp"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,44 +2,27 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M7.fp.sp"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M7.fp.sp"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=fpv5-sp-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7.fp.sp>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M7.fp.sp"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -2,44 +2,26 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Sets cpu core options
|
||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_toolchain_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_toolchain_options}
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=fpv5-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7>
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
"--cpu=Cortex-M7"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-mfpu=fpv5-d16"
|
||||
"-mfloat-abi=softfp"
|
||||
"-mcpu=cortex-m7"
|
||||
)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
list(APPEND c_cxx_compile_options
|
||||
"-mcpu=cortex-m7"
|
||||
"-mfpu=fpv5-d16"
|
||||
"-mfloat-abi=hard"
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
"-mcpu=Cortex-M7"
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--cpu=Cortex-M7"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(mbed_set_cpu_core_definitions target)
|
||||
target_compile_definitions(${target}
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
|
||||
# Sets profile options
|
||||
function(mbed_set_profile_options target mbed_toolchain)
|
||||
list(APPEND link_options)
|
||||
set(profile_link_options "")
|
||||
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-c"
|
||||
"-Og"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-c"
|
||||
"-fno-rtti"
|
||||
"-Wvla"
|
||||
|
@ -23,19 +23,19 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND asm_compile_options
|
||||
list(APPEND profile_asm_compile_options
|
||||
"-c"
|
||||
"-x" "assembler-with-cpp"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${asm_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${profile_asm_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
list(APPEND profile_link_options
|
||||
"-Wl,--gc-sections"
|
||||
"-Wl,--wrap,main"
|
||||
"-Wl,--wrap,_malloc_r"
|
||||
|
@ -48,22 +48,22 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
"-Wl,-n"
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-O1"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-fno-rtti"
|
||||
"-fno-c++-static-destructors"
|
||||
"-O1"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
|
@ -90,6 +90,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${link_options}
|
||||
${profile_link_options}
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
@ -3,37 +3,37 @@
|
|||
|
||||
# Sets profile options
|
||||
function(mbed_set_profile_options target mbed_toolchain)
|
||||
list(APPEND link_options)
|
||||
set(profile_link_options "")
|
||||
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-c"
|
||||
"-Os"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-fno-rtti"
|
||||
"-Wvla"
|
||||
"-Os"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND asm_compile_options
|
||||
list(APPEND profile_asm_compile_options
|
||||
"-x" "assembler-with-cpp"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${asm_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${profile_asm_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
list(APPEND profile_link_options
|
||||
"-Wl,--gc-sections"
|
||||
"-Wl,--wrap,main"
|
||||
"-Wl,--wrap,_malloc_r"
|
||||
|
@ -46,25 +46,25 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
"-Wl,-n"
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-Os"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-fno-rtti"
|
||||
"-fno-c++-static-destructors"
|
||||
"-Os"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
list(APPEND profile_link_options
|
||||
"--show_full_path"
|
||||
"--legacyalign"
|
||||
"--inline"
|
||||
|
@ -85,6 +85,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${link_options}
|
||||
${profile_link_options}
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
|
||||
# Sets profile options
|
||||
function(mbed_set_profile_options target mbed_toolchain)
|
||||
list(APPEND link_options)
|
||||
set(profile_link_options "")
|
||||
|
||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-c"
|
||||
"-Os"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-c"
|
||||
"-fno-rtti"
|
||||
"-Wvla"
|
||||
|
@ -23,19 +23,19 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND asm_compile_options
|
||||
list(APPEND profile_asm_compile_options
|
||||
"-c"
|
||||
"-x" "assembler-with-cpp"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${asm_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${profile_asm_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
list(APPEND profile_link_options
|
||||
"-Wl,--gc-sections"
|
||||
"-Wl,--wrap,main"
|
||||
"-Wl,--wrap,_malloc_r"
|
||||
|
@ -48,25 +48,25 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
"-Wl,-n"
|
||||
)
|
||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||
list(APPEND c_compile_options
|
||||
list(APPEND profile_c_compile_options
|
||||
"-Oz"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${c_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND cxx_compile_options
|
||||
list(APPEND profile_cxx_compile_options
|
||||
"-fno-rtti"
|
||||
"-fno-c++-static-destructors"
|
||||
"-Oz"
|
||||
)
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
list(APPEND profile_link_options
|
||||
"--show_full_path"
|
||||
"--legacyalign"
|
||||
"--inline"
|
||||
|
@ -87,6 +87,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
|||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${link_options}
|
||||
${profile_link_options}
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
@ -64,8 +64,6 @@ endif()
|
|||
# Compiler setup
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
|
||||
# Clear toolchains options for all languages as Mbed OS uses
|
||||
# different initialisation options (such as for optimization and debug symbols)
|
||||
|
@ -93,3 +91,29 @@ set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
|||
set(CMAKE_ASM_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
|
||||
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
|
||||
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
|
||||
|
||||
# Set basic compiler and linker flags.
|
||||
# Also load some utility functions for setting the toolchain options.
|
||||
set(link_options "")
|
||||
set(common_options "")
|
||||
set(c_cxx_compile_options "") # compile options only for C/CXX
|
||||
set(asm_compile_options "") # compile options only for ASM
|
||||
include(${MBED_PATH}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
|
||||
include(${MBED_PATH}/tools/cmake/cores/${MBED_CPU_CORE}.cmake)
|
||||
|
||||
#converts a list into a string with each of its elements seperated by a space
|
||||
macro(list_to_space_separated OUTPUT_VAR)# 2nd arg: LIST...
|
||||
string(REPLACE ";" " " ${OUTPUT_VAR} "${ARGN}")
|
||||
endmacro(list_to_space_separated)
|
||||
|
||||
# set toolchain flags with CMake (INIT variables will be picked up on first run)
|
||||
list_to_space_separated(CMAKE_C_FLAGS_INIT ${common_options} ${c_cxx_compile_options})
|
||||
set(CMAKE_CXX_FLAGS_INIT ${CMAKE_C_FLAGS_INIT})
|
||||
list_to_space_separated(CMAKE_ASM_FLAGS_INIT ${common_options} ${asm_compile_options})
|
||||
list_to_space_separated(CMAKE_EXE_LINKER_FLAGS_INIT ${link_options})
|
||||
|
||||
# due to a bug in ARMClang CMake compiler file, all _INIT flags must end with a space.
|
||||
# (this line: https://github.com/Kitware/CMake/blob/7d4a6ce714a9213ffd34b13a3debcb31a2430e04/Modules/Compiler/ARMClang.cmake#L97)
|
||||
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} ")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} ")
|
||||
|
|
|
@ -8,49 +8,39 @@ set(CMAKE_AR "armar")
|
|||
set(ARM_ELF2BIN "fromelf")
|
||||
set_property(GLOBAL PROPERTY ELF2BIN ${ARM_ELF2BIN})
|
||||
|
||||
# tell cmake about compiler targets.
|
||||
# This will cause it to add the --target flag.
|
||||
set(CMAKE_C_COMPILER_TARGET arm-arm-none-eabi)
|
||||
set(CMAKE_CXX_COMPILER_TARGET arm-arm-none-eabi)
|
||||
|
||||
# Sets toolchain options
|
||||
function(mbed_set_toolchain_options target)
|
||||
list(APPEND common_options
|
||||
"-c"
|
||||
"--target=arm-arm-none-eabi"
|
||||
"-mthumb"
|
||||
"-Wno-armcc-pragma-push-pop"
|
||||
"-Wno-armcc-pragma-anon-unions"
|
||||
"-Wno-reserved-user-defined-literal"
|
||||
"-Wno-deprecated-register"
|
||||
"-fdata-sections"
|
||||
"-fno-exceptions"
|
||||
"-fshort-enums"
|
||||
"-fshort-wchar"
|
||||
)
|
||||
list(APPEND common_options
|
||||
"-mthumb"
|
||||
"-Wno-armcc-pragma-push-pop"
|
||||
"-Wno-armcc-pragma-anon-unions"
|
||||
"-Wno-reserved-user-defined-literal"
|
||||
"-Wno-deprecated-register"
|
||||
"-fdata-sections"
|
||||
"-fno-exceptions"
|
||||
"-fshort-enums"
|
||||
"-fshort-wchar"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:C>:${common_options}>
|
||||
)
|
||||
list(APPEND asm_compile_options
|
||||
-masm=auto
|
||||
--target=arm-arm-none-eabi
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${common_options}>
|
||||
)
|
||||
list(APPEND link_options
|
||||
"--map"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:--target=arm-arm-none-eabi -masm=auto>
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
if(MBED_CPU_CORE MATCHES "-NS$")
|
||||
list(APPEND link_options
|
||||
"--predefine=\"-DDOMAIN_NS=0x1\""
|
||||
)
|
||||
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
if(MBED_CPU_CORE MATCHES "\-NS$")
|
||||
list(APPEND link_options
|
||||
"--predefine=\"-DDOMAIN_NS=0x1\""
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${link_options}
|
||||
)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
# Configure the toolchain to select the selected C library
|
||||
function(mbed_set_c_lib target lib_type)
|
||||
|
|
|
@ -7,54 +7,41 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
|
|||
set(GCC_ELF2BIN "arm-none-eabi-objcopy")
|
||||
set_property(GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN})
|
||||
|
||||
# Sets toolchain options
|
||||
function(mbed_set_toolchain_options target)
|
||||
# build toolchain flags that get passed to everything (including CMake compiler checks)
|
||||
list(APPEND link_options
|
||||
"-Wl,--start-group"
|
||||
"-lstdc++"
|
||||
"-lsupc++"
|
||||
"-lm"
|
||||
"-lc"
|
||||
"-lgcc"
|
||||
"-lnosys"
|
||||
"-Wl,--end-group"
|
||||
"-specs=nosys.specs"
|
||||
"-Wl,--cref"
|
||||
)
|
||||
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
if("TFM" IN_LIST MBED_TARGET_LABELS)
|
||||
list(APPEND link_options
|
||||
"-Wl,--start-group"
|
||||
"-lstdc++"
|
||||
"-lsupc++"
|
||||
"-lm"
|
||||
"-lc"
|
||||
"-lgcc"
|
||||
"-lnosys"
|
||||
"-Wl,--end-group"
|
||||
"-specs=nosys.specs"
|
||||
"-Wl,--cref"
|
||||
"-DDOMAIN_NS=1"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
if("TFM" IN_LIST MBED_TARGET_LABELS)
|
||||
list(APPEND link_options
|
||||
"-DDOMAIN_NS=1"
|
||||
)
|
||||
endif()
|
||||
list(APPEND common_options
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-Wno-unused-parameter"
|
||||
"-Wno-missing-field-initializers"
|
||||
"-fmessage-length=0"
|
||||
"-fno-exceptions"
|
||||
"-ffunction-sections"
|
||||
"-fdata-sections"
|
||||
"-funsigned-char"
|
||||
"-fomit-frame-pointer"
|
||||
"-g3"
|
||||
)
|
||||
|
||||
list(APPEND common_options
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-Wno-unused-parameter"
|
||||
"-Wno-missing-field-initializers"
|
||||
"-fmessage-length=0"
|
||||
"-fno-exceptions"
|
||||
"-ffunction-sections"
|
||||
"-fdata-sections"
|
||||
"-funsigned-char"
|
||||
"-MMD"
|
||||
"-fomit-frame-pointer"
|
||||
"-g3"
|
||||
)
|
||||
|
||||
target_compile_options(${target}
|
||||
INTERFACE
|
||||
${common_options}
|
||||
)
|
||||
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${common_options}
|
||||
${link_options}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# Configure the toolchain to select the selected C library
|
||||
function(mbed_set_c_lib target lib_type)
|
||||
|
@ -80,7 +67,8 @@ function(mbed_set_printf_lib target lib_type)
|
|||
MBED_MINIMAL_PRINTF
|
||||
)
|
||||
|
||||
list(APPEND link_options
|
||||
set(printf_link_options "")
|
||||
list(APPEND printf_link_options
|
||||
"-Wl,--wrap,printf"
|
||||
"-Wl,--wrap,sprintf"
|
||||
"-Wl,--wrap,snprintf"
|
||||
|
@ -92,7 +80,7 @@ function(mbed_set_printf_lib target lib_type)
|
|||
)
|
||||
target_link_options(${target}
|
||||
INTERFACE
|
||||
${link_options}
|
||||
${printf_link_options}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
Loading…
Reference in New Issue