diff --git a/Compiling-esp32-port-with-docker.md b/Compiling-esp32-port-with-docker.md index f3079f6..d4b559c 100644 --- a/Compiling-esp32-port-with-docker.md +++ b/Compiling-esp32-port-with-docker.md @@ -10,26 +10,31 @@ cat << "EOF" > ~/.local/bin/esp-compile SCRIPTPATH=$(readlink --canonicalize-existing "${BASH_SOURCE[0]}") # Wrapper script to build / flash esp32 boards inside the official ESP IDF docker container -# Usage: esp-compile +# Usage: esp-compile # Examples # esp-compile v5.0.4 ESP32_GENERIC /dev/ttyACM0 # esp-compile v5.2.2 ESP32_GENERIC # esp-compile v5.2.2 ESP32_GENERIC_C3 /dev/ttyACM0 -# esp-compile v5.2.2 ESP32_GENERIC_C3 clean +# esp-compile v5.2.2 ESP32_GENERIC_S3 clean +# esp-compile v5.2.2 ESP32_GENERIC_S3 /dev/ttyACM1 BOARD_VARIANT=FLASH_4M if [ ! -f /.dockerenv ]; then # If not running in docker container, parse arguments then re-run this same script inside a new esp idf container -if [ "$1" == "" ]; then echo "$0 IDF_VER BOARD "; exit; fi +if [ "$1" == "" ]; then echo "$0 IDF_VER BOARD "; exit; fi IDF_VER=$1 BOARD=$2 -DEPLOY_PORT=$3 -CLEAN=$([ "${@: -1}" == "clean" ] && echo "1") +if [[ $3 == /dev/* ]]; then + DEPLOY_PORT=$3 + shift +fi +shift;shift +ARGS="${@}" CD=$(pwd) docker run -it --rm \ - -e BOARD=$BOARD -e CLEAN=$CLEAN -e DEPLOY_PORT=$DEPLOY_PORT -e UID=$(id -u) \ + -e BOARD=$BOARD -e ARGS="$ARGS" -e DEPLOY_PORT=$DEPLOY_PORT -e UID=$(id -u) \ -v "$CD":"$CD" -v"$SCRIPTPATH":"$SCRIPTPATH" -v /sys/bus:/sys/bus -v /dev:/dev \ --net=host --privileged -w "$CD" espressif/idf:$IDF_VER bash "$SCRIPTPATH" @@ -51,28 +56,26 @@ export HOME=/tmp # inform git that we're in a trusted environemnt (container) git config --global --add safe.directory '*'; -if [ ! -e mpy-cross/build/mpy-cross ]; then +if [ ! -e mpy-cross/build/mpy-cross ]; then make -C mpy-cross fi -if [ "$CLEAN" == "1" ]; then -make -C ports/esp32 BOARD=$BOARD clean - -else # Build the firmware make -C ports/esp32 BOARD=$BOARD submodules if [ "$DEPLOY_PORT" == "" ]; then # Just build the firmware -make -C ports/esp32 BOARD=$BOARD +echo "# make -C ports/esp32 BOARD=$BOARD $ARGS" +make -C ports/esp32 BOARD=$BOARD $ARGS else # build and flash the firmware -make -C ports/esp32 BOARD=$BOARD deploy PORT=$DEPLOY_PORT +echo "# make -C ports/esp32 BOARD=$BOARD $ARGS deploy PORT=$DEPLOY_PORT" +make -C ports/esp32 BOARD=$BOARD $ARGS deploy PORT=$DEPLOY_PORT fi -fi # end of build fi # end of user fi # end of container + EOF chmod +x ~/.local/bin/esp-compile ``` \ No newline at end of file