Skip to content

Commit

Permalink
Merge pull request #32 from trombik/esp-idf-master
Browse files Browse the repository at this point in the history
support esp-idf master, 4.1, and 4.0.1
  • Loading branch information
bkeevil authored Sep 21, 2020
2 parents 86ff7d2 + 92b2258 commit 4029920
Show file tree
Hide file tree
Showing 12 changed files with 357 additions and 196 deletions.
185 changes: 185 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
---
name: Build
on:
- pull_request
- push
jobs:

# XXX create multiple jobs for major versions
#
# for those who want to _refactor_ the jobs:
#
# in the previous CI implementation, all builds share a single build
# process. that way, you can remove duplications. however, every time a
# version changes the build process, the change affects all other build
# processes. I am tired of tracking changes and workarounds in the build
# process. the result is many `if`s. assuming major version does not change
# (a lot) its build process, creating multiple jobs, and using matrix is the
# only sane way. as GitHub Actions does not support reusable steps, there
# are many duplications. but no need to modify the entire build process to
# adopt changes in master.
build_esp32_v4_x:
runs-on: ubuntu-latest
strategy:
matrix:
build_method:
- idf
- make
branch:
- master
- v4.1
- v4.0.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Install python
uses: actions/setup-python@v2
with:

# XXX install python 3.8 because the official python package
# segfaults when installing modules in the runner.
#
# 2020-09-03T02:29:58.2517141Z Successfully installed cffi-1.14.2 cryptography-3.1 future-0.18.2 pycparser-2.20 pyparsing-2.3.1 pyserial-3.4 setuptools-50.1.0 six-1.15.0
# 2020-09-03T02:30:09.0409148Z /home/runner/work/_temp/66c91304-eef8-456d-84a1-7299428a62f7.sh: line 5: 4140 Segmentation fault (core dumped) python3 -m pip install --user -r ${IDF_PATH}/requirements.txt
# 2020-09-03T02:30:09.0414254Z ##[error]Process completed with exit code 139.
#
# possibly related issue:
# https://github.com/actions/virtual-environments/issues/159
python-version: 3.8

- name: Install dependencies
run: |
sudo apt-get install \
bison \
ccache \
flex \
gcc \
git \
gperf \
libffi-dev \
libncurses-dev \
libssl-dev \
make \
wget
- name: Set environment variables
id: set_env
run: |
SDK_NAME="esp-idf"
GCC_PREFIX="xtensa-esp32-elf"
GCC_FILE="${GCC_PREFIX}-gcc"
# /home/runner/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin
TOOLCHAIN_DIR="${HOME}/.espressif/tools"
case "${{ matrix.branch }}" in
v4.0.1)
TOOLCHAIN_VERSION="esp-2019r2-8.2.0"
;;
v4.1*)
TOOLCHAIN_VERSION="esp-2020r2-8.2.0"
;;
master)
TOOLCHAIN_VERSION="esp-2020r3-8.4.0"
;;
esac
REPO_DIR=`pwd`
EXAMPLE_DIR="${REPO_DIR}"
DISTFILE_DIR="${HOME}/distfiles"
__PROJECT_PATH=`pwd`
# XXX actions/checkout does not allow to checkout a repository other
# than under __PROJECT_PATH
IDF_PATH="${__PROJECT_PATH}/idf"
echo "::set-env name=IDF_PATH::${IDF_PATH}"
# XXX prefix all the environment variables with `__PROJECT_` to avoid pollution
echo "::set-env name=__PROJECT_EXAMPLE_DIR::${EXAMPLE_DIR}"
echo "::set-env name=__PROJECT_GCC_FILE::${GCC_FILE}"
echo "::set-env name=__PROJECT_GCC_PREFIX::${GCC_PREFIX}"
echo "::set-env name=__PROJECT_SDK_NAME::${SDK_NAME}"
echo "::set-env name=__PROJECT_TOOLCHAIN_FILE::${TOOLCHAIN_FILE}"
echo "::set-env name=__PROJECT_TOOLCHAIN_DIR::${TOOLCHAIN_DIR}"
echo "::set-env name=__PROJECT_TOOLCHAIN_VERSION::${TOOLCHAIN_VERSION}"
echo "::set-env name=__PROJECT_DISTFILE_DIR::${DISTFILE_DIR}"
echo "::set-env name=__PROJECT_PATH::${__PROJECT_PATH}"
echo "::set-env name=__PROJECT_BUILD_COMMAND::${__PROJECT_BUILD_COMMAND}"
echo "::set-env name=__PROJECT_BUILD_COMMAND_ARG::${__PROJECT_BUILD_COMMAND_ARG}"
- name: Checkout the SDK
uses: actions/checkout@v2
with:
repository: espressif/esp-idf
path: idf
submodules: recursive
ref: ${{ matrix.branch }}

