zephyr: move CMake glue code for building as a module into Zephyr
This commit moves the CMakeLists.txt glue code into the Zephyr repo. It removes Zephyr specific patching from lfs_util.h as those are no longer needed when moving the glue code out of the fork. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
0075f5b8a6
commit
7b2cf4ba75
|
@ -1,13 +0,0 @@
|
|||
if(CONFIG_FILE_SYSTEM_LITTLEFS)
|
||||
add_library(LITTLEFS INTERFACE)
|
||||
|
||||
target_include_directories(LITTLEFS INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
zephyr_library()
|
||||
zephyr_library_sources(
|
||||
lfs.c
|
||||
lfs_util.c
|
||||
)
|
||||
zephyr_library_link_libraries(LITTLEFS)
|
||||
target_link_libraries(LITTLEFS INTERFACE zephyr_interface)
|
||||
endif()
|
35
lfs_util.h
35
lfs_util.h
|
@ -29,27 +29,12 @@
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifndef LFS_NO_ASSERT
|
||||
#ifdef __ZEPHYR__
|
||||
#include <sys/__assert.h>
|
||||
#else /* __ZEPHYR__ */
|
||||
#include <assert.h>
|
||||
#endif /* __ZEPHYR__ */
|
||||
#endif
|
||||
|
||||
#if !defined(LFS_NO_DEBUG) || \
|
||||
!defined(LFS_NO_WARN) || \
|
||||
!defined(LFS_NO_ERROR) || \
|
||||
defined(LFS_YES_TRACE)
|
||||
|
||||
#ifdef __ZEPHYR__
|
||||
#include <logging/log.h>
|
||||
|
||||
#ifdef LFS_LOG_REGISTER
|
||||
LOG_MODULE_REGISTER(littlefs, CONFIG_FS_LOG_LEVEL);
|
||||
#endif
|
||||
|
||||
#endif /* __ZEPHYR__ */
|
||||
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
@ -66,13 +51,9 @@ extern "C"
|
|||
// Logging functions
|
||||
#ifndef LFS_TRACE
|
||||
#ifdef LFS_YES_TRACE
|
||||
#ifdef __ZEPHYR__
|
||||
#define LFS_TRACE(fmt, ...) LOG_DBG("%s:%d:trace: " fmt, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else /* __ZEPHYR__ */
|
||||
#define LFS_TRACE_(fmt, ...) \
|
||||
printf("%s:%d:trace: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
|
||||
#endif /* __ZEPHYR__ */
|
||||
#else
|
||||
#define LFS_TRACE(...)
|
||||
#endif
|
||||
|
@ -80,13 +61,9 @@ extern "C"
|
|||
|
||||
#ifndef LFS_DEBUG
|
||||
#ifndef LFS_NO_DEBUG
|
||||
#ifdef __ZEPHYR__
|
||||
#define LFS_DEBUG(fmt, ...) LOG_DBG("%s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else /* __ZEPHYR__ */
|
||||
#define LFS_DEBUG_(fmt, ...) \
|
||||
printf("%s:%d:debug: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define LFS_DEBUG(...) LFS_DEBUG_(__VA_ARGS__, "")
|
||||
#endif /* __ZEPHYR__ */
|
||||
#else
|
||||
#define LFS_DEBUG(...)
|
||||
#endif
|
||||
|
@ -94,13 +71,9 @@ extern "C"
|
|||
|
||||
#ifndef LFS_WARN
|
||||
#ifndef LFS_NO_WARN
|
||||
#ifdef __ZEPHYR__
|
||||
#define LFS_WARN(fmt, ...) LOG_WRN("%s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else /* __ZEPHYR__ */
|
||||
#define LFS_WARN_(fmt, ...) \
|
||||
printf("%s:%d:warn: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define LFS_WARN(...) LFS_WARN_(__VA_ARGS__, "")
|
||||
#endif /* __ZEPHYR__ */
|
||||
#else
|
||||
#define LFS_WARN(...)
|
||||
#endif
|
||||
|
@ -108,13 +81,9 @@ extern "C"
|
|||
|
||||
#ifndef LFS_ERROR
|
||||
#ifndef LFS_NO_ERROR
|
||||
#ifdef __ZEPHYR__
|
||||
#define LFS_ERROR(fmt, ...) LOG_ERR("%s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#else /* __ZEPHYR__ */
|
||||
#define LFS_ERROR_(fmt, ...) \
|
||||
printf("%s:%d:error: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define LFS_ERROR(...) LFS_ERROR_(__VA_ARGS__, "")
|
||||
#endif /* __ZEPHYR__ */
|
||||
#else
|
||||
#define LFS_ERROR(...)
|
||||
#endif
|
||||
|
@ -123,11 +92,7 @@ extern "C"
|
|||
// Runtime assertions
|
||||
#ifndef LFS_ASSERT
|
||||
#ifndef LFS_NO_ASSERT
|
||||
#ifdef __ZEPHYR__
|
||||
#define LFS_ASSERT(test) __ASSERT_NO_MSG(test)
|
||||
#else /* __ZEPHYR__ */
|
||||
#define LFS_ASSERT(test) assert(test)
|
||||
#endif /* __ZEPHYR__ */
|
||||
#else
|
||||
#define LFS_ASSERT(test)
|
||||
#endif
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
build:
|
||||
cmake: .
|
||||
cmake-ext: True
|
||||
kconfig-ext: True
|
||||
|
|
Loading…
Reference in New Issue