CMake: Create CMSIS library targets to remove dependency on MBED_TARGET_LABELS

This goes towards eventually removing reliance on targets.json to specify
the requirements of Mbed targets.
pull/14306/head
Hugues Kamba 2021-02-19 13:39:32 +00:00
parent 26606218ad
commit 2c3481297c
19 changed files with 52 additions and 22 deletions

View File

@ -1,9 +1,5 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if("CORTEX_A" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_CORTEX_A EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_CORTEX_A) add_subdirectory(TARGET_CORTEX_M EXCLUDE_FROM_ALL)
elseif("CORTEX_M" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_CORTEX_M)
endif()

View File

@ -1,12 +1,14 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-core add_library(mbed-cmsis-cortex-a INTERFACE)
target_include_directories(mbed-cmsis-cortex-a
INTERFACE INTERFACE
Include Include
) )
target_sources(mbed-core target_sources(mbed-cmsis-cortex-a
INTERFACE INTERFACE
Source/irq_ctrl_gic.c Source/irq_ctrl_gic.c
) )

View File

@ -1,12 +1,14 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-core add_library(mbed-cmsis-cortex-m INTERFACE)
target_include_directories(mbed-cmsis-cortex-m
INTERFACE INTERFACE
Include Include
) )
target_sources(mbed-core target_sources(mbed-cmsis-cortex-m
INTERFACE INTERFACE
Source/mbed_tz_context.c Source/mbed_tz_context.c
) )

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_library(mbed-arm-fm INTERFACE) add_library(mbed-arm-fm INTERFACE)
@ -9,3 +9,5 @@ target_include_directories(mbed-arm-fm
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-arm-fm INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_library(mbed-arm-ssg INTERFACE) add_library(mbed-arm-ssg INTERFACE)
@ -12,3 +12,5 @@ target_include_directories(mbed-arm-ssg
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-arm-ssg INTERFACE mbed-cmsis-cortex-m)

View File

@ -24,3 +24,5 @@ target_sources(mbed-ambiq-micro
sdk/utils/am_util_string.c sdk/utils/am_util_string.c
sdk/utils/am_util_time.c sdk/utils/am_util_time.c
) )
target_link_libraries(mbed-ambiq-micro INTERFACE mbed-cmsis-cortex-m)

View File

@ -10,3 +10,5 @@ target_include_directories(mbed-analog-devices
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-analog-devices INTERFACE mbed-cmsis-cortex-m)

View File

@ -280,6 +280,8 @@ target_sources(mbed-psoc6
${ASSEMBLY_ROUTINES} ${ASSEMBLY_ROUTINES}
) )
target_link_libraries(mbed-psoc6 INTERFACE mbed-cmsis-cortex-m)
# TODO: Include only if mbed-baremetal is not used # TODO: Include only if mbed-baremetal is not used
if("CY_RTOS_AWARE" IN_LIST MBED_CONFIG_DEFINITIONS) if("CY_RTOS_AWARE" IN_LIST MBED_CONFIG_DEFINITIONS)
target_link_libraries(mbed-psoc6 INTERFACE mbed-cy-rtos mbed-cy-rtx) target_link_libraries(mbed-psoc6 INTERFACE mbed-cy-rtos mbed-cy-rtx)

View File

@ -15,3 +15,5 @@ target_sources(mbed-freescale
INTERFACE INTERFACE
USBPhy_Kinetis.cpp USBPhy_Kinetis.cpp
) )
target_link_libraries(mbed-freescale INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_subdirectory(TARGET_GD32F30X EXCLUDE_FROM_ALL) add_subdirectory(TARGET_GD32F30X EXCLUDE_FROM_ALL)
@ -10,3 +10,5 @@ target_include_directories(mbed-gigadevice
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-gigadevice INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
@ -17,3 +17,5 @@ target_sources(mbed-maxim
INTERFACE INTERFACE
USBPhy_Maxim.cpp USBPhy_Maxim.cpp
) )
target_link_libraries(mbed-maxim INTERFACE mbed-cmsis-cortex-m)

View File

@ -9,3 +9,5 @@ target_include_directories(mbed-nordic
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-nordic INTERFACE mbed-cmsis-cortex-m)

View File

@ -16,3 +16,5 @@ target_sources(mbed-nxp
INTERFACE INTERFACE
USBHAL_LPC17.cpp USBHAL_LPC17.cpp
) )
target_link_libraries(mbed-nxp INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_subdirectory(TARGET_RZ_A1XX EXCLUDE_FROM_ALL) add_subdirectory(TARGET_RZ_A1XX EXCLUDE_FROM_ALL)
@ -10,3 +10,5 @@ target_include_directories(mbed-renesas
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-renesas INTERFACE mbed-cmsis-cortex-a)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_subdirectory(TARGET_STM32F0 EXCLUDE_FROM_ALL) add_subdirectory(TARGET_STM32F0 EXCLUDE_FROM_ALL)
@ -51,3 +51,5 @@ target_sources(mbed-stm
us_ticker.c us_ticker.c
watchdog_api.c watchdog_api.c
) )
target_link_libraries(mbed-stm INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(${MBED_TOOLCHAIN} STREQUAL "ARM") if(${MBED_TOOLCHAIN} STREQUAL "ARM")
@ -44,3 +44,5 @@ target_sources(mbed-s1sbp6a
) )
mbed_set_linker_script(mbed-s1sbp6a ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) mbed_set_linker_script(mbed-s1sbp6a ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
target_link_libraries(mbed-s1sbp6a INTERFACE mbed-cmsis-cortex-m)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(${MBED_TOOLCHAIN} STREQUAL "ARM") if(${MBED_TOOLCHAIN} STREQUAL "ARM")
@ -64,4 +64,4 @@ target_sources(mbed-s5js100
mbed_set_linker_script(mbed-s5js100 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) mbed_set_linker_script(mbed-s5js100 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
target_link_libraries(mbed-s5js100) target_link_libraries(mbed-s5js100 INTERFACE mbed-cmsis-cortex-m)

View File

@ -10,3 +10,5 @@ target_include_directories(mbed-silicon-labs
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-silicon-labs INTERFACE mbed-cmsis-cortex-m)

View File

@ -10,3 +10,5 @@ target_include_directories(mbed-toshiba
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-toshiba INTERFACE mbed-cmsis-cortex-m)