From dac523c8b4d8102b82aab94eed5858b4b08b73bc Mon Sep 17 00:00:00 2001 From: Gabor Peresztegi Date: Sat, 15 Mar 2025 13:46:23 +0100 Subject: [PATCH] Update build and deploy scripts --- ...build-generic-spiram.sh => build-esp32.sh} | 11 ++++-- scripts/build-m5core2.sh | 13 ------- scripts/build-unix.sh | 2 + scripts/clean.sh | 2 + ...ploy-generic-spiram.sh => deploy-esp32.sh} | 10 +++-- scripts/deploy-m5core2.sh | 9 ----- scripts/env-variables-esp32.sh | 5 +-- scripts/env-variables-micropython.sh | 2 + scripts/erase-flash-esp32.sh | 7 ++++ scripts/menu-esp32.sh | 39 +++++++++++++++++++ 10 files changed, 68 insertions(+), 32 deletions(-) rename scripts/{build-generic-spiram.sh => build-esp32.sh} (57%) delete mode 100755 scripts/build-m5core2.sh rename scripts/{deploy-generic-spiram.sh => deploy-esp32.sh} (57%) delete mode 100755 scripts/deploy-m5core2.sh create mode 100644 scripts/menu-esp32.sh diff --git a/scripts/build-generic-spiram.sh b/scripts/build-esp32.sh similarity index 57% rename from scripts/build-generic-spiram.sh rename to scripts/build-esp32.sh index 2f48d7b82..fdbb06c9d 100755 --- a/scripts/build-generic-spiram.sh +++ b/scripts/build-esp32.sh @@ -1,14 +1,17 @@ -# Build MicroPython-LVGL firmware for: Generic ESP32 boards +#!/bin/bash + +# Build MicroPython-LVGL firmware for ESP32 boards source env-variables-micropython.sh source env-variables-esp32.sh -BOARD=ESP32_GENERIC -VARIANT=SPIRAM +source menu-esp32.sh +if [ -z "$BOARD" ]; then + exit 1 +fi cd $MICROPYTHON make -C mpy-cross cd $MICROPYTHON/ports/esp32 -make submodules make BOARD=$BOARD VARIANT=$VARIANT diff --git a/scripts/build-m5core2.sh b/scripts/build-m5core2.sh deleted file mode 100755 index 341bd415a..000000000 --- a/scripts/build-m5core2.sh +++ /dev/null @@ -1,13 +0,0 @@ -# Build MicroPython-LVGL firmware for: M5Stack Core2 ESP32 - -source env-variables-micropython.sh -source env-variables-esp32.sh - -BOARD=M5STACK_CORE2 - -cd $MICROPYTHON -make -C mpy-cross - -cd $MICROPYTHON/ports/esp32 -make submodules -make BOARD=$BOARD diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh index 7d1ea8512..1da9d0024 100755 --- a/scripts/build-unix.sh +++ b/scripts/build-unix.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Build MicroPython-LVGL app for: Unix/Linux systems source env-variables-micropython.sh diff --git a/scripts/clean.sh b/scripts/clean.sh index 0a2375185..2261fced2 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Clear build directories ORIGINAL_DIR=$PWD diff --git a/scripts/deploy-generic-spiram.sh b/scripts/deploy-esp32.sh similarity index 57% rename from scripts/deploy-generic-spiram.sh rename to scripts/deploy-esp32.sh index cf76f73cb..28d99efc1 100755 --- a/scripts/deploy-generic-spiram.sh +++ b/scripts/deploy-esp32.sh @@ -1,10 +1,14 @@ -# Deploy firmware to device: Generic ESP32 boards +#!/bin/bash + +# Deploy firmware ESP32 boards source env-variables-micropython.sh source env-variables-esp32.sh -BOARD=ESP32_GENERIC -VARIANT=SPIRAM +source menu-esp32.sh +if [ -z "$BOARD" ]; then + exit 1 +fi cd $MICROPYTHON/ports/esp32 make deploy BOARD=$BOARD VARIANT=$VARIANT diff --git a/scripts/deploy-m5core2.sh b/scripts/deploy-m5core2.sh deleted file mode 100755 index 29bb16720..000000000 --- a/scripts/deploy-m5core2.sh +++ /dev/null @@ -1,9 +0,0 @@ -# Deploy firmware to device: M5Stack Core2 ESP32 - -source env-variables-micropython.sh -source env-variables-esp32.sh - -BOARD=M5STACK_CORE2 - -cd $MICROPYTHON/ports/esp32 -make deploy BOARD=$BOARD diff --git a/scripts/env-variables-esp32.sh b/scripts/env-variables-esp32.sh index bf3906dc0..c381ef66d 100755 --- a/scripts/env-variables-esp32.sh +++ b/scripts/env-variables-esp32.sh @@ -1,8 +1,7 @@ +#!/bin/bash + # Set environment variables for ESP32 development ESPIDF=~/esp/esp-idf-5-2-3 - -BOARD=ESP32_GENERIC - source $ESPIDF/export.sh diff --git a/scripts/env-variables-micropython.sh b/scripts/env-variables-micropython.sh index 5d4ef3b02..cfc8afc2f 100755 --- a/scripts/env-variables-micropython.sh +++ b/scripts/env-variables-micropython.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Set environment variables for MicroPython development BUILD_VERBOSE=1 diff --git a/scripts/erase-flash-esp32.sh b/scripts/erase-flash-esp32.sh index a9bda07f5..58ab817b1 100755 --- a/scripts/erase-flash-esp32.sh +++ b/scripts/erase-flash-esp32.sh @@ -1,7 +1,14 @@ +#!/bin/bash + # Erase the flash memory of the ESP32 board source env-variables-micropython.sh source env-variables-esp32.sh +source menu-esp32.sh +if [ -z "$BOARD" ]; then + exit 1 +fi + cd $MICROPYTHON/ports/esp32 make erase BOARD=$BOARD \ No newline at end of file diff --git a/scripts/menu-esp32.sh b/scripts/menu-esp32.sh new file mode 100644 index 000000000..e88c32aa1 --- /dev/null +++ b/scripts/menu-esp32.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Show ESP32 board / variant selector menu + +# Array of configurations +configs=( + "ESP32_GENERIC" + "ESP32_GENERIC SPIRAM" + "ESP32_GENERIC_S3" + "ESP32_GENERIC_S3 SPIRAM_OCT" + "M5STACK_CORE2" +) + +# Function to display menu and get user choice +show_menu() { + echo "Select a configuration:" + for i in "${!configs[@]}"; do + echo "$((i+1)). ${configs[$i]}" + done + read -p "Enter your choice (1-${#configs[@]}): " choice + return $choice +} + +# Display menu and get user choice +show_menu +choice=$? + +# Validate user input +if [[ $choice -lt 1 || $choice -gt ${#configs[@]} ]]; then + echo "Invalid choice. Exiting." + exit 1 +fi + +# Set BOARD and VARIANT based on user choice +selected_config=(${configs[$((choice-1))]}) +BOARD=${selected_config[0]} +VARIANT=${selected_config[1]:-""} + +echo "Selected configuration: BOARD=$BOARD, VARIANT=$VARIANT"