diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt similarity index 84% rename from rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt rename to cmsis/CMSIS_5/CMSIS/CMakeLists.txt index f403f3ac48..50fa0ff0a3 100644 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt @@ -2,3 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 mbed_add_cmake_directory_if_labels("TARGET") + +add_subdirectory(RTOS2) diff --git a/rtos/source/TARGET_CORTEX/rtx5/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt similarity index 100% rename from rtos/source/TARGET_CORTEX/rtx5/CMakeLists.txt rename to cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt similarity index 83% rename from rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt rename to cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt index b88041d6cb..2d2ce9457c 100644 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -function(_mbed_get_rtx_assembly toolchain_dir) +function(_mbed_get_cortex_m_exception_handlers toolchain_dir) foreach(key ${MBED_TARGET_LABELS}) if(${key} STREQUAL CORTEX_A) set(STARTUP_RTX_FILE TARGET_CORTEX_A/irq_ca.S) @@ -26,7 +26,7 @@ function(_mbed_get_rtx_assembly toolchain_dir) endforeach() endfunction() -function(_mbed_add_cortexa_handler_if) +function(_mbed_get_cortex_a_exception_handlers) foreach(key ${MBED_TARGET_LABELS}) if(${key} STREQUAL CORTEX_A) target_sources(mbed-os PRIVATE Config/TARGET_CORTEX_A/handlers.c) @@ -34,21 +34,21 @@ function(_mbed_add_cortexa_handler_if) endforeach() endfunction() -# Add Cortex A handlers if needed -_mbed_add_cortexa_handler_if() +_mbed_get_cortex_a_exception_handlers() if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - _mbed_get_rtx_assembly(TOOLCHAIN_GCC) + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC) elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - _mbed_get_rtx_assembly(TOOLCHAIN_ARM) + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_ARM) elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") - _mbed_get_rtx_assembly(TOOLCHAIN_IAR) + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_IAR) endif() target_include_directories(mbed-os PUBLIC Config Include + Include1 Source ) @@ -56,6 +56,8 @@ target_sources(mbed-os PRIVATE Config/RTX_Config.c + Library/cmsis_os1.c + Source/rtx_delay.c Source/rtx_evflags.c Source/rtx_evr.c diff --git a/cmsis/TARGET_CORTEX_M/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt similarity index 74% rename from cmsis/TARGET_CORTEX_M/CMakeLists.txt rename to cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt index c244a5cb11..c740a29008 100644 --- a/cmsis/TARGET_CORTEX_M/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_sources(mbed-os - PRIVATE - mbed_tz_context.c -) - target_include_directories(mbed-os PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} + Include +) + +target_sources(mbed-os + PRIVATE + Source/irq_ctrl_gic.c ) diff --git a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt new file mode 100644 index 0000000000..281fe7731b --- /dev/null +++ b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-os + PUBLIC + Include +) + +target_sources(mbed-os + PRIVATE + Source/mbed_tz_context.c +) diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt b/cmsis/CMSIS_5/CMakeLists.txt similarity index 67% rename from rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt rename to cmsis/CMSIS_5/CMakeLists.txt index f403f3ac48..47b2183f3f 100644 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMakeLists.txt @@ -1,4 +1,4 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -mbed_add_cmake_directory_if_labels("TARGET") +add_subdirectory(CMSIS) diff --git a/cmsis/CMakeLists.txt b/cmsis/CMakeLists.txt index 3f868a9d99..026ae16635 100644 --- a/cmsis/CMakeLists.txt +++ b/cmsis/CMakeLists.txt @@ -1,13 +1,5 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -mbed_add_cmake_directory_if_labels("TARGET") - -target_sources(mbed-os - PRIVATE - RTE_Components.h -) - -target_include_directories(mbed-os - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} -) +add_subdirectory(CMSIS_5) +add_subdirectory(device) diff --git a/cmsis/TARGET_CORTEX_A/CMakeLists.txt b/cmsis/TARGET_CORTEX_A/CMakeLists.txt deleted file mode 100644 index 29121cd588..0000000000 --- a/cmsis/TARGET_CORTEX_A/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -target_sources(mbed-os - PRIVATE - irq_ctrl_gic.c -) - -if(${MBED_TOOLCHAIN} STREQUAL "IAR") - target_sources(mbed-os - PRIVATE - TOOLCHAIN_IAR/cmain.S - ) -endif() - -target_include_directories(mbed-os - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} -) diff --git a/cmsis/device/CMakeLists.txt b/cmsis/device/CMakeLists.txt new file mode 100644 index 0000000000..22811df2f7 --- /dev/null +++ b/cmsis/device/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(RTE) +add_subdirectory(rtos) + +target_include_directories(mbed-os + PUBLIC + . +) diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt b/cmsis/device/RTE/CMakeLists.txt similarity index 59% rename from rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt rename to cmsis/device/RTE/CMakeLists.txt index f403f3ac48..0e955b22d6 100644 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt +++ b/cmsis/device/RTE/CMakeLists.txt @@ -1,4 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -mbed_add_cmake_directory_if_labels("TARGET") +target_include_directories(mbed-os + PUBLIC + include +) diff --git a/rtos/source/TARGET_CORTEX/CMakeLists.txt b/cmsis/device/rtos/CMakeLists.txt similarity index 79% rename from rtos/source/TARGET_CORTEX/CMakeLists.txt rename to cmsis/device/rtos/CMakeLists.txt index 2d08035a66..3ade863e58 100644 --- a/rtos/source/TARGET_CORTEX/CMakeLists.txt +++ b/cmsis/device/rtos/CMakeLists.txt @@ -1,15 +1,6 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_sources(mbed-os PRIVATE - mbed_boot.c - mbed_rtos_rtx.c - mbed_rtx_handlers.c - mbed_rtx_idle.cpp -) - -add_subdirectory(rtx5) - if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") target_sources(mbed-os PRIVATE @@ -29,6 +20,12 @@ endif() target_include_directories(mbed-os PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - rtx4 + include +) + +target_sources(mbed-os PRIVATE + source/mbed_boot.c + source/mbed_rtos_rtx.c + source/mbed_rtx_handlers.c + source/mbed_rtx_idle.cpp ) diff --git a/platform/source/TARGET_CORTEX_A/CMakeLists.txt b/platform/source/TARGET_CORTEX_A/CMakeLists.txt new file mode 100644 index 0000000000..eede703de3 --- /dev/null +++ b/platform/source/TARGET_CORTEX_A/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +function(_mbed_get_system_init) + if(${MBED_TOOLCHAIN} STREQUAL "IAR") + target_sources(mbed-os PRIVATE TOOLCHAIN_IAR/cmain.S) + endif() +endfunction() + +_mbed_get_system_init() diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt index 29b8692d11..01696a4350 100644 --- a/rtos/CMakeLists.txt +++ b/rtos/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -add_subdirectory(source/TARGET_CORTEX) - target_include_directories(mbed-os PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}