Skip to content

Commit 4d4b900

Browse files
feat: add storage_compact.c (#39)
Compact storage implementation used for the Nordic Semiconductor nRF91 Series SoftSIM project.
1 parent 7857c59 commit 4d4b900

File tree

3 files changed

+462
-3
lines changed

3 files changed

+462
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ option(CONFIG_EXTERNAL_CRYPTO_IMPL "Use external crypto implementations")
1616
option(CONFIG_EXTERNAL_KEY_LOAD "Use crypto exstension for loading keys")
1717
option(CONFIG_USE_UTILS "Use the extra functionality found in the collective utils folder")
1818
option(CONFIG_NO_DEFAULT_IMPL "Build with no default implementation")
19+
option(CONFIG_COMPACT_STORAGE "Build with compact storage implementation")
1920
option(CONFIG_BUILD_LIB_ONLY "Build libraries only")
2021

2122
set(CONFIG_SS_STORAGE_PATH_DEFAULT "./files" CACHE STRING "Default storage path for SoftSIM filesystem")
@@ -46,6 +47,11 @@ if(CONFIG_EXTERNAL_CRYPTO_IMPL)
4647
add_compile_definitions(CONFIG_EXTERNAL_CRYPTO_IMPL)
4748
endif()
4849

50+
if(CONFIG_COMPACT_STORAGE)
51+
message(STATUS "Using compact storage implementation (from nRF91 SoftSIM project)")
52+
add_compile_definitions(CONFIG_COMPACT_STORAGE)
53+
endif()
54+
4955
if(CONFIG_EXTERNAL_KEY_LOAD)
5056
add_compile_definitions(CONFIG_EXTERNAL_KEY_LOAD)
5157
endif()

src/softsim/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ add_subdirectory(crypto)
55
add_subdirectory(milenage)
66
add_subdirectory(uicc)
77

8-
add_library(storage STATIC storage.c
9-
$<$<NOT:$<BOOL:${CONFIG_NO_DEFAULT_IMPL}>>:fs.c>)
8+
if(CONFIG_COMPACT_STORAGE)
9+
set(storage_sources storage_compact.c)
10+
else()
11+
set(storage_sources storage.c)
12+
if(NOT CONFIG_NO_DEFAULT_IMPL)
13+
list(APPEND storage_sources fs.c)
14+
endif()
15+
endif()
16+
17+
add_library(storage STATIC ${storage_sources})
18+
1019
target_include_directories(storage PUBLIC ${PROJECT_SOURCE_DIR}/include)
1120

1221
if(NOT CONFIG_BUILD_LIB_ONLY)
1322
add_executable(softsim main.c)
1423
target_link_libraries(softsim uicc milenage crypto storage $<$<TARGET_EXISTS:utils>:utils>)
1524
endif()
16-

0 commit comments

Comments
 (0)