# 在esp8266上编译micropython固件 ## 安装编译工具 ``` bash $ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git ``` ## 安装烧录工具 ``` bash $ pip install esptool ``` ## 下载源程序 ``` bash $ git clone git@github.com:micropython/micropython.git ``` ## 编译固件 ``` bash $ export PATH=/home/light/PycharmProjects/esp-open-sdk/xtensa-lx106-elf/bin:$PATH $ cd micropython $ git submodule update --init $ make -C mpy-cross $ cd esp8266 $ make axtls $ make ``` ###### 重新编译 ``` bash $ make clean $ make axtls $ make ``` ![](file:///home/light/Pictures/836057-20170226161953648-264329838.png) ## 刷写固件 ``` bash $ sudo esptool.py --port /dev/ttyUSB0 erase_flash $ sudo esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect 0 build/firmware-combined.bin ```