1#!/bin/bash 2# 3# Build esp32 port 4 5# for debugging 6#exec &> /tmp/esp-log-$$.txt 7 8# function for building firmware 9function do_build() { 10 descr=$1 11 board=$2 12 shift 13 shift 14 echo "building $descr $board" 15 build_dir=/tmp/esp32-build-$board 16 rm -rf $build_dir # be sure we don't have anything leftover from a previous build 17 make $@ BOARD=$board BUILD=$build_dir || exit 1 18 mv $build_dir/firmware.bin $dest_dir/$descr$fw_tag.bin 19 mv $build_dir/micropython.elf $dest_dir/$descr$fw_tag.elf 20 mv $build_dir/micropython.map $dest_dir/$descr$fw_tag.map 21 rm -rf $build_dir 22} 23 24# check/get parameters 25if [ $# != 3 ]; then 26 echo "usage: $0 <idf-path> <fw-tag> <dest-dir>" 27 exit 1 28fi 29 30idf_path=$1 31fw_tag=$2 32dest_dir=$3 33 34# check we are in the correct directory 35if [ ! -r modesp32.c ]; then 36 echo "must be in esp32 directory" 37 exit 1 38fi 39 40source $idf_path/export.sh 41 42# build the boards, based on the IDF version 43if idf.py --version | grep -q v4.2; then 44 do_build esp32 GENERIC FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py 45 do_build esp32spiram GENERIC_SPIRAM FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py 46 do_build tinypico UM_TINYPICO 47 do_build wesp32 SIL_WESP32 48else 49 do_build esp32c3 GENERIC_C3 50 do_build tinys2 UM_TINYS2 51 do_build featherS2 UM_FEATHERS2 52fi 53