forked from georgik/rustzx-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Flash-RustZX.ps1
45 lines (38 loc) · 1.26 KB
/
Flash-RustZX.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[CmdletBinding()]
param (
[Parameter()]
[String]
$ToolchainName = 'esp-1.56.0.1',
[String]
[ValidateSet("xtensa-esp32-espidf", "xtensa-esp32s2-espidf", "xtensa-esp32s3-espidf", "riscv32imc-esp-espidf")]
$Target = "xtensa-esp32s3-espidf",
[String]
[ValidateSet("esp32", "esp32s2", "esp32s3")]
$Chip = "esp32s3",
[String]
[ValidateSet("esp32s3_usb_otg", "esp32s3_usb_otg", "kaluga")]
$Board = 'esp32s3_usb_otg',
[String]
$ApplicationFile=".\target\$Target\release\rustzx-esp32",
[String]
$Port = "COM10"
)
$ErrorActionPreference = "Stop"
$ApplicationImage = "out"
"Processing configuration:"
"-Board = ${Board}"
"-Target = ${Target}"
"-Chip = ${Chip}"
"-ToolchainName = ${ToolchainName}"
"-ApplicationFile = ${ApplicationFile}"
$ErrorActionPreference = "Stop"
if (-Not (Test-Path -Path $ApplicationFile -PathType Leaf)) {
"$ApplicatioFile does not exist. Build the application"
}
# Requires to be executed in activated ESP-IDF
if (Test-Path -Path $ApplicationImage) {
Remove-Item $ApplicationImage
}
esptool.py --chip ${Chip} elf2image --flash_size 4MB $ApplicationFile -o $ApplicationImage
esptool.py --chip ${Chip} write_flash 0x10000 $ApplicationImage
espmonitor.exe ${Port}