Skip to content

Commit

Permalink
add option to alter Espressif IDF build
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Florent committed Feb 18, 2019
1 parent ab69923 commit 40a7aad
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
5 changes: 3 additions & 2 deletions pycom-docker-fw-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ubuntu:bionic

RUN apt-get update && apt-get -y install wget git build-essential python python-serial && \
RUN apt-get update && apt-get -y install wget git build-essential python \
python-serial libncurses5 libncurses5-dev flex bison gperf && \
mkdir /opt/frozen/ && cd /opt && \
wget -q https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz && \
tar -xzvf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz && \
git clone --recursive https://github.com/pycom/pycom-esp-idf.git && \
cd pycom-esp-idf && git submodule update --init && cd .. && \
git clone --recursive https://github.com/pycom/pycom-micropython-sigfox.git
git clone --recursive https://github.com/pycom/pycom-micropython-sigfox.git

ADD assets/build /usr/bin/build
14 changes: 9 additions & 5 deletions pycom-docker-fw-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ where board in `WIPY LOPY SIPY GPY FIPY LOPY4` and your-project-version-code is

### example:

If you have your MicroPython project in the current directory `.` just type:

For building against a specific revision (ex:v1.20.0.rc7 idf_v3.1) you can use:
```
sudo docker run -v `pwd`:/opt/frozen -it goinvent/pycom-fw build LOPY4 myproject
sudo docker run -v `pwd`:/opt/frozen -it goinvent/pycom-fw build FIPY myproject v1.20.0.rc7 idf_v3.1
```
For building against a specific revision (ex:v1.20.0.rc0 idf_v3.1) you can use:

### Altering Espressif IDF options:

Have a file `sdkconfig.defaults` similar to https://github.com/pycom/pycom-esp-idf/blob/master/examples/wifi/scan/sdkconfig in your local frozen directory (ex: .), then use the same command:

```
sudo docker run -v `pwd`:/opt/frozen -it goinvent/pycom-fw build FIPY myproject v1.20.0.rc0 idf_v3.1
sudo docker run -v `pwd`:/opt/frozen -it goinvent/pycom-fw build FIPY myproject v1.20.0.rc7 idf_v3.1
```

Beginning the build the `sdkconfig.defaults` overrides.

### note:

Expand Down
20 changes: 17 additions & 3 deletions pycom-docker-fw-build/assets/build
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,39 @@ function prepare_dev() {
cd /opt/pycom-esp-idf
git checkout $2
git submodule update --init

if [ -f /opt/frozen/sdkconfig.defaults ]
then
cd examples/wifi/scan/
cp /opt/frozen/sdkconfig.defaults sdkconfig.defaults
make defconfig
make bootloader
make -j4 all
echo "IDF build options:"
cat sdkconfig
fi
fi
}

function build() {
BOARD=$1
PROJECT=$2
export PATH=$PATH:/opt/xtensa-esp32-elf/bin/
export IDF_PATH=/opt/pycom-esp-idf
board=`echo "$BOARD" | tr '[:upper:]' '[:lower:]'`
cd /opt/pycom-micropython-sigfox/esp32/ &&
make clean BOARD=$BOARD &&
cd ../mpy-cross && make clean && make && cd ../esp32 &&
cp /opt/frozen/*.py ./frozen/Base/ &&
mv ./frozen/Base/main.py ./frozen/Base/_main.py
make release BOARD=$BOARD RELEASE_DIR=/tmp
make TARGET=boot COPY_IDF_LIBS=1 BOARD=$BOARD RELEASE_DIR=/tmp
cat /opt/pycom-esp-idf/examples/wifi/scan/sdkconfig.defaults
make release COPY_IDF_LIBS=1 BOARD=$BOARD RELEASE_DIR=/tmp
mv /tmp/*.tar.gz /opt/frozen/$board-firmware-$PROJECT.tar.gz
echo "Firmware $board-firmware-$PROJECT.tar.gz ready !"
}

export PATH=$PATH:/opt/xtensa-esp32-elf/bin/
export IDF_PATH=/opt/pycom-esp-idf

[[ $boards =~ (^|[[:space:]])$1($|[[:space:]]) ]] &&
echo "#goinvent " ||
usage
Expand Down

0 comments on commit 40a7aad

Please sign in to comment.