mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Create fresh filesystem contents for Nano RP2040.
This commit is contained in:
parent
165d3ac712
commit
a0504eda90
@ -68,6 +68,12 @@
|
|||||||
#include "py_audio.h"
|
#include "py_audio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC
|
||||||
|
#include "extmod/vfs.h"
|
||||||
|
#include "extmod/vfs_fat.h"
|
||||||
|
#include "common/factoryreset.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern uint8_t __StackTop, __StackBottom;
|
extern uint8_t __StackTop, __StackBottom;
|
||||||
static char OMV_ATTR_SECTION(OMV_ATTR_ALIGNED(gc_heap[OMV_HEAP_SIZE], 4), ".heap");
|
static char OMV_ATTR_SECTION(OMV_ATTR_ALIGNED(gc_heap[OMV_HEAP_SIZE], 4), ".heap");
|
||||||
|
|
||||||
@ -128,7 +134,6 @@ void exec_boot_script(const char *path, bool interruptible)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
bool first_soft_reset = true;
|
bool first_soft_reset = true;
|
||||||
|
|
||||||
@ -204,9 +209,17 @@ soft_reset:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Execute _boot.py to set up the filesystem.
|
|
||||||
#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC
|
#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC
|
||||||
pyexec_frozen_module("_boot_fat.py", false);
|
// Mount or create a fresh filesystem.
|
||||||
|
mp_obj_t mount_point = MP_OBJ_NEW_QSTR(MP_QSTR__slash_);
|
||||||
|
mp_obj_t bdev = rp2_flash_type.make_new(&rp2_flash_type, 0, 0, NULL);
|
||||||
|
if (mp_vfs_mount_and_chdir_protected(bdev, mount_point) == -MP_ENODEV) {
|
||||||
|
// Create a fresh filesystem.
|
||||||
|
fs_user_mount_t *vfs = mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev);
|
||||||
|
if (factoryreset_create_filesystem(vfs) == 0) {
|
||||||
|
mp_vfs_mount_and_chdir_protected(bdev, mount_point);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
pyexec_frozen_module("_boot.py", false);
|
pyexec_frozen_module("_boot.py", false);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user