Building ESP8266 port - tips, tricks, and updates

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Locked
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Wed Mar 23, 2016 11:28 am

Thanks for your interest in building MicroPython ESP8266 port from the source code. This is a first step towards contributing to the project, and the recommended way to proceed to users who missed the Kickstarter campaign for the port. (Interested KS backers are very welcome to follow it too).

There was immense feedback on this forum regarding builds tips and tricks, and we'd like to provide some "official" points to save both your and our time while we're actively working on the project:
  1. The port is work in progress and still may undergo considerable changes.
  2. MicroPython ESP8266 port requires the latest (as in: today's) version of esp-open-sdk. Please make sure you always use the latest version of both micropython and esp-open-sdk. esp-open-sdk is itself regularly updated and some changes require complete rebuild of the toolchain. Use "make clean; make" for both projects if in doubt (i.e. this should be the first troubleshooting step if something doesn't work as expected).
  3. If you flash MicroPython for the first time, or after flashing any other firmware, make sure to erase flash completely:

    Code: Select all

    esptool.py erase_flash
    (this will of course clear any settings like configured access points too).
  4. The official documentation for building is located in README files of MicroPython repository (both in esp8266 and top directories) and esp-open-sdk repository. Any other documentation you may find elsewhere may be out of date or limited-use. (The official documentation itself is work in progress, and we'll update it based on feedback.)
  5. If you report issue on github, please make sure to specify the exact git revisions of micropython and esp-open-sdk you used, and exact steps you followed (or where you got binary release from, e.g. received as a Kickstarter backer)
Currently, the best platform to build MicroPython ESP8266 is Linux. Results of building esp-open-sdk on MacOSX may vary. There seems to be problems with Cygwin. So, if you don't run Linux natively, and experience some issues, the best approach may be to install Linux in a VM. We also plan to look into addressing these issues (that's why esp-open-sdk will keep changing), but this will be at lower priority than MicroPython development itself.

If you intend to build MicroPython regularly, please subscribe to this thread to receive notifications of various updates related to build process.

Thanks!
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Tue Apr 26, 2016 9:47 pm

Now, before issuing "make" to build MicroPython, you need to run "make axtls" to build axTLS dependency.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Sat May 07, 2016 5:12 pm

master branch now has WebREPL daemon NOT enable by default on startup (again). You'll need to enable it in boot.py if you build from master.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Sun May 22, 2016 6:11 pm

There has been major update of esp-open-sdk (upgrade to the version of crosstool-NG and gcc used). The (highly) recommended way to update is to rename your old installation of esp-open-sdk, make a new clone from github and build - there will be complete re-fetch of toolchain sources and rebuild from scratch. After rebuild, check the gcc version:

Code: Select all

$ xtensa-lx106-elf-gcc --version
xtensa-lx106-elf-gcc (crosstool-NG crosstool-ng-1.22.0-53-g46f160f) 4.8.5
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Wed May 25, 2016 10:37 am

There was another crosstool-NG update requiring complete esp-open-skd rebuild. The recommendations are the same as in the previous message. Expected version:

Code: Select all

$ xtensa-lx106-elf-gcc --version
xtensa-lx106-elf-gcc (crosstool-NG crosstool-ng-1.22.0-55-gecfc19a) 4.8.5
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Sat Jun 11, 2016 7:43 pm

esp-open-sdk was upgraded to ESP8266 SDK 1.5.4. Another update is esptool to the latest upstream master, which now uses another flashing method.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Thu Jun 30, 2016 10:09 am

Building esp8266 port now requires mpy-cross tool, see updated instructions at https://github.com/micropython/micropyt ... er/esp8266 .
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Tue Aug 02, 2016 12:20 pm

There're few pending changes which may affect compatibility with previous releases:
  • For compatibility with ESP8266 SDK 2.0.0, flash layout will be changed, after this happens, new binary version will need to installed after erase_flash.
  • There will be a change in WebREPL protocol: https://github.com/micropython/micropython/pull/2286 . Current WebREPL clients won't work any longer for file transfer, you'll need to use "wip" branch as described in the ticket above.
This is early notice of the upcoming changes (as in: if you don't want to be affected by compatibility issues, make a build from today's master and stick to it until next release). The changes above will become "official" with the next release, 1.8.3 (so, you will know that it will require erase_flash before install).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Fri Aug 05, 2016 8:05 pm

There will be a change in WebREPL protocol: https://github.com/micropython/micropython/pull/2286 . Current WebREPL clients won't work any longer for file transfer, you'll need to use "wip" branch as described in the ticket above.
This change is landed in master and ready for testing.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building ESP8266 port - tips, tricks, and updates

Post by pfalcon » Mon Oct 17, 2016 5:25 pm

With 1.8.5 having been tagged, esp8266 port switches to vendor SDK 2.0.0, please update to the latest esp-open-sdk. Another change is support for esptool.py --flash_size=detect switch, likewise, master will be updated soon to use it.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Locked