From 741b1803c93a3912912645949b8637ed8d5aaf24 Mon Sep 17 00:00:00 2001 From: T-vK Date: Sun, 23 Oct 2016 01:58:41 +0200 Subject: [PATCH] did the whole thing from scratch - seems to work now --- Dockerfile | 39 +++++++++++++++++++--------------- README.md | 59 +++++++++++++++++---------------------------------- entrypoint.sh | 3 --- 3 files changed, 41 insertions(+), 60 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4071d30..ccc20b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,11 @@ FROM ubuntu:16.04 MAINTAINER T-vK -RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository multiverse +#RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository multiverse RUN apt-get update && apt-get install -y \ autoconf \ automake \ - bash \ bison \ bzip2 \ flex \ @@ -16,37 +15,43 @@ RUN apt-get update && apt-get install -y \ gcc \ git \ gperf \ - libexpat-dev \ + grep \ + gettext \ libtool \ libtool-bin \ + libexpat-dev \ make \ ncurses-dev \ - nano \ + libncurses-dev \ + flex \ + bison \ + gperf \ + help2man \ python \ python-dev \ python-serial \ - sed \ texinfo \ - unrar \ - unzip \ - wget \ - help2man + wget RUN useradd -m -s /bin/bash -g dialout esp && passwd -d esp - USER esp - WORKDIR /home/esp -RUN git clone -b esp32 --recursive https://github.com/T-vK/esp-open-sdk.git +RUN git clone -b xtensa-1.22.x https://github.com/espressif/crosstool-NG.git -RUN cd esp-open-sdk && make STANDALONE=n +RUN cd crosstool-NG \ + && ./bootstrap \ + && ./configure --prefix=$PWD \ + && make install +RUN cd crosstool-NG \ + && ./ct-ng xtensa-esp32-elf \ + && ./ct-ng build \ + && chmod -R u+w builds/xtensa-esp32-elf -RUN cd esp-open-sdk && make STANDALONE=y +RUN git clone --recursive https://github.com/espressif/esp-idf.git -ENV PATH /home/esp/esp-open-sdk/xtensa-lx106-elf/bin:/home/esp/esp-open-sdk/esptool:$PATH -ENV XTENSA_TOOLS_ROOT /home/esp/esp-open-sdk/xtensa-lx106-elf/bin -ENV SDK_BASE /home/esp/esp-open-sdk/sdk +ENV PATH /home/esp/crosstool-NG/builds/xtensa-esp32-elf/bin:$PATH +ENV IDF_PATH=/home/esp/esp-idf COPY ./entrypoint.sh ./entrypoint.sh USER root diff --git a/README.md b/README.md index e9821f1..9a936dd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ ## Easily compile and flash binaries for the ESP32 and ESP31b You might also be interested in the branch for the ESP8266 and ESP8266EX: https://github.com/T-vK/docker-esp-sdk/ -## !!! This branch is completely untested for now! - ## How to install If you don't have docker, install docker first: https://docs.docker.com/engine/installation/linux/ @@ -10,63 +8,44 @@ If you don't have docker, install docker first: https://docs.docker.com/engine/i ``` bash git clone -b esp32 https://github.com/T-vK/docker-esp-sdk.git cd docker-esp-sdk -sudo docker build -t tavk/esp-sdk:0.1 . +sudo docker build -t tavk/esp32-sdk:0.1 . ``` -## How to use +## How to use examples ### Compiling binaries ``` bash sudo docker run -t -i -u esp \ --v /home/ubuntu/esp8266/esp-open-sdk/examples/blinky:/home/esp/shared_project \ -tavk/esp-sdk:0.1 \ -make +-v /home/debian/esp-idf/examples/01_hello_world:/home/esp/shared_project \ +tavk/esp32-sdk:0.1 \ +make all ``` - - Replace `/home/ubuntu/esp8266/esp-open-sdk/examples/blinky` with the absolute path to the directory of the project oyu want to compile. - - Replace `make` with whatever command is necessary to compile your binary/binaries. + - Replace `/home/debian/esp-idf/examples/01_hello_world` with the absolute path to the directory of the project oyu want to compile. + - Replace `make all` with whatever command is necessary to compile your binary/binaries. -### Flashing binaries +### Flashing ``` bash sudo docker run -t -i -u esp \ --device=/dev/ttyUSB0 \ -v /home/ubuntu/esp8266/esp-open-sdk/examples/blinky:/home/esp/shared_project \ -tavk/esp-sdk:0.1 \ -esptool.py --port /dev/ttyUSB0 write_flash 0x00000 blinky-0x00000.bin 0x40000 blinky-0x40000.bin +tavk/esp32-sdk:0.1 \ +make flash ``` - - Replace `/home/ubuntu/esp8266/esp-open-sdk/examples/blinky` with the absolute path to the directory that contains the files you want to flash. + - Replace `/home/debian/esp-idf/examples/01_hello_world` with the absolute path to the directory that contains the files you want to flash. - Replace `/dev/ttyUSB0` with the COM port that your ESP is connected to. - - Replace `esptool.py --port /dev/ttyUSB0 write_flash 0x00000 blinky-0x00000.bin 0x40000 blinky-0x40000.bin` with whatever command is necessary to flash your binaries. - - -### Flashing bootloaders + - Replace `make flash` with whatever command is necessary to flash your binaries. -``` bash -sudo docker run -t -i -u esp \ ---device=/dev/ttyUSB0 \ --v /home/ubuntu/projects/esp-bootloader:/home/esp/shared_project \ -tavk/esp-sdk:0.1 \ -esptool.py --port /dev/ttyUSB0 write_flash --flash_mode dio --flash_size 32m 0x0 bootloader.bin -``` +### Please refer to https://github.com/espressif/esp-idf for more indepth information on how to compile/flash for your ESP32 - - Replace `/home/ubuntu/projects/esp-bootloader` with the absolute path to the directory that contains the files you want to flash. - - Replace `/dev/ttyUSB0` with the COM port that your ESP is connected to. - -Replace `esptool.py --port /dev/ttyUSB0 write_flash --flash_mode dio --flash_size 32m 0x0 bootloader.bin` with whatever command is necessary to flash your binaries. - -### If the make file takes care of compiling AND flashing - -``` bash -sudo docker run -t -i -u esp \ ---device=/dev/ttyUSB0 \ --v /home/debian/espusb:/home/esp/shared_project \ -tavk/esp-sdk:0.1 \ -make ESP_ROOT=/home/esp/esp-open-sdk burn -``` +## Testing +I have compiled one example project successfully. +Since I don't have my ESP32 yet, I can't test if the flashing actually works. +But I'm sure you will tell me in the issues if something doesn't work. :) - - Replace `/dev/ttyUSB0` with the COM port your esp is connected to. - - Replace `/home/debian/espusb` with the absolute path to directory of the project you want to compile/flash. - - Replace `make ESP_ROOT=/home/esp/esp-open-sdk burn` with the command necessary to compile and flash your project. +I don't really know how to change the config wihtout going through menuconfig manually, +so that might be a problem.. I haven't really looked into it too much though. diff --git a/entrypoint.sh b/entrypoint.sh index cdb975e..901bd5d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,5 @@ #!/bin/sh -# This entrypoint script is kinda useless at this point -# but I'm too lazy to get rid of it and it might come in handy in the future. - # change dir to the directory that is linked with the project that is going to be compiled or flashed cd ~/shared_project