zephyr/subsys/fs/CMakeLists.txt
Alberto Escolar Piedras ac24d2277e native FUSE FS access: Support any libC and fix random crashes
Split the fuse FS driver into 2 parts: A top built in the embedded side,
with the embedded libC, and a bottom built in the runner side with the
host libC.
The error returns are converted to match the host libC.

Also, before the host FUSE thread, which is asynchronous to Zephyr was
calling directly into the Zephyr filesystem code, which resulted quite
often if catastrophic failures or corruption of the Zephyr state.
This is now fixed by having the FUSE thread queue requests to a Zephyr
thread, which will be handled in the embedded side in a coherent way.
This adds a slightly noticeable overhead, but the performance is still
acceptable.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-08 15:26:29 +01:00

47 lines
1.7 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
if(CONFIG_FILE_SYSTEM_LIB_LINK)
zephyr_interface_library_named(FS)
if(CONFIG_FILE_SYSTEM)
zephyr_library()
zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
zephyr_library_sources(fs.c fs_impl.c)
zephyr_library_sources_ifdef(CONFIG_FAT_FILESYSTEM_ELM fat_fs.c)
zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS littlefs_fs.c)
zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_SHELL shell.c)
zephyr_library_compile_definitions_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS
LFS_CONFIG=zephyr_lfs_config.h
)
endif()
add_subdirectory_ifdef(CONFIG_FILE_SYSTEM_EXT2 ext2)
zephyr_library_link_libraries(FS)
target_link_libraries_ifdef(CONFIG_FAT_FILESYSTEM_ELM FS INTERFACE ELMFAT)
target_link_libraries_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS FS INTERFACE LITTLEFS)
target_link_libraries_ifdef(CONFIG_FILE_SYSTEM_EXT2 FS INTERFACE EXT2)
endif()
add_subdirectory_ifdef(CONFIG_FCB ./fcb)
add_subdirectory_ifdef(CONFIG_NVS ./nvs)
add_subdirectory_ifdef(CONFIG_ZMS ./zms)
if(CONFIG_FUSE_FS_ACCESS)
zephyr_library_named(FS_FUSE)
find_package(PkgConfig REQUIRED)
pkg_search_module(FUSE REQUIRED fuse)
zephyr_include_directories(${FUSE_INCLUDE_DIRS})
if (CONFIG_NATIVE_LIBRARY)
target_link_options(native_simulator INTERFACE "-l${FUSE_LIBRARIES}")
target_sources(native_simulator INTERFACE fuse_fs_access_bottom.c)
target_compile_options(native_simulator INTERFACE "-D_FILE_OFFSET_BITS=64")
else()
zephyr_link_libraries(${FUSE_LIBRARIES})
zephyr_library_sources(fuse_fs_access_bottom.c)
zephyr_library_compile_definitions(_FILE_OFFSET_BITS=64)
endif()
zephyr_library_sources(fuse_fs_access.c)
endif()