|
@@ -8,6 +8,9 @@
|
|
|
#ifndef LFS_UTIL_H
|
|
#ifndef LFS_UTIL_H
|
|
|
#define LFS_UTIL_H
|
|
#define LFS_UTIL_H
|
|
|
|
|
|
|
|
|
|
+#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
|
|
|
|
|
+#define LFS_STRINGIZE2(x) #x
|
|
|
|
|
+
|
|
|
// Users can override lfs_util.h with their own configuration by defining
|
|
// Users can override lfs_util.h with their own configuration by defining
|
|
|
// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h).
|
|
// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h).
|
|
|
//
|
|
//
|
|
@@ -15,11 +18,26 @@
|
|
|
// provided by the config file. To start, I would suggest copying lfs_util.h
|
|
// provided by the config file. To start, I would suggest copying lfs_util.h
|
|
|
// and modifying as needed.
|
|
// and modifying as needed.
|
|
|
#ifdef LFS_CONFIG
|
|
#ifdef LFS_CONFIG
|
|
|
-#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
|
|
|
|
|
-#define LFS_STRINGIZE2(x) #x
|
|
|
|
|
#include LFS_STRINGIZE(LFS_CONFIG)
|
|
#include LFS_STRINGIZE(LFS_CONFIG)
|
|
|
#else
|
|
#else
|
|
|
|
|
|
|
|
|
|
+// Alternatively, users can provide a header file which defines
|
|
|
|
|
+// macros and other things consumed by littlefs.
|
|
|
|
|
+//
|
|
|
|
|
+// For example, provide my_defines.h, which contains
|
|
|
|
|
+// something like:
|
|
|
|
|
+//
|
|
|
|
|
+// #include <stddef.h>
|
|
|
|
|
+// extern void *my_malloc(size_t sz);
|
|
|
|
|
+// #define LFS_MALLOC(sz) my_malloc(sz)
|
|
|
|
|
+//
|
|
|
|
|
+// And build littlefs with the header by defining LFS_DEFINES.
|
|
|
|
|
+// (-DLFS_DEFINES=my_defines.h)
|
|
|
|
|
+
|
|
|
|
|
+#ifdef LFS_DEFINES
|
|
|
|
|
+#include LFS_STRINGIZE(LFS_DEFINES)
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
// System includes
|
|
// System includes
|
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
|
#include <stdbool.h>
|
|
#include <stdbool.h>
|