CMake: split rtos from core target

Add or remove and directories containing source files, header files, and macro definitions that implement RTOS support.
This includes:
- cmsis/CMSIS_5/CMSIS/RTOS2/
- cmsis/device/rtos/
- rtos/source/ConditionVariable.cpp
- rtos/source/Thread.cpp
pull/13566/head
Rajkumar Kanagaraj 2020-10-16 14:21:21 +01:00 committed by Hugues Kamba
parent 2bab2ba038
commit d2be577b01
7 changed files with 25 additions and 18 deletions

View File

@ -17,6 +17,7 @@ add_library(mbed-core OBJECT)
# TODO CMAKE: Replace mbed-os by a new one that will include mbed-core and mbed-rtos
add_library(mbed-os ALIAS mbed-core)
# Validate selected C library type
# The C library type selected has to match the library that the target can support
if(${MBED_C_LIB} STREQUAL "small")
@ -69,10 +70,12 @@ target_include_directories(mbed-core
${CMAKE_CURRENT_SOURCE_DIR}
)
# TODO CMake: This component is made visible here so its source files in
# drivers/ can be added and it can be linked against by libraries in storage/.
# Should the source files be moved from drivers/ to storage/ ?
# These targets are made visible here so their source files which
# are spread in different directories can be referenced and can be linked against
# by libraries that depend on them.
# TODO CMake: Should the source files be moved?
add_library(mbed-device_key INTERFACE)
add_library(mbed-rtos INTERFACE)
add_subdirectory(cmsis)
add_subdirectory(drivers)
@ -89,6 +92,8 @@ add_subdirectory(drivers/device_key EXCLUDE_FROM_ALL)
add_subdirectory(drivers/source/usb EXCLUDE_FROM_ALL)
add_subdirectory(features EXCLUDE_FROM_ALL)
add_subdirectory(platform/FEATURE_EXPERIMENTAL_API EXCLUDE_FROM_ALL)
add_subdirectory(cmsis/CMSIS_5/CMSIS/RTOS2 EXCLUDE_FROM_ALL)
add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
#
# Configures the application

View File

@ -7,4 +7,3 @@ elseif("CORTEX_M" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_CORTEX_M)
endif()
add_subdirectory(RTOS2)

View File

@ -3,12 +3,12 @@
add_subdirectory(RTX)
target_include_directories(mbed-core
target_include_directories(mbed-rtos
PUBLIC
Include
)
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
Source/os_systick.c
Source/os_tick_ptim.c

View File

@ -19,7 +19,7 @@ function(_mbed_get_cortex_m_exception_handlers toolchain_dir)
set(STARTUP_RTX_FILE TARGET_RTOS_M4_M7/irq_cm4f.S)
endif()
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
Source/${toolchain_dir}/${STARTUP_RTX_FILE}
)
@ -29,7 +29,7 @@ endfunction()
function(_mbed_get_cortex_a_exception_handlers)
foreach(key ${MBED_TARGET_LABELS})
if(${key} STREQUAL CORTEX_A)
target_sources(mbed-core PRIVATE Config/TARGET_CORTEX_A/handlers.c)
target_sources(mbed-rtos PRIVATE Config/TARGET_CORTEX_A/handlers.c)
endif()
endforeach()
endfunction()
@ -44,7 +44,7 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
_mbed_get_cortex_m_exception_handlers(TOOLCHAIN_IAR)
endif()
target_include_directories(mbed-core
target_include_directories(mbed-rtos
PUBLIC
Config
Include
@ -52,7 +52,7 @@ target_include_directories(mbed-core
Source
)
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
Config/RTX_Config.c

View File

@ -2,7 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(RTE)
add_subdirectory(rtos)
target_include_directories(mbed-core
PUBLIC

View File

@ -2,35 +2,35 @@
# SPDX-License-Identifier: Apache-2.0
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c
)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c
)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
target_sources(mbed-core
target_sources(mbed-rtos
PRIVATE
TOOLCHAIN_IAR/mbed_boot_iar.c
)
endif()
target_include_directories(mbed-core
target_include_directories(mbed-rtos
PUBLIC
include
)
target_sources(mbed-core PRIVATE
target_sources(mbed-rtos PRIVATE
source/mbed_boot.c
source/mbed_rtos_rtx.c
source/mbed_rtx_handlers.c
source/mbed_rtx_idle.cpp
)
target_compile_definitions(mbed-core
target_compile_definitions(mbed-rtos
PUBLIC
MBED_CONF_RTOS_PRESENT=1
)

View File

@ -12,12 +12,16 @@ target_include_directories(mbed-core
target_sources(mbed-core
PRIVATE
source/ConditionVariable.cpp
source/EventFlags.cpp
source/Kernel.cpp
source/Mutex.cpp
source/Semaphore.cpp
source/ThisThread.cpp
)
target_sources(mbed-os
PRIVATE
source/ConditionVariable.cpp
source/Thread.cpp
)