summaryrefslogtreecommitdiff
path: root/ports/esp8266/modesp.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-11-15 11:18:09 +1100
committerDamien George <damien@micropython.org>2025-03-06 12:52:35 +1100
commit75ff8e5465c766bad0c79d1a5d98170f27f7070b (patch)
tree4af333457a9efeec2b74bd0680d3b24238a57296 /ports/esp8266/modesp.c
parent0255cb77ccbdf09894e59523aecff24f2caa6352 (diff)
esp8266: Implement vfs.rom_ioctl with support for external flash.
Not enabled by default on any board. For a board to enable ROMFS it must: - Add `#define MICROPY_VFS_ROM (1)` to its `mpconfigboard.h` file. - Add a FLASH_ROMFS partition to the linker script and expose the partition with: _micropy_hw_romfs_start = ORIGIN(FLASH_ROMFS); _micropy_hw_romfs_size = LENGTH(FLASH_ROMFS); Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/esp8266/modesp.c')
-rw-r--r--ports/esp8266/modesp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ports/esp8266/modesp.c b/ports/esp8266/modesp.c
index f303da1a3..c88022945 100644
--- a/ports/esp8266/modesp.c
+++ b/ports/esp8266/modesp.c
@@ -164,9 +164,16 @@ static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
#define IS_OTA_FIRMWARE() ((*(uint32_t *)0x40200000 & 0xff00) == 0x100)
extern byte _firmware_size[];
+#if MICROPY_VFS_ROM_IOCTL
+extern uint8_t _micropy_hw_romfs_size;
+#endif
static mp_obj_t esp_flash_user_start(void) {
- return MP_OBJ_NEW_SMALL_INT((uint32_t)_firmware_size);
+ uint32_t flash_user_start = (uint32_t)_firmware_size;
+ #if MICROPY_VFS_ROM_IOCTL
+ flash_user_start += (uint32_t)&_micropy_hw_romfs_size;
+ #endif
+ return MP_OBJ_NEW_SMALL_INT(flash_user_start);
}
static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);