Skip to content

Commit 9f4acb5

Browse files
phatpauligrr
authored andcommitted
get configuration from sdkconfig.h, if present (igrr#57)
1 parent 2ee9d6c commit 9f4acb5

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

include/sdkconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Dummy file to be replaced by build script.

include/spiffs_config.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,42 @@
1818
#include <stdint.h>
1919
#include <stdbool.h>
2020
#include <unistd.h>
21+
#include <sdkconfig.h>
22+
23+
// Rename defines from menuconfig if present from sdkconfig.h
24+
#ifdef CONFIG_SPIFFS_USE_MAGIC_LENGTH
25+
#define SPIFFS_USE_MAGIC_LENGTH CONFIG_SPIFFS_USE_MAGIC_LENGTH
26+
#endif
27+
#ifdef CONFIG_SPIFFS_CACHE_WR
28+
#define SPIFFS_CACHE_WR CONFIG_SPIFFS_CACHE_WR
29+
#endif
30+
#ifdef CONFIG_SPIFFS_CACHE
31+
#define SPIFFS_CACHE CONFIG_SPIFFS_CACHE
32+
#endif
33+
#ifdef CONFIG_SPIFFS_META_LENGTH
34+
#define SPIFFS_META_LENGTH CONFIG_SPIFFS_META_LENGTH
35+
#endif
36+
#ifdef CONFIG_SPIFFS_USE_MAGIC
37+
#define SPIFFS_USE_MAGIC CONFIG_SPIFFS_USE_MAGIC
38+
#endif
39+
#ifdef CONFIG_SPIFFS_PAGE_CHECK
40+
#define SPIFFS_PAGE_CHECK CONFIG_SPIFFS_PAGE_CHECK
41+
#endif
42+
#ifdef CONFIG_SPIFFS_USE_MTIME
43+
#define SPIFFS_USE_MTIME CONFIG_SPIFFS_USE_MTIME
44+
#endif
45+
#ifdef CONFIG_SPIFFS_GC_MAX_RUNS
46+
#define SPIFFS_GC_MAX_RUNS CONFIG_SPIFFS_GC_MAX_RUNS
47+
#endif
48+
#ifdef CONFIG_SPIFFS_MAX_PARTITIONS
49+
#define SPIFFS_MAX_PARTITIONS CONFIG_SPIFFS_MAX_PARTITIONS
50+
#endif
51+
#ifdef CONFIG_SPIFFS_OBJ_NAME_LEN
52+
#define SPIFFS_OBJ_NAME_LEN CONFIG_SPIFFS_OBJ_NAME_LEN
53+
#endif
54+
#ifdef CONFIG_SPIFFS_PAGE_SIZE
55+
#define SPIFFS_PAGE_SIZE CONFIG_SPIFFS_PAGE_SIZE
56+
#endif
2157

2258
// Set generic spiffs debug output call.
2359
#ifndef SPIFFS_DBG
@@ -99,7 +135,9 @@ typedef uint8_t u8_t;
99135
#endif
100136

101137
// Define maximum number of gc runs to perform to reach desired free pages.
138+
#ifndef SPIFFS_GC_MAX_RUNS
102139
#define SPIFFS_GC_MAX_RUNS 10
140+
#endif
103141

104142
// Enable/disable statistics on gc. Debug/test purpose only.
105143
#ifndef SPIFFS_GC_STATS

0 commit comments

Comments
 (0)