Skip to content

Instantly share code, notes, and snippets.

Last active January 21, 2020 10:11
  • Star 8 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
## This is where you want the entire toolchain to live
## You should run this script from within the destination directory, or
## redefine the BASE variable to fit your lifestyle.
echo []: Checking for system prerequisites
[[ $(which pacman) ]] && sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial wget 2>/dev/null
[[ $(which apt-get) ]] && sudo apt-get install git make libncurses-dev flex bison gperf python python-serial wget 2>/dev/null
## Get or update IDF
if [[ -d esp-idf ]] ; then
echo "[]: found esp-idf, updating"
cd esp-idf
git pull && git submodule update --recursive
cd $BASE
else ## not found, get it
git clone --recursive
## Get binary toolchain -- this might get out of date when they change blobs:
## Current version Sept 29, 2016
if [[ -d xtensa-esp32-elf ]] ; then
echo "[]: Found binary toolchain. Moving on to template app."
tar xvzf xtensa-esp32-elf-linux64-1.22.0-59.tar.gz && \
rm xtensa-esp32-elf-linux64-1.22.0-59.tar.gz
## Get demo application
if [[ -d esp-idf-template ]] ; then
echo "[]: Found esp-idf-template, updating"
cd esp-idf-template
git pull
cd $BASE
else ## not found, get it
git clone
## Setup environment variables:
## Works for _this_ directory structure. You will need to change these if you deviate
## Also, you might copy these lines into a separate script
## to reset these variables as necessary.
echo []: Exporting environment variables:
export IDF_PATH=${BASE}/esp-idf
echo []: export IDF_PATH=${BASE}/esp-idf
export PATH=$PATH:${BASE}/xtensa-esp32-elf/bin
echo []: export PATH=$PATH:${BASE}/xtensa-esp32-elf/bin
echo []: cd $BASE/esp-idf-template and
echo []: type make menuconfig or make flash to get going
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment