diff --git a/device_specific/flash_the_ttgo_tdisplay b/device_specific/flash_the_ttgo_tdisplay index e421187..df640b5 100755 --- a/device_specific/flash_the_ttgo_tdisplay +++ b/device_specific/flash_the_ttgo_tdisplay @@ -35,18 +35,20 @@ fi echo "LINUX ONLY. Flashing the ${device}..." -if ! command -v cmake &>/dev/null; then +if ! command -v cmake &> /dev/null; then echo -e "\nERROR:\ncmake was not found on your system.\nPlease install cmake by running:\n\nsudo apt update && sudo apt install -y cmake\n" exit 1 -elif ! command -v git &>/dev/null; then +elif ! command -v git &> /dev/null; then echo -e "\nERROR:\ngit was not found on your system.\nPlease install git by running:\n\nsudo apt update && sudo apt install -y git\n" exit 1 -elif ! command -v pip &>/dev/null; then +elif ! command -v pip &> /dev/null; then echo -e "\n\RROR:\npip was not found on your system.\nPlease install pip by running:\n\nsudo apt update && sudo apt install -y python3-pip\n" exit 1 -elif ! command -v virtualenv &>/dev/null; then +elif ! command -v virtualenv &> /dev/null; then echo -e "\nERROR:\nvirtualenv was not found on your system.\nPlease install virtualenv by running:\n\nsudo apt update && sudo apt install -y python3-virtualenv\n" exit 1 +elif ! command -v esptool &> /dev/null; then + echo -e "\nERROR:\esptool was not found on your system.\nPlease install esptool by running:\n\nsudo apt update && sudo apt install -y esptool\n" fi if [ ! -f "${esp_idf_save_directory}"/export.sh ]; then @@ -73,15 +75,14 @@ sed -i.bak '/CONFIG_DEBUG_MODE/d' ./sdkconfig.defaults sed -i.bak '1s/^/CONFIG_LOG_DEFUALT_LEVEL_NONE=y\n/' sdkconfig.defaults rm sdkconfig.defaults.bak +idf.py build + while [ ! -c "${tty_device}" ]; do read -srn1 -p "Connect your ${device} and PRESS ANY KEY to continue... " && echo done -tty_device_permissions="$(stat -c '%a' ${tty_device})" -if [ "${tty_device_permissions:2}" -lt 6 ]; then - echo -e "ERROR:\nYou need elevated permissions to write to the device.\nPlease update your device permissoins by running:\n\nsudo chmod o+rw ${tty_device}\n" - exit 1 -fi -idf.py flash +# TODO: read the flash arguments from jade/build/flasher_args.json, +# like how esptool.py does, rather than hard-code the arguments +sudo esptool --port "${tty_device}" write_flash --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x10000 build/jade.bin 0x9000 build/partition_table/partition-table.bin 0xe000 build/ota_data_initial.bin echo -e "\nSUCCESS! Your ${device} is now running Jade."