diff --git a/cmsis/CMSIS_5/CMSIS/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt new file mode 100644 index 0000000..50fa0ff --- /dev/null +++ b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +mbed_add_cmake_directory_if_labels("TARGET") + +add_subdirectory(RTOS2) diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt new file mode 100644 index 0000000..1bb4d24 --- /dev/null +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(RTX) + +target_include_directories(mbed-os + PUBLIC + Include +) + +target_sources(mbed-os + PRIVATE + Source/os_systick.c + Source/os_tick_ptim.c +) diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt new file mode 100644 index 0000000..2d2ce94 --- /dev/null +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt @@ -0,0 +1,74 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +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) + elseif(${key} STREQUAL M0) + set(STARTUP_RTX_FILE TARGET_M0/irq_cm0.S) + elseif(${key} STREQUAL M0P) + set(STARTUP_RTX_FILE TARGET_M0P/irq_cm0.S) + elseif(${key} STREQUAL M23) + set(STARTUP_RTX_FILE TARGET_M23/irq_armv8mbl.S) + elseif(${key} STREQUAL M3) + set(STARTUP_RTX_FILE TARGET_M3/irq_cm3.S) + elseif(${key} STREQUAL M33) + set(STARTUP_RTX_FILE TARGET_M33/irq_armv8mbl.S) + elseif(${key} STREQUAL RTOS_M4_M7) + set(STARTUP_RTX_FILE TARGET_RTOS_M4_M7/irq_cm4f.S) + endif() + + target_sources(mbed-os + PRIVATE + Source/${toolchain_dir}/${STARTUP_RTX_FILE} + ) + endforeach() +endfunction() + +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) + endif() + endforeach() +endfunction() + +_mbed_get_cortex_a_exception_handlers() + +if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC) +elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_ARM) +elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") + _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_IAR) +endif() + +target_include_directories(mbed-os + PUBLIC + Config + Include + Include1 + Source +) + +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 + Source/rtx_kernel.c + Source/rtx_lib.c + Source/rtx_memory.c + Source/rtx_mempool.c + Source/rtx_msgqueue.c + Source/rtx_mutex.c + Source/rtx_semaphore.c + Source/rtx_system.c + Source/rtx_thread.c + Source/rtx_timer.c +) diff --git a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt new file mode 100644 index 0000000..c740a29 --- /dev/null +++ b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/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/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 0000000..281fe77 --- /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/cmsis/CMSIS_5/CMakeLists.txt b/cmsis/CMSIS_5/CMakeLists.txt new file mode 100644 index 0000000..47b2183 --- /dev/null +++ b/cmsis/CMSIS_5/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(CMSIS) diff --git a/cmsis/CMakeLists.txt b/cmsis/CMakeLists.txt index 3f868a9..026ae16 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 29121cd..0000000 --- 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/TARGET_CORTEX_M/CMakeLists.txt b/cmsis/TARGET_CORTEX_M/CMakeLists.txt deleted file mode 100644 index c244a5c..0000000 --- a/cmsis/TARGET_CORTEX_M/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# 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} -) diff --git a/cmsis/device/CMakeLists.txt b/cmsis/device/CMakeLists.txt new file mode 100644 index 0000000..22811df --- /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/cmsis/device/RTE/CMakeLists.txt b/cmsis/device/RTE/CMakeLists.txt new file mode 100644 index 0000000..0e955b2 --- /dev/null +++ b/cmsis/device/RTE/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-os + PUBLIC + include +) diff --git a/cmsis/device/rtos/CMakeLists.txt b/cmsis/device/rtos/CMakeLists.txt new file mode 100644 index 0000000..3ade863 --- /dev/null +++ b/cmsis/device/rtos/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") + target_sources(mbed-os + PRIVATE + TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c + ) +elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") + target_sources(mbed-os + PRIVATE + TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c + ) +elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") + target_sources(mbed-os + PRIVATE + TOOLCHAIN_IAR/mbed_boot_iar.c + ) +endif() + +target_include_directories(mbed-os + PUBLIC + 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 0000000..eede703 --- /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 29b8692..01696a4 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} diff --git a/rtos/source/TARGET_CORTEX/CMakeLists.txt b/rtos/source/TARGET_CORTEX/CMakeLists.txt deleted file mode 100644 index 2d08035..0000000 --- a/rtos/source/TARGET_CORTEX/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# 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 - TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c - ) -elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - target_sources(mbed-os - PRIVATE - TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c - ) -elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") - target_sources(mbed-os - PRIVATE - TOOLCHAIN_IAR/mbed_boot_iar.c - ) -endif() - -target_include_directories(mbed-os - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - rtx4 -) diff --git a/rtos/source/TARGET_CORTEX/rtx5/CMakeLists.txt b/rtos/source/TARGET_CORTEX/rtx5/CMakeLists.txt deleted file mode 100644 index 1bb4d24..0000000 --- a/rtos/source/TARGET_CORTEX/rtx5/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(RTX) - -target_include_directories(mbed-os - PUBLIC - Include -) - -target_sources(mbed-os - PRIVATE - Source/os_systick.c - Source/os_tick_ptim.c -) diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt b/rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt deleted file mode 100644 index b88041d..0000000 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -function(_mbed_get_rtx_assembly toolchain_dir) - foreach(key ${MBED_TARGET_LABELS}) - if(${key} STREQUAL CORTEX_A) - set(STARTUP_RTX_FILE TARGET_CORTEX_A/irq_ca.S) - elseif(${key} STREQUAL M0) - set(STARTUP_RTX_FILE TARGET_M0/irq_cm0.S) - elseif(${key} STREQUAL M0P) - set(STARTUP_RTX_FILE TARGET_M0P/irq_cm0.S) - elseif(${key} STREQUAL M23) - set(STARTUP_RTX_FILE TARGET_M23/irq_armv8mbl.S) - elseif(${key} STREQUAL M3) - set(STARTUP_RTX_FILE TARGET_M3/irq_cm3.S) - elseif(${key} STREQUAL M33) - set(STARTUP_RTX_FILE TARGET_M33/irq_armv8mbl.S) - elseif(${key} STREQUAL RTOS_M4_M7) - set(STARTUP_RTX_FILE TARGET_RTOS_M4_M7/irq_cm4f.S) - endif() - - target_sources(mbed-os - PRIVATE - Source/${toolchain_dir}/${STARTUP_RTX_FILE} - ) - endforeach() -endfunction() - -function(_mbed_add_cortexa_handler_if) - foreach(key ${MBED_TARGET_LABELS}) - if(${key} STREQUAL CORTEX_A) - target_sources(mbed-os PRIVATE Config/TARGET_CORTEX_A/handlers.c) - endif() - endforeach() -endfunction() - -# Add Cortex A handlers if needed -_mbed_add_cortexa_handler_if() - -if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - _mbed_get_rtx_assembly(TOOLCHAIN_GCC) -elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - _mbed_get_rtx_assembly(TOOLCHAIN_ARM) -elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") - _mbed_get_rtx_assembly(TOOLCHAIN_IAR) -endif() - -target_include_directories(mbed-os - PUBLIC - Config - Include - Source -) - -target_sources(mbed-os - PRIVATE - Config/RTX_Config.c - - Source/rtx_delay.c - Source/rtx_evflags.c - Source/rtx_evr.c - Source/rtx_kernel.c - Source/rtx_lib.c - Source/rtx_memory.c - Source/rtx_mempool.c - Source/rtx_msgqueue.c - Source/rtx_mutex.c - Source/rtx_semaphore.c - Source/rtx_system.c - Source/rtx_thread.c - Source/rtx_timer.c -) diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt b/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt deleted file mode 100644 index f403f3a..0000000 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -mbed_add_cmake_directory_if_labels("TARGET") diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt b/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt deleted file mode 100644 index f403f3a..0000000 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -mbed_add_cmake_directory_if_labels("TARGET") diff --git a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt b/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt deleted file mode 100644 index f403f3a..0000000 --- a/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -mbed_add_cmake_directory_if_labels("TARGET")