Files
micropython/ports/zephyr/Kconfig
Ned Konz 7090fc5dd6 zephyr: Mount all disks and flash partition, formatting if necessary.
Existing C code in `main.c` only mounts a flash filesystem if one exists,
and doesn't do anything if the 'storage' partition is not formatted.

This commit moves the mounting logic from `main.c` to frozen code using
`modules/_boot.py` and adds the formatting of a previously unformatted
partition if the mount fails.

Every available disk (in the newly added `DiskAccess.disks` tuple) will be
mounted on separate mount points (if they're formatted), and the 'storage'
flash partition (if any) will be mounted on /flash (and will be formatted
as LFS2 if necessary).

Also, `sys.path` will be updated with appropriate 'lib' subdirectories for
each mounted filesystem.

The current working directory will be changed to the last `DiskAccess.disk`
mounted, or to /flash if no disks were mounted.

Then `boot.py` and `main.py` will be executed from the current working
directory if they exist.

Thanks to @VynDragon for the logic in `zephyr/zephyr_storage.c`.

Signed-off-by: Ned Konz <ned@metamagix.tech>
2025-10-22 10:22:48 +11:00

64 lines
1.9 KiB
Plaintext

# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright 2020 NXP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
menu "MicroPython Options"
config MICROPY_CONFIGFILE
string "Configuration file"
default "mpconfigport_minimal.h"
config MICROPY_HEAP_SIZE
int "Heap size"
default 49152
config MICROPY_VFS_FAT
bool "FatFS file system"
config MICROPY_VFS_LFS1
bool "LittleFs version 1 file system"
config MICROPY_VFS_LFS2
bool "LittleFs version 2 file system"
config MICROPY_FROZEN_MODULES
bool "Enable Frozen Modules"
default y if FLASH_MAP || DISK_ACCESS
config MICROPY_FROZEN_MANIFEST
string "Path to Frozen Modules manifest.py"
depends on MICROPY_FROZEN_MODULES
default "boards/manifest.py"
config MICROPY_USB_DEVICE_VID
hex "USB VID"
default 0x2fe3
config MICROPY_USB_DEVICE_PID
hex "USB PID"
default 0x0001
endmenu # MicroPython Options
source "Kconfig.zephyr"