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)
|
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||||
|
|
||||||
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
||||||
include(${MBED_PATH}/tools/cmake/core.cmake)
|
|
||||||
|
|
||||||
add_library(mbed-core INTERFACE)
|
add_library(mbed-core INTERFACE)
|
||||||
|
|
||||||
|
@ -55,8 +54,6 @@ endif()
|
||||||
|
|
||||||
mbed_set_cpu_core_definitions(mbed-core)
|
mbed_set_cpu_core_definitions(mbed-core)
|
||||||
if(${MBED_TOOLCHAIN_FILE_USED})
|
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_profile_options(mbed-core ${MBED_TOOLCHAIN})
|
||||||
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
|
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
|
||||||
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
|
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
|
||||||
|
|
|
@ -9,17 +9,13 @@ endif()
|
||||||
|
|
||||||
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
||||||
|
|
||||||
# Set default toolchain file
|
# Load toolchain file
|
||||||
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
|
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
|
||||||
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
|
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
|
||||||
|
include(${MBED_PATH}/tools/cmake/toolchain.cmake)
|
||||||
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)
|
|
||||||
endif()
|
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)
|
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,10 +1,8 @@
|
||||||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
list(APPEND common_options
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb-interwork"
|
"-mthumb-interwork"
|
||||||
"-marm"
|
"-marm"
|
||||||
"-march=armv7-a"
|
"-march=armv7-a"
|
||||||
|
@ -12,34 +10,17 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
"-mno-unaligned-access"
|
"-mno-unaligned-access"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-a9"
|
"-mcpu=cortex-a9"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-A9"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-A9>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-A9"
|
"--cpu=Cortex-A9"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,40 +2,22 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mcpu=cortex-m0plus"
|
"-mcpu=cortex-m0plus"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m0plus"
|
"-mcpu=cortex-m0plus"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M0plus"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M0plus>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M0plus"
|
"--cpu=Cortex-M0plus"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,39 +2,21 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND options
|
|
||||||
"-mcpu=cortex-m0"
|
"-mcpu=cortex-m0"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M0"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M0>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
"--cpu=Cortex-M0"
|
||||||
INTERFACE
|
|
||||||
"-cpu=Cortex-M0"
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,39 +2,21 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND options
|
|
||||||
"-mcpu=cortex-m1"
|
"-mcpu=cortex-m1"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M1"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M1>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M1"
|
"--cpu=Cortex-M1"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,39 +2,22 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m23"
|
"-mcpu=cortex-m23"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M23"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M23>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M23"
|
"--cpu=Cortex-M23"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,39 +2,22 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m23"
|
"-mcpu=cortex-m23"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M23"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M23>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M23"
|
"--cpu=Cortex-M23"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,39 +2,21 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m3"
|
"-mcpu=cortex-m3"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M3"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M3>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M3"
|
"--cpu=Cortex-M3"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,41 +2,23 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-march=armv8-m.main"
|
"-march=armv8-m.main"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
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"
|
"-mcpu=cortex-m33+nodsp"
|
||||||
"-mfpu=none"
|
"-mfpu=none"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33.no_dsp.no_fp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp.no_fp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,43 +2,23 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
list(APPEND options)
|
list(APPEND common_options
|
||||||
|
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-march=armv8-m.main"
|
"-march=armv8-m.main"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
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"
|
"-mcpu=cortex-m33+nodsp"
|
||||||
"-mfpu=none"
|
"-mfpu=none"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33.no_dsp.no_fp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp.no_fp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33.no_dsp.no_fp"
|
"--cpu=Cortex-M33.no_dsp.no_fp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,44 +2,27 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-march=armv8-m.main"
|
"-march=armv8-m.main"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
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"
|
"-mcpu=cortex-m33+nodsp"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33.no_dsp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33.no_dsp"
|
"--cpu=Cortex-M33.no_dsp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,44 +2,26 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-march=armv8-m.main"
|
"-march=armv8-m.main"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
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"
|
"-mcpu=cortex-m33+nodsp"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33.no_dsp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33.no_dsp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33.no_dsp"
|
"--cpu=Cortex-M33.no_dsp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,42 +2,24 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-march=armv8-m.main+dsp"
|
"-march=armv8-m.main+dsp"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m33"
|
"-mcpu=cortex-m33"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33"
|
"--cpu=Cortex-M33"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,42 +2,24 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-march=armv8-m.main+dsp"
|
"-march=armv8-m.main+dsp"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m33"
|
"-mcpu=cortex-m33"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M33"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M33>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M33"
|
"--cpu=Cortex-M33"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,41 +2,23 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mcpu=cortex-m4"
|
"-mcpu=cortex-m4"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m4"
|
"-mcpu=cortex-m4"
|
||||||
"-mfpu=none"
|
"-mfpu=none"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M4.no_fp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M4.no_fp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M4.no_fp"
|
"--cpu=Cortex-M4.no_fp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,44 +2,26 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mcpu=cortex-m4"
|
"-mcpu=cortex-m4"
|
||||||
"-mfpu=fpv4-sp-d16"
|
"-mfpu=fpv4-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m4"
|
"-mcpu=cortex-m4"
|
||||||
"-mfpu=fpv4-sp-d16"
|
"-mfpu=fpv4-sp-d16"
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M4"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M4>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M4"
|
"--cpu=Cortex-M4"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,41 +2,23 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
"-mfpu=none"
|
"-mfpu=none"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M7.no_fp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7.no_fp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M7.no_fp"
|
"--cpu=Cortex-M7.no_fp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,44 +2,27 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
"-mfpu=fpv5-sp-d16"
|
"-mfpu=fpv5-sp-d16"
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M7.fp.sp"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7.fp.sp>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M7.fp.sp"
|
"--cpu=Cortex-M7.fp.sp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -2,44 +2,26 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Sets cpu core options
|
# Sets cpu core options
|
||||||
function(mbed_set_cpu_core_options target mbed_toolchain)
|
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
list(APPEND common_options
|
||||||
list(APPEND common_toolchain_options
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-mfpu=fpv5-d16"
|
"-mfpu=fpv5-d16"
|
||||||
"-mfloat-abi=softfp"
|
"-mfloat-abi=softfp"
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
)
|
)
|
||||||
|
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||||
target_compile_options(${target}
|
list(APPEND c_cxx_compile_options
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${common_toolchain_options}
|
|
||||||
)
|
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
||||||
list(APPEND compile_options
|
|
||||||
"-mcpu=cortex-m7"
|
"-mcpu=cortex-m7"
|
||||||
"-mfpu=fpv5-d16"
|
"-mfpu=fpv5-d16"
|
||||||
"-mfloat-abi=hard"
|
"-mfloat-abi=hard"
|
||||||
)
|
)
|
||||||
|
list(APPEND asm_compile_options
|
||||||
target_compile_options(${target}
|
"-mcpu=Cortex-M7"
|
||||||
INTERFACE
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
|
|
||||||
$<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7>
|
|
||||||
)
|
)
|
||||||
|
list(APPEND link_options
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
"--cpu=Cortex-M7"
|
"--cpu=Cortex-M7"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(mbed_set_cpu_core_definitions target)
|
function(mbed_set_cpu_core_definitions target)
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
|
|
||||||
# Sets profile options
|
# Sets profile options
|
||||||
function(mbed_set_profile_options target mbed_toolchain)
|
function(mbed_set_profile_options target mbed_toolchain)
|
||||||
list(APPEND link_options)
|
set(profile_link_options "")
|
||||||
|
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-c"
|
"-c"
|
||||||
"-Og"
|
"-Og"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"-c"
|
||||||
"-fno-rtti"
|
"-fno-rtti"
|
||||||
"-Wvla"
|
"-Wvla"
|
||||||
|
@ -23,19 +23,19 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"-c"
|
||||||
"-x" "assembler-with-cpp"
|
"-x" "assembler-with-cpp"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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,--gc-sections"
|
||||||
"-Wl,--wrap,main"
|
"-Wl,--wrap,main"
|
||||||
"-Wl,--wrap,_malloc_r"
|
"-Wl,--wrap,_malloc_r"
|
||||||
|
@ -48,22 +48,22 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
"-Wl,-n"
|
"-Wl,-n"
|
||||||
)
|
)
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-O1"
|
"-O1"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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-rtti"
|
||||||
"-fno-c++-static-destructors"
|
"-fno-c++-static-destructors"
|
||||||
"-O1"
|
"-O1"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_options}>
|
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND link_options
|
list(APPEND link_options
|
||||||
|
@ -90,6 +90,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
|
|
||||||
target_link_options(${target}
|
target_link_options(${target}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${link_options}
|
${profile_link_options}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -3,37 +3,37 @@
|
||||||
|
|
||||||
# Sets profile options
|
# Sets profile options
|
||||||
function(mbed_set_profile_options target mbed_toolchain)
|
function(mbed_set_profile_options target mbed_toolchain)
|
||||||
list(APPEND link_options)
|
set(profile_link_options "")
|
||||||
|
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-c"
|
"-c"
|
||||||
"-Os"
|
"-Os"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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-rtti"
|
||||||
"-Wvla"
|
"-Wvla"
|
||||||
"-Os"
|
"-Os"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"-x" "assembler-with-cpp"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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,--gc-sections"
|
||||||
"-Wl,--wrap,main"
|
"-Wl,--wrap,main"
|
||||||
"-Wl,--wrap,_malloc_r"
|
"-Wl,--wrap,_malloc_r"
|
||||||
|
@ -46,25 +46,25 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
"-Wl,-n"
|
"-Wl,-n"
|
||||||
)
|
)
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-Os"
|
"-Os"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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-rtti"
|
||||||
"-fno-c++-static-destructors"
|
"-fno-c++-static-destructors"
|
||||||
"-Os"
|
"-Os"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"--show_full_path"
|
||||||
"--legacyalign"
|
"--legacyalign"
|
||||||
"--inline"
|
"--inline"
|
||||||
|
@ -85,6 +85,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
|
|
||||||
target_link_options(${target}
|
target_link_options(${target}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${link_options}
|
${profile_link_options}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
|
|
||||||
# Sets profile options
|
# Sets profile options
|
||||||
function(mbed_set_profile_options target mbed_toolchain)
|
function(mbed_set_profile_options target mbed_toolchain)
|
||||||
list(APPEND link_options)
|
set(profile_link_options "")
|
||||||
|
|
||||||
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-c"
|
"-c"
|
||||||
"-Os"
|
"-Os"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"-c"
|
||||||
"-fno-rtti"
|
"-fno-rtti"
|
||||||
"-Wvla"
|
"-Wvla"
|
||||||
|
@ -23,19 +23,19 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"-c"
|
||||||
"-x" "assembler-with-cpp"
|
"-x" "assembler-with-cpp"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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,--gc-sections"
|
||||||
"-Wl,--wrap,main"
|
"-Wl,--wrap,main"
|
||||||
"-Wl,--wrap,_malloc_r"
|
"-Wl,--wrap,_malloc_r"
|
||||||
|
@ -48,25 +48,25 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
"-Wl,-n"
|
"-Wl,-n"
|
||||||
)
|
)
|
||||||
elseif(${mbed_toolchain} STREQUAL "ARM")
|
elseif(${mbed_toolchain} STREQUAL "ARM")
|
||||||
list(APPEND c_compile_options
|
list(APPEND profile_c_compile_options
|
||||||
"-Oz"
|
"-Oz"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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-rtti"
|
||||||
"-fno-c++-static-destructors"
|
"-fno-c++-static-destructors"
|
||||||
"-Oz"
|
"-Oz"
|
||||||
)
|
)
|
||||||
target_compile_options(${target}
|
target_compile_options(${target}
|
||||||
INTERFACE
|
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"
|
"--show_full_path"
|
||||||
"--legacyalign"
|
"--legacyalign"
|
||||||
"--inline"
|
"--inline"
|
||||||
|
@ -87,6 +87,6 @@ function(mbed_set_profile_options target mbed_toolchain)
|
||||||
|
|
||||||
target_link_options(${target}
|
target_link_options(${target}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${link_options}
|
${profile_link_options}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -64,8 +64,6 @@ endif()
|
||||||
# Compiler setup
|
# Compiler setup
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_CROSSCOMPILING TRUE)
|
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
|
# Clear toolchains options for all languages as Mbed OS uses
|
||||||
# different initialisation options (such as for optimization and debug symbols)
|
# 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_ASM_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
|
||||||
set(CMAKE_C_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(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,11 +8,13 @@ set(CMAKE_AR "armar")
|
||||||
set(ARM_ELF2BIN "fromelf")
|
set(ARM_ELF2BIN "fromelf")
|
||||||
set_property(GLOBAL PROPERTY ELF2BIN ${ARM_ELF2BIN})
|
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
|
# Sets toolchain options
|
||||||
function(mbed_set_toolchain_options target)
|
list(APPEND common_options
|
||||||
list(APPEND common_options
|
|
||||||
"-c"
|
|
||||||
"--target=arm-arm-none-eabi"
|
|
||||||
"-mthumb"
|
"-mthumb"
|
||||||
"-Wno-armcc-pragma-push-pop"
|
"-Wno-armcc-pragma-push-pop"
|
||||||
"-Wno-armcc-pragma-anon-unions"
|
"-Wno-armcc-pragma-anon-unions"
|
||||||
|
@ -22,35 +24,23 @@ function(mbed_set_toolchain_options target)
|
||||||
"-fno-exceptions"
|
"-fno-exceptions"
|
||||||
"-fshort-enums"
|
"-fshort-enums"
|
||||||
"-fshort-wchar"
|
"-fshort-wchar"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(${target}
|
list(APPEND asm_compile_options
|
||||||
INTERFACE
|
-masm=auto
|
||||||
$<$<COMPILE_LANGUAGE:C>:${common_options}>
|
--target=arm-arm-none-eabi
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(${target}
|
list(APPEND link_options
|
||||||
INTERFACE
|
"--map"
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${common_options}>
|
)
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(${target}
|
# Add linking time preprocessor macro for TFM targets
|
||||||
INTERFACE
|
if(MBED_CPU_CORE MATCHES "-NS$")
|
||||||
$<$<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
|
list(APPEND link_options
|
||||||
"--predefine=\"-DDOMAIN_NS=0x1\""
|
"--predefine=\"-DDOMAIN_NS=0x1\""
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_options(${target}
|
|
||||||
INTERFACE
|
|
||||||
${link_options}
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Configure the toolchain to select the selected C library
|
# Configure the toolchain to select the selected C library
|
||||||
function(mbed_set_c_lib target lib_type)
|
function(mbed_set_c_lib target lib_type)
|
||||||
|
|
|
@ -7,9 +7,8 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
|
||||||
set(GCC_ELF2BIN "arm-none-eabi-objcopy")
|
set(GCC_ELF2BIN "arm-none-eabi-objcopy")
|
||||||
set_property(GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN})
|
set_property(GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN})
|
||||||
|
|
||||||
# Sets toolchain options
|
# build toolchain flags that get passed to everything (including CMake compiler checks)
|
||||||
function(mbed_set_toolchain_options target)
|
list(APPEND link_options
|
||||||
list(APPEND link_options
|
|
||||||
"-Wl,--start-group"
|
"-Wl,--start-group"
|
||||||
"-lstdc++"
|
"-lstdc++"
|
||||||
"-lsupc++"
|
"-lsupc++"
|
||||||
|
@ -20,16 +19,16 @@ function(mbed_set_toolchain_options target)
|
||||||
"-Wl,--end-group"
|
"-Wl,--end-group"
|
||||||
"-specs=nosys.specs"
|
"-specs=nosys.specs"
|
||||||
"-Wl,--cref"
|
"-Wl,--cref"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add linking time preprocessor macro for TFM targets
|
# Add linking time preprocessor macro for TFM targets
|
||||||
if("TFM" IN_LIST MBED_TARGET_LABELS)
|
if("TFM" IN_LIST MBED_TARGET_LABELS)
|
||||||
list(APPEND link_options
|
list(APPEND link_options
|
||||||
"-DDOMAIN_NS=1"
|
"-DDOMAIN_NS=1"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND common_options
|
list(APPEND common_options
|
||||||
"-Wall"
|
"-Wall"
|
||||||
"-Wextra"
|
"-Wextra"
|
||||||
"-Wno-unused-parameter"
|
"-Wno-unused-parameter"
|
||||||
|
@ -39,22 +38,10 @@ function(mbed_set_toolchain_options target)
|
||||||
"-ffunction-sections"
|
"-ffunction-sections"
|
||||||
"-fdata-sections"
|
"-fdata-sections"
|
||||||
"-funsigned-char"
|
"-funsigned-char"
|
||||||
"-MMD"
|
|
||||||
"-fomit-frame-pointer"
|
"-fomit-frame-pointer"
|
||||||
"-g3"
|
"-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
|
# Configure the toolchain to select the selected C library
|
||||||
function(mbed_set_c_lib target lib_type)
|
function(mbed_set_c_lib target lib_type)
|
||||||
|
@ -80,7 +67,8 @@ function(mbed_set_printf_lib target lib_type)
|
||||||
MBED_MINIMAL_PRINTF
|
MBED_MINIMAL_PRINTF
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND link_options
|
set(printf_link_options "")
|
||||||
|
list(APPEND printf_link_options
|
||||||
"-Wl,--wrap,printf"
|
"-Wl,--wrap,printf"
|
||||||
"-Wl,--wrap,sprintf"
|
"-Wl,--wrap,sprintf"
|
||||||
"-Wl,--wrap,snprintf"
|
"-Wl,--wrap,snprintf"
|
||||||
|
@ -92,7 +80,7 @@ function(mbed_set_printf_lib target lib_type)
|
||||||
)
|
)
|
||||||
target_link_options(${target}
|
target_link_options(${target}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${link_options}
|
${printf_link_options}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
Loading…
Reference in New Issue