Page 1 of 1
Docker image
Posted: Sun May 08, 2016 9:00 pm
by marfis
I'm on OSX and had some troubles installing the 8266 toolchain. So I thought I gave Docker a try. I came up with this Dockerfile
https://gist.github.com/hoihu/bebcb1952 ... 7e235d2fc4 that builds and installs the espopen toolchain and builds micropython for the 8266. Maybe that is helpful for other people who had problems installing the toolchain..
To install (assuming you have docker already installed), copy the dockerfile into a directory and run:
be warned: this takes some time to complete - but eventually you should have a a "espopen" docker image that you can use to cross compile your micropython firmware for the ESP8266.
Usage:
opens a bash shell as user "xtensa". From there you can do the usual staff like git update, make etc.
At the moment it's not possible to flash the 8266 board from the container (using the --device argument to share the serial port did not work on my machine). But you can share the resulting firmware file with the /user directory and flash as usual with the native esptool script.
I'm still learning to use docker so any feedback/improvement comments are welcome!
Re: Docker image
Posted: Mon May 09, 2016 3:14 am
by Photon Peddler
This is great! Thank you.
Based on instructions on
Stack Overflow, installation was easy on a Mac with
Homebrew:
Code: Select all
$ brew cask install dockertoolbox
...
$ docker-machine create --driver "virtualbox" Docker
...
$ docker-machine start Docker
...
$ eval $(docker-machine env Docker)
$ mkdir ~/Desktop/ESP8266
$ cd ~/Desktop/ESP8266
<Copy Dockerfile to Desktop/ESP8266.>
$ docker build -t espopen .
<Takes an hour or two to build...>
$ docker run -it -v ~/Desktop/ESP8266:/mnt/host espopen bash
<In Docker container now.>
$ cp build/firmware-combined.bin /mnt/host/
$ exit
<No longer in Docker container.>
Re: Docker image
Posted: Mon May 09, 2016 5:13 am
by marfis
Glad to see it has worked for you.
I forgot to mention one obvious thing: The dockerfile can be used on any OS where docker runs. So Windows users might also try it out... The container itself runs on ubuntu14.04.
It might also be useful on linux since the container provides a separation of your development infrastructure(s) and helps to investigate compatibility issues (e.g. different linux versions).
Re: Docker image
Posted: Tue Oct 04, 2016 8:32 pm
by chrisgp
The Dockerfile looks like it is out of date and fails to build. I modified it enough to get it to work for me. I just had to tweak the installed dependencies and add a compilation step for mpy-cross
Code: Select all
FROM ubuntu:14.04
# Don't ask user options when installing
env DEBIAN_FRONTEND noninteractive
RUN echo APT::Install-Recommends "0"; >> /etc/apt/apt.conf
RUN echo APT::Install-Suggests "0"; >> /etc/apt/apt.conf
# multiverse is required by unrar
RUN apt-get -y update && apt-get install -y \
git \
software-properties-common \
python-software-properties \
&& add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu precise multiverse"
RUN apt-get update && apt-get install -y \
unrar-free \
make \
autoconf \
automake \
libtool \
libtool \
gcc \
g++ \
gperf \
flex \
bison \
texinfo \
gawk \
ncurses-dev \
libexpat-dev \
python-dev \
python \
python-serial \
sed \
unzip \
bash \
help2man \
wget \
bzip2
## Clean apt cache
RUN apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*
# create user xtensa
RUN useradd -ms /bin/bash xtensa
USER xtensa
WORKDIR /home/xtensa
ENV PATH /home/xtensa/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
# GIT checkout and make toolchain
RUN git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
WORKDIR /home/xtensa/esp-open-sdk
RUN make
## if you want to build the 8266 uPy fw:
WORKDIR /home/xtensa
RUN git clone --recursive https://github.com/micropython/micropython.git
WORKDIR /home/xtensa/micropython
run make -C mpy-cross
WORKDIR /home/xtensa/micropython/esp8266
RUN make axtls
RUN make
Re: Docker image
Posted: Wed Oct 05, 2016 3:36 am
by marfis
I have also inluded this change and restructered things slightly. I missed to post an update, sorry:
https://github.com/hoihu/projects/tree/ ... er/esp8266
there is a readme that explains things.
Regarding flashing via RFC2217 (tcp-serial bridge). unfortunatly, using the huzzah boards this does not work without tinkering the HW autoreset circuit (well- just remove it, it is causing a raise conditions if the control lines have a delay). I described this on the adafruit support here:
https://forums.adafruit.com/viewtopic.p ... 93#p483993
basically as I understand adafruit the circuit is there to support the arduino monitor program... well...
So unfortunately you have to settle to copy over your build files to the host machine by sharing volumes (as described in the readme) and flash from there.
Re: Docker image
Posted: Wed Oct 05, 2016 4:42 am
by marfis
I just saw that I haven't added the mpy-cross target... I 'll update this asap.
Re: Docker image
Posted: Wed Oct 05, 2016 7:04 pm
by marfis
pushed a fix to resolve mpy-cross build
Re: Docker image
Posted: Tue Jan 31, 2017 1:47 pm
by electronicsguy
Great effort. Could you explain why I should use Docker though, instead of just installing the tool-chain once say on my linux machine?
Re: Docker image
Posted: Wed Feb 01, 2017 6:22 am
by marfis
numerous points.. a lot of them you'll find on google.
it isolates your cross dependencies. you can run an ubuntu image on osx similar like a VM but without the additional overhead of a full fledged VM.
The dockerfile is also self-describing. if you ever need to reinstall your system, just use the dockerfile and you are fine. basically replaces any "installation how-to notes".
Need to test the toolchain on another OS/linux/python version? no problem.
there are disadvantages too. you need to keep track of your running images. the files from the docker container cannot be edited with your favorite editor since they are not visible e.g. in finder (you can use a shared folder to steer around this issue). not every program is suitable to be run in a container (for example any graphical programs that need a GUI).