diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index e27f47d..b795186 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -2,29 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # List of all storage libraries available. -add_library(mbed-storage INTERFACE) - -add_library(mbed-storage-blockdevice INTERFACE) -add_library(mbed-storage-dataflash INTERFACE) -add_library(mbed-storage-flashiap INTERFACE) -add_library(mbed-storage-i2cee INTERFACE) -add_library(mbed-storage-ospif INTERFACE) -add_library(mbed-storage-qspif INTERFACE) -add_library(mbed-storage-sd INTERFACE) -add_library(mbed-storage-spif INTERFACE) - -add_library(mbed-storage-filesystem INTERFACE) -add_library(mbed-storage-littlefs-v2 INTERFACE) -add_library(mbed-storage-littlefs INTERFACE) -add_library(mbed-storage-fat INTERFACE) - -add_library(mbed-storage-kvstore INTERFACE) -add_library(mbed-storage-tdbstore INTERFACE) -add_library(mbed-storage-filesystemstore INTERFACE) -add_library(mbed-storage-securestore INTERFACE) -add_library(mbed-storage-kv-config INTERFACE) -add_library(mbed-storage-direct-access-devicekey INTERFACE) -add_library(mbed-storage-kv-global-api INTERFACE) +add_library(mbed-storage STATIC EXCLUDE_FROM_ALL) if(${CMAKE_CROSSCOMPILING}) # The directories below contain optional target libraries diff --git a/storage/blockdevice/CMakeLists.txt b/storage/blockdevice/CMakeLists.txt index cf10ad3..fd1c333 100644 --- a/storage/blockdevice/CMakeLists.txt +++ b/storage/blockdevice/CMakeLists.txt @@ -10,6 +10,8 @@ endif() endif() +add_library(mbed-storage-blockdevice STATIC EXCLUDE_FROM_ALL) + if("DATAFLASH" IN_LIST MBED_TARGET_LABELS) add_subdirectory(COMPONENT_DATAFLASH) endif() @@ -38,9 +40,8 @@ add_subdirectory(COMPONENT_SPIF) endif() - target_include_directories(mbed-storage-blockdevice - INTERFACE + PUBLIC . ./include ./include/blockdevice @@ -48,7 +49,7 @@ ) target_sources(mbed-storage-blockdevice - INTERFACE + PRIVATE source/BufferedBlockDevice.cpp source/ChainingBlockDevice.cpp source/ExhaustibleBlockDevice.cpp @@ -61,3 +62,5 @@ source/SFDP.cpp source/SlicingBlockDevice.cpp ) + +target_link_libraries(mbed-storage-blockdevice PUBLIC mbed-core-flags) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_DATAFLASH/CMakeLists.txt b/storage/blockdevice/COMPONENT_DATAFLASH/CMakeLists.txt index fb0eb3e..fe5760ea 100644 --- a/storage/blockdevice/COMPONENT_DATAFLASH/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_DATAFLASH/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-dataflash STATIC EXCLUDE_FROM_ALL) + target_sources(mbed-storage-dataflash - INTERFACE + PRIVATE source/DataFlashBlockDevice.cpp ) target_include_directories(mbed-storage-dataflash - INTERFACE + PUBLIC include include/DataFlash ) + +target_link_libraries(mbed-storage-dataflash PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_FLASHIAP/CMakeLists.txt b/storage/blockdevice/COMPONENT_FLASHIAP/CMakeLists.txt index c69d226..2d324bb 100644 --- a/storage/blockdevice/COMPONENT_FLASHIAP/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_FLASHIAP/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-flashiap STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-flashiap - INTERFACE + PUBLIC include include/FlashIAP ) target_sources(mbed-storage-flashiap - INTERFACE + PRIVATE source/FlashIAPBlockDevice.cpp ) + +target_link_libraries(mbed-storage-flashiap PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_I2CEE/CMakeLists.txt b/storage/blockdevice/COMPONENT_I2CEE/CMakeLists.txt index 27a67b5..e300e5c 100644 --- a/storage/blockdevice/COMPONENT_I2CEE/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_I2CEE/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-i2cee STATIC EXCLUDE_FROM_ALL) + target_sources(mbed-storage-i2cee - INTERFACE + PRIVATE source/I2CEEBlockDevice.cpp ) target_include_directories(mbed-storage-i2cee - INTERFACE + PUBLIC include include/I2CEE ) + +target_link_libraries(mbed-storage-i2cee PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp b/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp index 97174a9..f2825ff 100644 --- a/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp @@ -17,6 +17,7 @@ #include "I2CEEBlockDevice.h" #include "rtos/ThisThread.h" using namespace mbed; +using namespace std::chrono_literals; #define I2CEE_TIMEOUT 10000 @@ -156,7 +157,7 @@ return 0; } - rtos::ThisThread::sleep_for(1); + rtos::ThisThread::sleep_for(1s); } return BD_ERROR_DEVICE_ERROR; diff --git a/storage/blockdevice/COMPONENT_OSPIF/CMakeLists.txt b/storage/blockdevice/COMPONENT_OSPIF/CMakeLists.txt index 0cd3807..91df7e7 100644 --- a/storage/blockdevice/COMPONENT_OSPIF/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_OSPIF/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-ospif STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-ospif - INTERFACE + PUBLIC include include/OSPIF ) target_sources(mbed-storage-ospif - INTERFACE + PRIVATE source/OSPIFBlockDevice.cpp ) + +target_link_libraries(mbed-storage-ospif PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt index 22f0de6..b4327da 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt @@ -1,17 +1,21 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-qspif STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-qspif - INTERFACE + PUBLIC include include/QSPIF ) target_sources(mbed-storage-qspif - INTERFACE + PRIVATE source/QSPIFBlockDevice.cpp ) +target_link_libraries(mbed-storage-qspif PUBLIC mbed-storage-blockdevice) + if(MBED_OS_ENABLE_TESTS) if (NOT BUILD_GREENTEA_TESTS) add_subdirectory(UNITTESTS) diff --git a/storage/blockdevice/COMPONENT_SD/CMakeLists.txt b/storage/blockdevice/COMPONENT_SD/CMakeLists.txt index 19f4986..ded1af9 100644 --- a/storage/blockdevice/COMPONENT_SD/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_SD/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-sd STATIC EXCLUDE_FROM_ALL) + target_sources(mbed-storage-sd - INTERFACE + PRIVATE source/SDBlockDevice.cpp ) target_include_directories(mbed-storage-sd - INTERFACE + PUBLIC include include/SD ) + +target_link_libraries(mbed-storage-sd PUBLIC mbed-storage-blockdevice) diff --git a/storage/blockdevice/COMPONENT_SPIF/CMakeLists.txt b/storage/blockdevice/COMPONENT_SPIF/CMakeLists.txt index 4623ce8..1daa631 100644 --- a/storage/blockdevice/COMPONENT_SPIF/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_SPIF/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-spif STATIC EXCLUDE_FROM_ALL) + target_sources(mbed-storage-spif - INTERFACE + PRIVATE source/SPIFBlockDevice.cpp ) target_include_directories(mbed-storage-spif - INTERFACE + PUBLIC include include/SPIF ) + +target_link_libraries(mbed-storage-spif PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_SPINAND/CMakeLists.txt b/storage/blockdevice/COMPONENT_SPINAND/CMakeLists.txt index b743bee..87c929b 100644 --- a/storage/blockdevice/COMPONENT_SPINAND/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_SPINAND/CMakeLists.txt @@ -1,13 +1,17 @@ # Copyright (c) 2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-spinand STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-spinand - INTERFACE + PUBLIC include include/SPINAND ) target_sources(mbed-storage-spinand - INTERFACE + PRIVATE source/SPINANDBlockDevice.cpp ) + +target_link_libraries(mbed-storage-spinand PUBLIC mbed-storage-blockdevice) \ No newline at end of file diff --git a/storage/filesystem/CMakeLists.txt b/storage/filesystem/CMakeLists.txt index c2b2f4f..9f9ea49 100644 --- a/storage/filesystem/CMakeLists.txt +++ b/storage/filesystem/CMakeLists.txt @@ -9,24 +9,28 @@ endif() endif() +add_library(mbed-storage-filesystem STATIC EXCLUDE_FROM_ALL) + add_subdirectory(fat) add_subdirectory(littlefs) add_subdirectory(littlefsv2) target_include_directories(mbed-storage-filesystem - INTERFACE + PUBLIC . ./include ./include/filesystem ) target_sources(mbed-storage-filesystem - INTERFACE + PRIVATE source/Dir.cpp source/File.cpp source/FileSystem.cpp ) +target_link_libraries(mbed-storage-filesystem PUBLIC mbed-storage-blockdevice) + target_compile_definitions(mbed-storage INTERFACE MBED_CONF_FILESYSTEM_PRESENT=1 diff --git a/storage/filesystem/fat/CMakeLists.txt b/storage/filesystem/fat/CMakeLists.txt index c7d6cc1..1ce154c 100644 --- a/storage/filesystem/fat/CMakeLists.txt +++ b/storage/filesystem/fat/CMakeLists.txt @@ -1,8 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-fat STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-fat - INTERFACE + PUBLIC . ./include ./include/fat @@ -10,9 +12,11 @@ ) target_sources(mbed-storage-fat - INTERFACE + PRIVATE source/FATFileSystem.cpp ChaN/ff.cpp ChaN/ffunicode.cpp ) + +target_link_libraries(mbed-storage-fat PUBLIC mbed-storage-filesystem) \ No newline at end of file diff --git a/storage/filesystem/littlefs/CMakeLists.txt b/storage/filesystem/littlefs/CMakeLists.txt index fde273d..9aa592f 100644 --- a/storage/filesystem/littlefs/CMakeLists.txt +++ b/storage/filesystem/littlefs/CMakeLists.txt @@ -1,8 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-littlefs STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-littlefs - INTERFACE + PUBLIC . ./include ./include/littlefs @@ -10,7 +12,7 @@ ) target_sources(mbed-storage-littlefs - INTERFACE + PRIVATE source/LittleFileSystem.cpp littlefs/lfs.c @@ -18,7 +20,7 @@ ) target_link_libraries(mbed-storage-littlefs - INTERFACE + PUBLIC mbed-storage-blockdevice mbed-storage-filesystem -) +) \ No newline at end of file diff --git a/storage/filesystem/littlefsv2/CMakeLists.txt b/storage/filesystem/littlefsv2/CMakeLists.txt index 812c005..4522728 100644 --- a/storage/filesystem/littlefsv2/CMakeLists.txt +++ b/storage/filesystem/littlefsv2/CMakeLists.txt @@ -1,8 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-littlefs-v2 STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-littlefs-v2 - INTERFACE + PUBLIC . ./include ./include/littlefsv2 @@ -10,7 +12,7 @@ ) target_sources(mbed-storage-littlefs-v2 - INTERFACE + PRIVATE source/LittleFileSystem2.cpp littlefs/lfs2.c @@ -18,7 +20,7 @@ ) target_link_libraries(mbed-storage-littlefs-v2 - INTERFACE + PUBLIC mbed-storage-blockdevice mbed-storage-filesystem ) diff --git a/storage/kvstore/CMakeLists.txt b/storage/kvstore/CMakeLists.txt index dfb078a..790ea5e 100644 --- a/storage/kvstore/CMakeLists.txt +++ b/storage/kvstore/CMakeLists.txt @@ -9,6 +9,8 @@ endif() endif() +add_library(mbed-storage-kvstore INTERFACE) + add_subdirectory(tdbstore) add_subdirectory(filesystemstore) add_subdirectory(securestore) diff --git a/storage/kvstore/direct_access_devicekey/CMakeLists.txt b/storage/kvstore/direct_access_devicekey/CMakeLists.txt index 3ce9524..ce22b98 100644 --- a/storage/kvstore/direct_access_devicekey/CMakeLists.txt +++ b/storage/kvstore/direct_access_devicekey/CMakeLists.txt @@ -1,20 +1,22 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-direct-access-devicekey STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-direct-access-devicekey - INTERFACE + PUBLIC . include include/direct_access_devicekey ) target_sources(mbed-storage-direct-access-devicekey - INTERFACE + PRIVATE source/DirectAccessDevicekey.cpp ) target_link_libraries(mbed-storage-direct-access-devicekey - INTERFACE + PUBLIC mbed-storage-kvstore mbed-storage-kv-config ) diff --git a/storage/kvstore/filesystemstore/CMakeLists.txt b/storage/kvstore/filesystemstore/CMakeLists.txt index 70453fd..633a446 100644 --- a/storage/kvstore/filesystemstore/CMakeLists.txt +++ b/storage/kvstore/filesystemstore/CMakeLists.txt @@ -9,20 +9,22 @@ endif() endif() +add_library(mbed-storage-filesystemstore STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-filesystemstore - INTERFACE + PUBLIC . include include/filesystemstore ) target_sources(mbed-storage-filesystemstore - INTERFACE + PRIVATE source/FileSystemStore.cpp ) target_link_libraries(mbed-storage-filesystemstore - INTERFACE + PUBLIC mbed-storage-kvstore mbed-storage-filesystem mbed-storage-kv-config diff --git a/storage/kvstore/kv_config/CMakeLists.txt b/storage/kvstore/kv_config/CMakeLists.txt index 131bfea..cdc34d2 100644 --- a/storage/kvstore/kv_config/CMakeLists.txt +++ b/storage/kvstore/kv_config/CMakeLists.txt @@ -1,20 +1,22 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-kv-config STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-kv-config - INTERFACE + PUBLIC . include include/kv_config ) target_sources(mbed-storage-kv-config - INTERFACE + PRIVATE source/kv_config.cpp ) target_link_libraries(mbed-storage-kv-config - INTERFACE + PUBLIC mbed-storage-kvstore mbed-storage-blockdevice mbed-storage-tdbstore diff --git a/storage/kvstore/kvstore_global_api/CMakeLists.txt b/storage/kvstore/kvstore_global_api/CMakeLists.txt index 3519665..0287052 100644 --- a/storage/kvstore/kvstore_global_api/CMakeLists.txt +++ b/storage/kvstore/kvstore_global_api/CMakeLists.txt @@ -1,21 +1,23 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-kv-global-api STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-kv-global-api - INTERFACE + PUBLIC . include include/kvstore_global_api ) target_sources(mbed-storage-kv-global-api - INTERFACE + PRIVATE source/KVMap.cpp source/kvstore_global_api.cpp ) target_link_libraries(mbed-storage-kv-global-api - INTERFACE + PUBLIC mbed-storage-kvstore mbed-storage-kv-config mbed-storage-blockdevice diff --git a/storage/kvstore/securestore/CMakeLists.txt b/storage/kvstore/securestore/CMakeLists.txt index b6664e2..9d18a8f 100644 --- a/storage/kvstore/securestore/CMakeLists.txt +++ b/storage/kvstore/securestore/CMakeLists.txt @@ -1,20 +1,22 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-storage-securestore STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-securestore - INTERFACE + PUBLIC . include include/securestore ) target_sources(mbed-storage-securestore - INTERFACE + PRIVATE source/SecureStore.cpp ) target_link_libraries(mbed-storage-securestore - INTERFACE + PUBLIC mbed-storage-kvstore mbed-device_key mbed-mbedtls diff --git a/storage/kvstore/tdbstore/CMakeLists.txt b/storage/kvstore/tdbstore/CMakeLists.txt index f324732..048c909 100644 --- a/storage/kvstore/tdbstore/CMakeLists.txt +++ b/storage/kvstore/tdbstore/CMakeLists.txt @@ -9,20 +9,22 @@ endif() endif() +add_library(mbed-storage-tdbstore STATIC EXCLUDE_FROM_ALL) + target_include_directories(mbed-storage-tdbstore - INTERFACE + PUBLIC . include include/tdbstore ) target_sources(mbed-storage-tdbstore - INTERFACE + PRIVATE source/TDBStore.cpp ) target_link_libraries(mbed-storage-tdbstore - INTERFACE + PUBLIC mbed-storage-kvstore mbed-storage-blockdevice ) diff --git a/storage/platform/CMakeLists.txt b/storage/platform/CMakeLists.txt index dbae278..bb6355a 100644 --- a/storage/platform/CMakeLists.txt +++ b/storage/platform/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 target_sources(mbed-storage - INTERFACE + PRIVATE source/PlatformStorage.cpp ) @@ -34,6 +34,6 @@ endif() target_link_libraries(mbed-storage - INTERFACE + PUBLIC ${mbed-storage-libs} )