You are here: Home / Software / embedded linux notes / Building Micropython for ESP8266
Building Micropython for ESP8266¶
as micropython on the esp8266 is bleeding edge (as of April 2016), the most current esp sdk and micropython is required.
esp SDK¶
This builds a complete cross-compiler toolchain. On first run it will download sourcecode for binutils, newlib, gcc (150MB). It then continues to build libraries, the bootstrap compiler, the c libraries, the real compiler.
The makefile is intelligent enough to use multiple processor cores during bootstrap. But it still takes a while.
# get sdk including submodules
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
# update
git submodule update --init
# build it
make
the crosscompiler is in esp-open-sdk/xtensa-lx106-elf
python3 pitfall¶
if you have a python3 environment, modify
esp-open-sdk/xtensa-lx106-elf/bin/esptool.py
to point to python2.
micropython¶
# /home/scorch/projects/esp8266/micropython/esp-open-sdk/xtensa-lx106-elf/
add the crossompiler to your path
export PATH=WORKSPACE/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
# get micropython including submodules
git clone --recursive https://github.com/micropython/micropython.git
cd micropython
# update
git submodule update --init
# choose our target board
cd esp8266
# and build it
make
the firmware image is in build/firmware-combined.bin
flashing¶
connect serial (via serial USB converter) to esp8266. Pull gpio0 and reset to low. power on. pull reset high. pull gpio0 high.
esptool.py \
-p /dev/ttyUSB0 \
write_flash \
0x00 build/firmware-combined.bin