micropython/ports/esp8266/modules/_boot.py
JensDiemer c14ff6194c esp8266/modules: Fix AttributeError in _boot.py if flash not formatted.
Prior to this commit, if the flash filesystem was not formatted then it
would error: "AttributeError: 'FlashBdev' object has no attribute 'mount'".
That is due to it not being able to detect the filesystem on the block
device and just trying to mount the block device directly.

This commit fixes the issue by just catching all exceptions.  Also it's not
needed to try the mount if `flashbdev.bdev` is None.
2020-01-14 23:53:49 +11:00

14 lines
223 B
Python

import gc
gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
import uos
from flashbdev import bdev
if bdev:
try:
uos.mount(bdev, '/')
except:
import inisetup
inisetup.setup()
gc.collect()