Skip to content

Commit 7c3a5d6

Browse files
committed
Make the new fs.getFree/mkfs dependent on build flags (not enough space in most normal Espruino builds)
1 parent 60b1f4b commit 7c3a5d6

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README_BuildProcess.md

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ This is a partial list of definitions that can be added in a `BOARD.py` file's `
150150
* `ESPR_TERMNINAL_NO_SCROLL` - disable scrolling in the onscreen terminal (once we get to the end, we just clear the screen and start at the top)
151151
* `ESPR_HAS_BOOTLOADER_UF2` - nRF5x: Allow entering UF2 bootloader mode by calling E.rebootToDFU()
152152
* `ESPR_BLE_PRIVATE_ADDRESS_SUPPORT` - NRF52: Enable support for using a random private BLE address, that automatically changes at a set interval. See the `privacy` option that can be passed to `NRF.setSecurity()`.
153+
* `ESPR_FS_MKFS` - Add support for require("fs").mkfs for formatting disks
154+
* `ESPR_FS_GETFREE` - Add support for require("fs").getFree in the filesystem library
153155

154156

155157
There are some specifically that are useful for cutting a few bytes out of the build:

boards/PIPBOY.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DESPR_PBF_FONTS -DESPR_GRAPHICS_INTERNAL -DESPR_GRAPHICS_SELF_INIT -DESPR_GRAPHICS_NO_SPLASH -DGRAPHICS_FAST_PATHS',
4444
'DEFINES+=-DESPR_SDIO_FAST_UNALIGNED', # see sdio_diskio.c - this is a nasty hack to increase unaligned read speed
4545
'DEFINES+=-DLCD_ORIENTATION_LANDSCAPE',
46+
'DEFINES+=-DESPR_FS_MKFS -DESPR_FS_GETFREE',
4647
'DEFINES+=-DUSE_AUDIO_CODEC',
4748
'DEFINES+=-DESPR_DELAY_MULTIPLIER=28672', # don't work out what to use for jshDelayMicroseconds at boot, just hard-code it
4849
'DEFINES+=-DESPR_RTC_INITIALISE_TICKS=30', # 168Mhz so we need to wait more ticks for the RTC to init (21->2s doesn't seem to be enough - this is nearer 3s!)

libs/filesystem/jswrap_fs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ JsVar *jswrap_fs_stat(JsVar *path) {
382382
"type" : "staticmethod",
383383
"class" : "fs",
384384
"name" : "getFree",
385-
"ifndef" : "SAVE_ON_FLASH",
385+
"ifdef" : "ESPR_FS_GETFREE",
386386
"generate" : "jswrap_fs_getfree",
387387
"params" : [
388388
["path","JsVar","The path specifying the logical drive"]
@@ -492,7 +492,7 @@ bool jswrap_fs_mkdir(JsVar *path) {
492492
"type" : "staticmethod",
493493
"class" : "fs",
494494
"name" : "mkfs",
495-
"ifndef" : "SAVE_ON_FLASH",
495+
"ifdef" : "ESPR_FS_MKFS",
496496
"generate" : "jswrap_fs_mkfs",
497497
"return" : ["bool","True on success, or false on failure"]
498498
}

0 commit comments

Comments
 (0)