Convert storage/ targets into STATIC libraries

pull/15339/head
Jamie Smith 2022-05-29 19:35:07 -07:00 committed by Jay Sridharan
parent 87f0272138
commit bc46f5a3af
23 changed files with 114 additions and 74 deletions

View File

@ -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

View File

@ -10,6 +10,8 @@ if(MBED_OS_ENABLE_TESTS)
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 @@ if("SPIF" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(COMPONENT_SPIF)
endif()
target_include_directories(mbed-storage-blockdevice
INTERFACE
PUBLIC
.
./include
./include/blockdevice
@ -48,7 +49,7 @@ target_include_directories(mbed-storage-blockdevice
)
target_sources(mbed-storage-blockdevice
INTERFACE
PRIVATE
source/BufferedBlockDevice.cpp
source/ChainingBlockDevice.cpp
source/ExhaustibleBlockDevice.cpp
@ -61,3 +62,5 @@ target_sources(mbed-storage-blockdevice
source/SFDP.cpp
source/SlicingBlockDevice.cpp
)
target_link_libraries(mbed-storage-blockdevice PUBLIC mbed-core-flags)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 @@ int I2CEEBlockDevice::_sync()
return 0;
}
rtos::ThisThread::sleep_for(1);
rtos::ThisThread::sleep_for(1s);
}
return BD_ERROR_DEVICE_ERROR;

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -9,24 +9,28 @@ if(MBED_OS_ENABLE_TESTS)
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

View File

@ -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_include_directories(mbed-storage-fat
)
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)

View File

@ -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_include_directories(mbed-storage-littlefs
)
target_sources(mbed-storage-littlefs
INTERFACE
PRIVATE
source/LittleFileSystem.cpp
littlefs/lfs.c
@ -18,7 +20,7 @@ target_sources(mbed-storage-littlefs
)
target_link_libraries(mbed-storage-littlefs
INTERFACE
PUBLIC
mbed-storage-blockdevice
mbed-storage-filesystem
)
)

View File

@ -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_include_directories(mbed-storage-littlefs-v2
)
target_sources(mbed-storage-littlefs-v2
INTERFACE
PRIVATE
source/LittleFileSystem2.cpp
littlefs/lfs2.c
@ -18,7 +20,7 @@ target_sources(mbed-storage-littlefs-v2
)
target_link_libraries(mbed-storage-littlefs-v2
INTERFACE
PUBLIC
mbed-storage-blockdevice
mbed-storage-filesystem
)

View File

@ -9,6 +9,8 @@ if(MBED_OS_ENABLE_TESTS)
endif()
endif()
add_library(mbed-storage-kvstore INTERFACE)
add_subdirectory(tdbstore)
add_subdirectory(filesystemstore)
add_subdirectory(securestore)

View File

@ -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
)

View File

@ -9,20 +9,22 @@ if(MBED_OS_ENABLE_TESTS)
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -9,20 +9,22 @@ if(MBED_OS_ENABLE_TESTS)
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
)

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
target_sources(mbed-storage
INTERFACE
PRIVATE
source/PlatformStorage.cpp
)
@ -34,6 +34,6 @@ if("SPIF" IN_LIST MBED_TARGET_LABELS)
endif()
target_link_libraries(mbed-storage
INTERFACE
PUBLIC
${mbed-storage-libs}
)