Skip to content

Commit

Permalink
did the whole thing from scratch - seems to work now
Browse files Browse the repository at this point in the history
  • Loading branch information
T-vK committed Oct 22, 2016
1 parent b9b3767 commit 741b180
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 60 deletions.
39 changes: 22 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
59 changes: 19 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,51 @@
## 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/

``` 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.
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 741b180

Please sign in to comment.