From 929adbe936e0978ed10a81ab6751fd35dd5dfff6 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Mon, 20 Jul 2020 17:58:40 +0100 Subject: [PATCH] CMake: Add support for platform dir --- platform/CMakeLists.txt | 11 +++++ platform/cxxsupport/CMakeLists.txt | 12 +++++ platform/source/CMakeLists.txt | 47 +++++++++++++++++++ .../source/TARGET_CORTEX_M/CMakeLists.txt | 24 ++++++++++ platform/source/minimal-printf/CMakeLists.txt | 14 ++++++ 5 files changed, 108 insertions(+) create mode 100644 platform/CMakeLists.txt create mode 100644 platform/cxxsupport/CMakeLists.txt create mode 100644 platform/source/CMakeLists.txt create mode 100644 platform/source/TARGET_CORTEX_M/CMakeLists.txt create mode 100644 platform/source/minimal-printf/CMakeLists.txt diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt new file mode 100644 index 0000000000..02db55173e --- /dev/null +++ b/platform/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(cxxsupport) +add_subdirectory(source) + +target_include_directories(mbed-os + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/internal +) diff --git a/platform/cxxsupport/CMakeLists.txt b/platform/cxxsupport/CMakeLists.txt new file mode 100644 index 0000000000..bc561ac403 --- /dev/null +++ b/platform/cxxsupport/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 + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_sources(mbed-os + PRIVATE + mstd_mutex.cpp +) diff --git a/platform/source/CMakeLists.txt b/platform/source/CMakeLists.txt new file mode 100644 index 0000000000..57da36a921 --- /dev/null +++ b/platform/source/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +mbed_add_cmake_directory_if_labels("TARGET") +add_subdirectory(minimal-printf) + +target_include_directories(mbed-os + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_sources(mbed-os + PRIVATE + ATCmdParser.cpp + CThunkBase.cpp + CriticalSectionLock.cpp + DeepSleepLock.cpp + FileBase.cpp + FileHandle.cpp + FilePath.cpp + FileSystemHandle.cpp + LocalFileSystem.cpp + Stream.cpp + SysTimer.cpp + mbed_alloc_wrappers.cpp + mbed_application.c + mbed_assert.c + mbed_atomic_impl.c + mbed_board.c + mbed_critical.c + mbed_error.c + mbed_error_hist.c + mbed_interface.c + mbed_mem_trace.cpp + mbed_mktime.c + mbed_mpu_mgmt.c + mbed_os_timer.cpp + mbed_poll.cpp + mbed_power_mgmt.c + mbed_retarget.cpp + mbed_rtc_time.cpp + mbed_sdk_boot.c + mbed_semihost_api.c + mbed_stats.c + mbed_thread.cpp + mbed_wait_api_no_rtos.c +) diff --git a/platform/source/TARGET_CORTEX_M/CMakeLists.txt b/platform/source/TARGET_CORTEX_M/CMakeLists.txt new file mode 100644 index 0000000000..2feb874259 --- /dev/null +++ b/platform/source/TARGET_CORTEX_M/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +function(_mbed_set_assembly_source) + if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") + target_sources(mbed-os PRIVATE TOOLCHAIN_GCC/except.S) + elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") + target_sources(mbed-os PRIVATE TOOLCHAIN_ARM/except.S) + elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") + target_sources(mbed-os + PRIVATE + TOOLCHAIN_IAR/except.S + TOOLCHAIN_IAR/cmain.S + ) + endif() +endfunction() + +_mbed_set_assembly_source() + +target_sources(mbed-os + PRIVATE + mbed_fault_handler.c +) diff --git a/platform/source/minimal-printf/CMakeLists.txt b/platform/source/minimal-printf/CMakeLists.txt new file mode 100644 index 0000000000..d9df4f575b --- /dev/null +++ b/platform/source/minimal-printf/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-os + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_sources(mbed-os + PRIVATE + mbed_printf_armlink_overrides.c + mbed_printf_implementation.c + mbed_printf_wrapper.c +)