- name: Fixup the SDK
run: |
# XXX workaround removed option, --no-site-packages, from virtualenv. should
# be removed when the following commit is merged
# https://github.com/espressif/esp-idf/commit/7a18f02acd7005f7c56e62175a8d1968a1a9019d
sed -i -e "s/'--no-site-packages',//" ${IDF_PATH}/tools/idf_tools.py
# XXX remove some modules
# gdbgui cannot be installed successfully with python 3.8
sed -i -e "s/^gdbgui.*//" -e "s/^pygdbmi.*//" ${IDF_PATH}/requirements.txt
- name: Install python requirements
run: |
cd "${IDF_PATH}"
./install.sh
- name: Compress HTML assets
run: |
cd main/www
bash ./compress_pages.sh
- name: Build (idf.py)
if: ${{ matrix.build_method == 'idf' }}
run: |
IGNORE_FILE="travis-ignore"
. ${IDF_PATH}/export.sh
# XXX share cache between examples.
# see "Compiling In Different Directories" in ccache(1)
# | | 4.0.1 | master |
# |----------------------------------------|---------|---------|
# | without ccache | 33m 42s | 50m 27s |
# | CCACHE_BASEDIR and CCACHE_NOHASHDIR | 10m 41s | 16m 38s |
export CCACHE_BASEDIR="${__PROJECT_EXAMPLE_DIR}"
export CCACHE_NOHASHDIR=true
cd "${__PROJECT_EXAMPLE_DIR}"
idf.py --ccache build
- name: Setup ccache (make)

# XXX ccache needs to be configured here
# unlike idf.py, esp-idf does nothing to setup ccache for make.
# IDF_CCACHE_ENABLE does not work either.
if: ${{ matrix.build_method == 'make' }}
run: |
ccache --version
GCC_BIN_DIR="${__PROJECT_TOOLCHAIN_DIR}/${__PROJECT_GCC_PREFIX}/${__PROJECT_TOOLCHAIN_VERSION}/${__PROJECT_GCC_PREFIX}/bin"
CCACHE_BIN_DIR="${HOME}/ccache_bin"
mkdir -p "${CCACHE_BIN_DIR}"
(cd "${CCACHE_BIN_DIR}" && ln -s /usr/bin/ccache "${__PROJECT_GCC_FILE}")
export PATH="${CCACHE_BIN_DIR}:$PATH:${GCC_BIN_DIR}"
${CCACHE_BIN_DIR}/${__PROJECT_GCC_FILE} --version
echo "::set-env name=PATH::${PATH}"
echo "::set-env name=CCACHE_BASEDIR::${__PROJECT_EXAMPLE_DIR}"
echo "::set-env name=CCACHE_NOHASHDIR::true"
- name: Build (make)
if: ${{ matrix.build_method == 'make' }}
run: |
export TERM="xterm-256color"
IGNORE_FILE="travis-ignore"
. ${IDF_PATH}/export.sh
make -C "${__PROJECT_EXAMPLE_DIR}" defconfig
make -C "${__PROJECT_EXAMPLE_DIR}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ sdkconfig.old
.DS_Store
.vscode
main/www/.idea/
*.swp
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,12 @@ To configure the source code you first need to run `idf.py menuconfig` from the
Important settings are:

- Select a USB port for uploading the firmware under *Serial Flasher Config -> Default serial port*
- Ensure that *Partition Table -> Parititon Table* is set to use the *Custom partition table CSV* called "partitions.csv"
- Select what board you are using under *Camera Web Server -> Camera Pins*
- If your board has an LED flash, enable it under *Camera Web Server -> LED Illuminator*
- You can select default wifi settings under *Camera Web Server -> Wifi Settings*
- If your board has an SSD1306 based OLED display, enable it under *Component Config -> SSD1306 Configuration* and select pins for SDA and SCL
- To use additional external SPI RAM that may be on your board, enable it using *Component Config -> ESP32 Specific -> Support for external, SPI-connected RAM*
- To enable font overlays, under *Font Configuration* check *Store Font Partition* (Uses approximately 240K of flash)
- Under *Component Config -> Camera Configuration* select camera type OV2640 and pin it to Core1
- Under *Component Config -> WiFi* pin the WiFi task to Core0
- Enable NTP and select a default NTP server and timezone under *NTP configuration*

When your settings are complete, save them and exit.
Expand Down
48 changes: 20 additions & 28 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
set(COMPONENT_SRCS
"app_main.c"
"app_settings.c"
"app_illuminator.c"
"app_camera.c"
"app_wifi.c"
"app_fonts.c"
"app_httpd.c"
"app_lcd.c"
"app_sntp.c"
idf_component_register(
SRCS "app_main.c"
"app_settings.c"
"app_illuminator.c"
"app_camera.c"
"app_wifi.c"
"app_fonts.c"
"app_httpd.c"
"app_lcd.c"
"app_sntp.c"
REQUIRES esp32-camera
esp-idf-ssd1306
mdns
nvs_flash
esp_http_server
INCLUDE_DIRS "include"
"fonts"
EMBED_FILES "www/index.html.gz"
"www/style.css.gz"
"www/script.js.gz"
)

set(COMPONENT_ADD_INCLUDEDIRS "include" "fonts")

set(COMPONENT_REQUIRES
esp32-camera
esp-idf-ssd1306
mdns
nvs_flash
esp_http_server
)

set(COMPONENT_EMBED_FILES
"www/index.html.gz"
"www/style.css.gz"
"www/script.js.gz"
)

register_component()
Loading

0 comments on commit 4029920

Please sign in to comment.