# HG changeset patch # User Radomir Dopieralski # Date 1471860883 -7200 # Node ID 4b538731a2073f54703771c6bbf5104b4ed282dd # Parent 765d0ffbb57b76b5491ca213452a35d622defb41 Add a readme diff -r 765d0ffbb57b -r 4b538731a207 README.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.rst Mon Aug 22 12:14:43 2016 +0200 @@ -0,0 +1,29 @@ +SD Card driver for ESP8266 MicroPython +************************************** + +Since MicroPython on the ESP8266 doesn't let you have multiple filesystems +at the moment, you can only replace the internal filesystem with the one on +the sd card. In order to do that, you need to compile your own firmware. + +Edit your ``esp8266/modules/_boot.py`` and replace the mounting of the filesystem:: + + import gc + gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) + import uos + # from flashbdev import bdev + # + #try: + # if bdev: + # vfs = uos.VfsFat(bdev, "") + #except OSError: + # import inisetup + # vfs = inisetup.setup() + + import sdcard + sdcard.esp8266_mount() + + gc.collect() + +Then add the ``sdcard.py`` file from this repository to ``esp8266/modules``. +Connect your SD Card socket to your ESP8266 board's SPI (``miso=Pin(12), +mosi=Pin(13), sck=Pin(14), cs=Pin(15)``), and enjoy! diff -r 765d0ffbb57b -r 4b538731a207 sdcard.py --- a/sdcard.py Mon Aug 22 11:55:12 2016 +0200 +++ b/sdcard.py Mon Aug 22 12:14:43 2016 +0200 @@ -259,4 +259,4 @@ import uos spi = SPI(-1, miso=Pin(12), mosi=Pin(13), sck=Pin(14)) sd = sdcard.SDCard(spi, Pin(15)) - uos.VfsFat(sd, "") + return uos.VfsFat(sd, "")