Skip to content

Commit 6245625

Browse files
committed
Improve file system support
1 parent 5dbbe4a commit 6245625

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

builder/main.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ def get_esptoolpy_reset_flags(resetmethod):
144144
env = DefaultEnvironment()
145145
env.SConscript("compat.py", exports="env")
146146
platform = env.PioPlatform()
147+
board = env.BoardConfig()
148+
filesystem = board.get("build.filesystem", "spiffs")
147149

148150
env.Replace(
149151
__get_flash_size=_get_flash_size,
@@ -161,10 +163,16 @@ def get_esptoolpy_reset_flags(resetmethod):
161163
ARFLAGS=["rc"],
162164

163165
#
164-
# Misc
166+
# Filesystem
165167
#
166168

167-
MKFSTOOL="mklittlefs",
169+
MKFSTOOL="mk%s" % filesystem,
170+
ESP8266_FS_IMAGE_NAME=env.get("ESP8266_FS_IMAGE_NAME", env.get(
171+
"SPIFFSNAME", filesystem)),
172+
173+
#
174+
# Misc
175+
#
168176

169177
SIZEPROGREGEXP=r"^(?:\.irom0\.text|\.text|\.text1|\.data|\.rodata|)\s+([0-9]+).*",
170178
SIZEDATAREGEXP=r"^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*",
@@ -223,14 +231,17 @@ def get_esptoolpy_reset_flags(resetmethod):
223231
target_elf = join("$BUILD_DIR", "${PROGNAME}.elf")
224232
if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
225233
fetch_fs_size(env)
226-
target_firm = join("$BUILD_DIR", "%s.bin" % env.get("FSIMAGENAME", "fs"))
234+
target_firm = join("$BUILD_DIR", "${ESP8266_FS_IMAGE_NAME}.bin")
227235
else:
228236
target_firm = join("$BUILD_DIR", "${PROGNAME}.bin")
229237
else:
230238
target_elf = env.BuildProgram()
231239
if set(["buildfs", "uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
240+
if filesystem not in ("littlefs", "spiffs"):
241+
sys.stderr.write("Filesystem %s is not supported!\n" % filesystem)
242+
env.Exit(1)
232243
target_firm = env.DataToBin(
233-
join("$BUILD_DIR", env.get("FSIMAGENAME", "fs")), "$PROJECTDATA_DIR")
244+
join("$BUILD_DIR", "${ESP8266_FS_IMAGE_NAME}"), "$PROJECTDATA_DIR")
234245
AlwaysBuild(target_firm)
235246
else:
236247
target_firm = env.ElfToBin(

0 commit comments

Comments
 (0)