See http://forum.micropython.org/viewtopic.php?f=16&t=1689 and http://forum.micropython.org/viewtopic. ... 9114#p9188
edit 5/23/2016: minor updates, code cleanup, include link (above) to official build documentation.
edit 9/25/2016: added make myp-cross - see https://github.com/micropython/micropyt ... er/esp8266
edit 4/23/2017: removed --flash-size parameter from esptool.py (it now auto-detects, and old value would not upload properly)
I was having a difficult time (1) being patient waiting for the next kickstarter firmware to arrive in my inbox, and (2) finding instructions all in one place regarding how to build MicroPython from the git repository from scratch myself. So I came up with this! I hope others find it useful. This is all done from a windows machine, either connecting to the RPi with putty - or on a Debian install with VMware.
There are some other useful tidbits thrown in. They can be uncommented and used as desired.
Basically the instructions are:
- - Install Raspian (Jessie) on a Raspberry Pi with at least 16GB free SD
-- or --
- Install Debian (Jessie) on a machine or in a VM
- Install toolchain
- Get recent esp-open-sdk and compile it
- Add xtensa-lx106-elf to your path
- Get recent micropython and compile it
- Get esptool
- Send binary image to your EPS8266 using esptool
- Write cool MicroPython apps
https://github.com/gojimmypi/build_esp8266
This version has some command-line parameters:
Code: Select all
Usage:
./build_esp8266.sh [OPTION]
OPTIONS
HELP
show this help. Source will be placed in ~/workspace/ directory.
FULL
Update RPi, download latest esp-open-sdk and micropython, build everything, erase and upload new binary to /dev/ttyUSB0
MAKE-ONLY
Download latest esp-open-sdk and micropython, build everything.
MAKE-ONLY-ESP8266
Download latest micropython and build (skip esp-open-sdk).
RUN-TESTS
Run the esp8266 test script
FLASH-ONLY
Only writing existing flash to device. (no updates, no build)
If all is successful, Ta-da!
Code: Select all
�ó�ì�päl�pcl`��lûcould not find module 'boot'
#4 ets_task(40100264, 3, 3fff4668, 4)
MicroPython v1.6-380-g9c04299 on 2016-04-07; ESP module with ESP8266
Type "help()" for more information.
>>> print("hello world!")
hello world!
>>>
Some folks have suggested doing all this in a VM. Although I agree this would be good on a "real" debian... well, with the easily re-imaged SD disk in the RPi, I treat raspian as essentially a VM, complete with snapshots and all! I keep all sorts of SD images on hand for the RPi. (the win32diskimager tool is great for this, but not nearly as fast and convenient as VMware). The drawback is the RPi compile takes a long time (well in excess of an hour).
Update: Debian on a VM with a SSD is incredibly faster than the RPi! (ok, not really a surprise here, eh?) A fresh install of Debian was missing some critical dependencies that are otherwise installed by default on the RPi (e.g. curl, git, and compiler). So for Debian - I added a new debian_specific.sh:
Code: Select all
# this is not a bash script, rather best used as copy & paste since su command will start a new shell
#start root shell
su
apt-get update && apt-get upgrade
apt-get install curl
apt-get install git
apt-get install build-essential
# sudo is only needed to check if script is running as root. can be ommited
apt-get install sudo
# this next line makes sure the current user is allowed to use sudo (omit if not installing sudo)
echo "$USER ALL=(ALL:ALL) ALL" >> /etc/sudoers
#exit root shell
exit
Code: Select all
#!/bin/bash
curl https://raw.githubusercontent.com/gojimmypi/build_esp8266/master/build_esp8266.sh > build_esp8266.sh
chmod +x build_esp8266.sh
./build_esp8266.sh
Many thanks again to Damien, Paul and Viktoriya for this really excellent project! You seriously rock