Skip to content

suculent/micropython-docker-build

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Micropython on ESP8266

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

Based on THiNX OpenSource IoT management platform.

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 .

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 --build-arg VERSION=v1.8.7 .

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

  docker create --name micropython micropython

Then copy the the built firmware into the host machine.

  docker cp micropython:/micropython/esp8266/build/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/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/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/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/esp8266/modules --device ${SERIAL_PORT} --user root --workdir /micropython/esp8266 esp /bin/bash
make clean
make 
make PORT=/dev/ttyUSB0 erase deploy

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 94.6%
  • Shell 3.3%
  • Dockerfile 2.1%