mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
misc: Remove filesystem initialization functions.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
61adee7bc4
commit
cbd7117159
@ -34,19 +34,11 @@
|
||||
#include "shared/runtime/gchelper.h"
|
||||
#include "shared/runtime/softtimer.h"
|
||||
#include "shared/runtime/pyexec.h"
|
||||
#if MICROPY_HW_USB_MSC
|
||||
#include "extmod/vfs.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
// Fresh filesystem templates.
|
||||
#include "main_py.h"
|
||||
#include "readme_txt.h"
|
||||
#endif
|
||||
#include "omv_boardconfig.h"
|
||||
#include "usbdbg.h"
|
||||
#if OMV_WIFIDBG_ENABLE
|
||||
#include "wifidbg.h"
|
||||
#endif
|
||||
#include "file_utils.h"
|
||||
#include "mp_utils.h"
|
||||
|
||||
void __attribute__((weak)) gc_collect(void) {
|
||||
@ -70,36 +62,6 @@ void __attribute__((weak)) gc_collect(void) {
|
||||
gc_collect_end();
|
||||
}
|
||||
|
||||
#if MICROPY_VFS_FAT
|
||||
extern void __fatal_error();
|
||||
|
||||
int mp_init_filesystem(fs_user_mount_t *vfs) {
|
||||
FIL fp; UINT n;
|
||||
uint8_t working_buf[FF_MAX_SS];
|
||||
if (f_mkfs(&vfs->fatfs, FM_FAT, 0, working_buf, sizeof(working_buf)) != FR_OK) {
|
||||
__fatal_error("Could not create LFS");
|
||||
}
|
||||
|
||||
// Mark FS as OpenMV disk.
|
||||
if (f_stat(&vfs->fatfs, "/.openmv_disk", NULL) != FR_OK) {
|
||||
f_open(&vfs->fatfs, &fp, "/.openmv_disk", FA_WRITE | FA_CREATE_ALWAYS);
|
||||
f_close(&fp);
|
||||
}
|
||||
|
||||
// Create default main.py
|
||||
f_open(&vfs->fatfs, &fp, "/main.py", FA_WRITE | FA_CREATE_ALWAYS);
|
||||
f_write(&fp, fresh_main_py, sizeof(fresh_main_py) - 1 /* don't count null terminator */, &n);
|
||||
f_close(&fp);
|
||||
|
||||
// Create readme file
|
||||
f_open(&vfs->fatfs, &fp, "/README.txt", FA_WRITE | FA_CREATE_ALWAYS);
|
||||
f_write(&fp, fresh_readme_txt, sizeof(fresh_readme_txt) - 1 /* don't count null terminator */, &n);
|
||||
f_close(&fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool mp_exec_bootscript(const char *path, bool interruptible, bool wifidbg_enabled) {
|
||||
nlr_buf_t nlr;
|
||||
bool interrupted = false;
|
||||
|
||||
@ -27,6 +27,5 @@
|
||||
#define __MP_UTILS_H__
|
||||
typedef struct _fs_user_mount_t fs_user_mount_t;
|
||||
void mp_init_gc_stack(void *stack_start, void *stack_end, void *heap_start, void *heap_end, size_t stack_limit);
|
||||
int mp_init_filesystem(fs_user_mount_t *vfs);
|
||||
bool mp_exec_bootscript(const char *path, bool interruptible, bool wifidbg_enabled);
|
||||
#endif // __MP_UTILS_H__
|
||||
|
||||
Loading…
Reference in New Issue
Block a user