Commit 7b6ad0ce authored by Glenn Ruben Bakke's avatar Glenn Ruben Bakke Committed by Damien George

nrf/modules/scripts: Add file system formatting script.

Add a helper script _mkfs.py which automatically formats the file system if
nrf.Flash() is located and a VFS file system has been included in the
compilation.

The precedence is: first LFS1, LFS2 then FAT.
parent ffc636de
import uos, nrf
try:
from uos import VfsLfs1
uos.VfsLfs1.mkfs(nrf.Flash())
except ImportError:
try:
from uos import VfsLfs2
uos.VfsLfs2.mkfs(nrf.Flash())
except ImportError:
try:
from uos import VfsFat
uos.VfsFat.mkfs(nrf.Flash())
except ImportError:
pass
except OSError as e:
if e.args[0] == 5: # I/O Error
flashbdev_size = (nrf.Flash.ioctl(4, 0) * nrf.Flash.ioctl(5, 0)) // 1024
print()
print("Is `FS_SIZE=%iK` enough for FAT filesystem?" % flashbdev_size)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment