From 6b4de41f6173299bd0562724c9f2573d94cac6ec Mon Sep 17 00:00:00 2001 From: Juraj Michalek Date: Tue, 12 Oct 2021 15:37:23 +0200 Subject: [PATCH] tools: flasher script for GitHub artifact --- support/esptool/Flash-Chip.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 support/esptool/Flash-Chip.ps1 diff --git a/support/esptool/Flash-Chip.ps1 b/support/esptool/Flash-Chip.ps1 new file mode 100644 index 0000000..782c911 --- /dev/null +++ b/support/esptool/Flash-Chip.ps1 @@ -0,0 +1,16 @@ +$Command = "esptool.exe" +if (Test-Path -Path ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe" -PathType Leaf) { + $Command = ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe" +} +$OldPreference = $ErrorActionPreference +$ErrorActionPreference = 'stop' +try {if(Get-Command $Command){"$Command exists"}} +Catch { + "$Command not found. Downloading" + Invoke-WebRequest https://github.com/espressif/esptool/releases/download/v3.1/esptool-v3.1-win64.zip -OutFile esptool-v3.1-win64.zip + Expand-Archive -Path esptool-v3.1-win64.zip + $Command = ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe" + $ErrorActionPreference=$OldPreference +} + +&$Command -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 esp32-hello-rust.bin