f16falcona46 / micropython-docker-build

Build environment for ESP8266 micropython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Micropython on ESP8266

The repository provides a Dockerfile to build the Micropython firmware for ESP8266 boards.

Warning: The binary works on Ubuntu 14:04 and the build is based on Ubuntu 14:04

Build Instructions

Build the docker image of the master branch.

  docker build -t micropython-esp8266 .

To specify a particular version of micropython provide it through the build-arg. Otherwise the HEAD of the master branch will be used.

  docker build -t micropython-esp8266 --build-arg VERSION=v1.8.7 .

Once the container is built successfuly create a container from the image

  docker create --name micropython-esp8266 micropython-esp8266

Then copy the the built firmware into the host machine.

  docker cp micropython-esp8266:/micropython/ports/esp8266/build-GENERIC/firmware-combined.bin firmware-combined.bin

The firmware can then be uploaded with the esptool

  esptool.py --port ${SERIAL_PORT} --baud 115200 write_flash --verify --flash_size=8m 0 firmware-combined.bin

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected.

Flash from within Container

If you have built the image directly on your host (Linux), you also can flash your ESP directly by running a container from the image. I prefereably erase flash memory of ESP8266 before starting flash a new firmware

docker run --rm -it --device ${SERIAL_PORT} --user root --workdir /micropython/ports/esp8266 micropython make PORT=${SERIAL_PORT} erase deploy

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected, generally is equal to /dev/ttyUSB0.

Freeze personal script files in the build

If you want to add personal python scripts to include in the build flash image, you have to add them to the folder /micropython/ports/esp8266/modules. The building process will precompiles your scripts with MPY and will inserts in the flash image this option will save you more memory of the microcontroller.

To obtain this within the docker container, create a copy of the original micropython folder /micropython/ports/esp8266/modules in your working directrory add here your scripts and link them into the container (with the -v docker option) overriding the default modules folder, when you run the container.

docker run --rm -it -v $(pwd)/modules:/micropython/ports/esp8266/modules --device ${SERIAL_PORT} --user root --workdir /micropython/ports/esp8266 micropython-esp8266 /bin/bash
make clean
make 
make PORT=/dev/ttyUSB0 erase deploy

For Windows:

docker run --rm -it -v ${PWD}/micropython/ports/esp8266/modules:/micropython/ports/esp8266/modules --user root --workdir /micropython/ports/esp8266 micropython-esp8266 /bin/bash
make clean
make

(Copy out the firmware manually)

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected, generally is equal to /dev/ttyUSB0.

About

Build environment for ESP8266 micropython


Languages

Language:Dockerfile 100.0%