mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
stm32/main: Introduce MICROPY_HW_FLASH_MOUNT_AT_BOOT config option.
It's enabled by default to retain the existing behaviour. A board can disable this option if it manages mounting the filesystem itself, for example in frozen code. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -153,7 +153,7 @@ STATIC mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
|
|||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(pyb_main_obj, 1, pyb_main);
|
MP_DEFINE_CONST_FUN_OBJ_KW(pyb_main_obj, 1, pyb_main);
|
||||||
|
|
||||||
#if MICROPY_HW_ENABLE_STORAGE
|
#if MICROPY_HW_FLASH_MOUNT_AT_BOOT
|
||||||
// avoid inlining to avoid stack usage within main()
|
// avoid inlining to avoid stack usage within main()
|
||||||
MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
|
MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
|
||||||
if (reset_mode == 3) {
|
if (reset_mode == 3) {
|
||||||
@@ -530,7 +530,7 @@ soft_reset:
|
|||||||
// Initialise the local flash filesystem.
|
// Initialise the local flash filesystem.
|
||||||
// Create it if needed, mount in on /flash, and set it as current dir.
|
// Create it if needed, mount in on /flash, and set it as current dir.
|
||||||
bool mounted_flash = false;
|
bool mounted_flash = false;
|
||||||
#if MICROPY_HW_ENABLE_STORAGE
|
#if MICROPY_HW_FLASH_MOUNT_AT_BOOT
|
||||||
mounted_flash = init_flash_fs(reset_mode);
|
mounted_flash = init_flash_fs(reset_mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,11 @@
|
|||||||
#define MICROPY_HW_HAS_LCD (0)
|
#define MICROPY_HW_HAS_LCD (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Whether to automatically mount (and boot from) the flash filesystem
|
||||||
|
#ifndef MICROPY_HW_FLASH_MOUNT_AT_BOOT
|
||||||
|
#define MICROPY_HW_FLASH_MOUNT_AT_BOOT (MICROPY_HW_ENABLE_STORAGE)
|
||||||
|
#endif
|
||||||
|
|
||||||
// The volume label used when creating the flash filesystem
|
// The volume label used when creating the flash filesystem
|
||||||
#ifndef MICROPY_HW_FLASH_FS_LABEL
|
#ifndef MICROPY_HW_FLASH_FS_LABEL
|
||||||
#define MICROPY_HW_FLASH_FS_LABEL "pybflash"
|
#define MICROPY_HW_FLASH_FS_LABEL "pybflash"
|
||||||
|
|||||||
Reference in New Issue
Block a user