Commit 168cf795 authored by omwansafelix's avatar omwansafelix

created new script files for automatic building of ESP32 projects

parent 036452d6
## Author: Felix Omwansa
echo ""
echo "[$0]: This file should be run in the directory where the project is located.
Paste and run it in the directory, although this is done automatically from buildESP32.sh"
##Allow read and write access to USB device
echo ""
echo "[$0]: Setup access to USB device"
sudo chmod a+rw /dev/ttyUSB0
##configure project
echo ""
echo "[$0]: Run configuration menu"
make menuconfig
##erase and flash current project to ESP and run serial monitor to view results
echo ""
echo "[$0]: Erase everything on device then flash the current project"
make erase_flash flash monitor
## Author: Elliot Williams
## Modified by : Felix Omwansa
echo ""
echo "[$0]: This script builds the entire framework for development, a template that is the first of only two steps of building custom projects for the ESP32."
## Install the esp-idf and set required variables
## BASE variable-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.
#The script here is derived from: http://esp-idf.readthedocs.io/en/latest/linux-setup.html
##the 'getESP32.sh' file is unnecessary
BASE=$(pwd)
echo ""
echo "[$0]: Checking for system prerequisites."
#Archlinux
if [ $(which pacman) ]
then
echo "[$0]: Found archlinux based system."
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial wget 2>/dev/null
fi
#Ubuntu
if [ $(which apt-get) ]
then
echo "[$0]: Found Ubuntu based system."
sudo apt-get update
sudo apt-get install git make libncurses-dev flex bison gperf python python-serial wget 2>/dev/null
fi
#Any other system goes here
# Get or update IDF
echo ""
echo "[$0]: Get or update IDF"
if [ -d esp-idf ]
then
echo "[$0]: Found esp-idf, updating."
cd esp-idf
git pull && git submodule update --recursive
cd $BASE
else ## not found, get it
git clone --recursive https://github.com/espressif/esp-idf.git
fi
## Perform mandatory removal of any tar files in case of a previous error
if [ -f *.tar.gz ] || [ -f *.tar.gz.* ]
then
echo ""
echo "[$0]: Removing residual tar file(s)"
rm *.tar.gz 2>/dev/null
rm *.tar.gz.* 2>/dev/null
fi
## Get 64 bit linux binary toolchain -- this might get out of date when they change blobs:
## Current version 1.22.0-61-gab8375a-5.2.0
echo ""
echo "[$0]: Get 64 bit linux binary toolchain -- this might get out of date when they change blobs"
if [ -d xtensa-esp32-elf ]
then
echo "[$0]: Found ESP32 binary toolchain. Performing mandatory replacement."
echo "[$0]: Current version at the making of this makefile 1.22.0-61-gab8375a-5.2.0"
echo "[$0]: Check current version from http://esp-idf.readthedocs.io/en/latest/linux-setup.html"
rm -rf xtensa-esp32-elf
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
tar -xvzf xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
# rm *.tar.gz 2>/dev/null && rm *.tar.gz.* 2>/dev/null
else
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
tar -xvzf xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
rm *.tar.gz 2>/dev/null && rm *.tar.gz.* 2>/dev/null
fi
## No need for demo application
## Setup environment variables:
echo ""
echo "[$0]: Setup environment variables"
echo "[$0]: Exporting environment variables:"
export IDF_PATH=${BASE}/esp-idf
echo "[$0]: export IDF_PATH=${BASE}/esp-idf"
export PATH=$PATH:${BASE}/xtensa-esp32-elf/bin
echo "[$0]: export PATH=$PATH:${BASE}/xtensa-esp32-elf/bin"
##move the project builder to the source code directory
mkdir narra
mv buildApp.sh narra
##After source code is available the commands to create the source files into subdirectory goes here
cd narra
#Build instructions
echo ""
echo "[$0]: Project build instructions"
echo "[$0]: Run '. buildApp.sh' in the project directory to build and flash project to the ESP32"
##upon project completion the buildApp script can be run automatically from here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment