CMake: Do not hard code target in CPU core CMake module

Provide a function in each CPU core module to set toolchain options.
All the functions have the same interface therefore the CMake source
file including the module always calls the same function regardless
of which cpu core module is actually included.
When the `mbed-os` target is broken up into multiple libraries, a
library other than `mbed-os` might need to set the toolchain options.
This will be possible by simply including the module and calling the
function with the target and toolchain for which to set the options.
pull/13566/head
Hugues Kamba 2020-08-04 19:23:25 +01:00
parent 20e19de028
commit 400211c490
19 changed files with 748 additions and 725 deletions

View File

@ -14,9 +14,14 @@ endif()
add_library(mbed-os OBJECT)
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
include(${MBED_ROOT}/cmake/core.cmake)
mbed_set_cpu_core_options(mbed-os ${MBED_TOOLCHAIN})
include(${MBED_ROOT}/cmake/toolchain.cmake)
include(${MBED_ROOT}/cmake/profile.cmake)
include(${MBED_ROOT}/cmake/util.cmake)
set_target_properties(mbed-os

View File

@ -1,51 +1,52 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-a9)
# 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"
)
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}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-a9"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-A9>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-A9"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_A9
ARM_MATH_CA9
__FPU_PRESENT
__CMSIS_RTOS
__EVAL
__MBED_CMSIS_RTOS_CA9
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-a9"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-A9>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-A9"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_A9
ARM_MATH_CA9
__FPU_PRESENT
__CMSIS_RTOS
__EVAL
__MBED_CMSIS_RTOS_CA9
)
endfunction()

View File

@ -1,45 +1,46 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
# 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"
)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-mcpu=cortex-m0plus"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m0plus"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M0plus>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M0plus"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M0PLUS
ARM_MATH_CM0PLUS
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m0plus"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M0plus>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M0plus"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M0PLUS
ARM_MATH_CM0PLUS
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,44 +1,45 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m0)
# 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_toolchain_options
"-mthumb"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND options
"-mcpu=cortex-m0"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:-cpu=Cortex-M0>
)
target_link_options(${target}
PUBLIC
"-cpu=Cortex-M0"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M0
ARM_MATH_CM0
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND options
"-mcpu=cortex-m0"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:-cpu=Cortex-M0>
)
target_link_options(mbed-os
PUBLIC
"-cpu=Cortex-M0"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M0
ARM_MATH_CM0
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,44 +1,45 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m1)
# 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_toolchain_options
"-mthumb"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND options
"-mcpu=cortex-m1"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M1>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M1"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M3
ARM_MATH_CM1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND options
"-mcpu=cortex-m1"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M1>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M1"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M3
ARM_MATH_CM1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,44 +1,45 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m23)
# 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_toolchain_options
"-mthumb"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m23"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M23>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M23"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M23
ARM_MATH_ARMV8MBL
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m23"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M23>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M23"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M23
ARM_MATH_ARMV8MBL
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,45 +1,46 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m23)
# 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_toolchain_options
"-mthumb"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m23"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M23>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M23"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M23
ARM_MATH_ARMV8MBL
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m23"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M23>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M23"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M23
ARM_MATH_ARMV8MBL
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,44 +1,45 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m3)
# 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_toolchain_options
"-mthumb"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m3"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M3>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M3"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M3
ARM_MATH_CM3
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m3"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M3>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M3"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M3
ARM_MATH_CM3
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,46 +1,47 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# 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"
)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-march=armv8-m.main"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33+nodsp"
"-mfpu=none"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp.no_fp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33+nodsp"
"-mfpu=none"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp.no_fp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,49 +1,50 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# Sets cpu core options
function(mbed_set_cpu_core_options target mbed_toolchain)
list(APPEND options)
list(APPEND options)
if(${mbed_toolchain} STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-march=armv8-m.main"
)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-march=armv8-m.main"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33+nodsp"
"-mfpu=none"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp.no_fp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33+nodsp"
"-mfpu=none"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp.no_fp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,50 +1,51 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# 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_toolchain_options
"-mthumb"
"-mfpu=fpv5-sp-d16"
"-mfloat-abi=softfp"
"-march=armv8-m.main"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${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}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33.no_dsp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${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(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33.no_dsp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,51 +1,52 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# 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_toolchain_options
"-mthumb"
"-mfpu=fpv5-sp-d16"
"-mfloat-abi=softfp"
"-march=armv8-m.main"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${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}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33.no_dsp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${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(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33.no_dsp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33.no_dsp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,49 +1,50 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# 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"
)
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}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
endfunction()

View File

@ -1,50 +1,51 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
# 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"
)
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}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M33"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m33"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M33>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M33"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M33
ARM_MATH_ARMV8MML
DOMAIN_NS=1
__FPU_PRESENT=1U
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
__DSP_PRESENT=1U
)
endfunction()

View File

@ -1,46 +1,47 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
# 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"
)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-mcpu=cortex-m4"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m4"
"-mfpu=none"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M4.no_fp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M4.no_fp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M4
ARM_MATH_CM4
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m4"
"-mfpu=none"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M4.no_fp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M4.no_fp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M4
ARM_MATH_CM4
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,50 +1,51 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
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(mbed-os
# Sets cpu core options
function(mbed_set_cpu_core_options target mbed_toolchain)
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M4
ARM_MATH_CM4
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m4"
"-mfpu=fpv4-sp-d16"
"-mfloat-abi=hard"
)
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(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M4>
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M4"
)
endif()
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m4"
"-mfpu=fpv4-sp-d16"
"-mfloat-abi=hard"
)
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M4
ARM_MATH_CM4
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M4>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M4"
)
endif()
endfunction()

View File

@ -1,46 +1,47 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m7)
# 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"
)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
"-mcpu=cortex-m7"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${common_toolchain_options}
)
elseif(${mbed_toolchain} STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m7"
"-mfpu=none"
)
target_compile_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7.no_fp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M7.no_fp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M7
ARM_MATH_CM7
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m7"
"-mfpu=none"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7.no_fp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M7.no_fp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M7
ARM_MATH_CM7
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,50 +1,51 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m7)
# 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_toolchain_options
"-mthumb"
"-mfpu=fpv5-sp-d16"
"-mfloat-abi=softfp"
"-mcpu=cortex-m7"
)
target_compile_options(${target}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${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}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7.fp.sp>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M7.fp.sp"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M7
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${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(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7.fp.sp>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M7.fp.sp"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M7
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -1,50 +1,51 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(CMAKE_SYSTEM_PROCESSOR cortex-m7)
# 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"
)
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}
PUBLIC
${common_toolchain_options}
)
target_compile_options(mbed-os
target_link_options(${target}
PUBLIC
${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}
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7>
)
target_link_options(${target}
PUBLIC
"--cpu=Cortex-M7"
)
endif()
target_compile_definitions(${target}
PUBLIC
${common_toolchain_options}
__CORTEX_M7
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
target_link_options(mbed-os
PUBLIC
${common_toolchain_options}
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
list(APPEND compile_options
"-mcpu=cortex-m7"
"-mfpu=fpv5-d16"
"-mfloat-abi=hard"
)
target_compile_options(mbed-os
PUBLIC
$<$<COMPILE_LANGUAGE:C>:${compile_options}>
$<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
$<$<COMPILE_LANGUAGE:ASM>:--cpu=Cortex-M7>
)
target_link_options(mbed-os
PUBLIC
"--cpu=Cortex-M7"
)
endif()
target_compile_definitions(mbed-os
PUBLIC
__CORTEX_M7
ARM_MATH_CM7
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()