forked from georgik/rustzx-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild-RustZX.ps1
41 lines (36 loc) · 1.53 KB
/
Build-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
[CmdletBinding()]
param (
[ArgumentCompleter( { return [array](rustup toolchain list) })]
[ValidateScript({[array](rustup toolchain list).Contains($_)},
ErrorMessage="Toolchain {0} is not installed. Please install the toolchain using scripts from https://github.com/esp-rs/rust-build")]
[String]
$ToolchainName = 'esp-1.60.0.1',
[String]
[ValidateSet("xtensa-esp32-espidf", "xtensa-esp32s2-espidf", "xtensa-esp32s3-espidf", "riscv32imc-esp-espidf")]
$Target = "riscv32imc-esp-espidf",
[String]
[ValidateSet("esp32s3_usb_otg", "esp32s3_usb_otg", "kaluga_ili9341", "kaluga_st7789", "esp32c3_ili9341")]
$Board = 'esp32c3_ili9341',
[String]
$ApplicationFile=".\target\$Target\release\rustzx-esp32",
[String]
$EspIdfVersion="branch:master",
[String]
$Port = ""
)
$ErrorActionPreference = "Stop"
"Processing configuration:"
"-ApplicationFile = ${ApplicationFile}"
"-Board = ${Board}"
"-EspIdfVersion = ${EspIdfVersion}"
"-Port = ${Port}"
"-Target = ${Target}"
"-ToolchainName = ${ToolchainName}"
$env:ESP_IDF_VERSION="branch:master"
if ($false -eq $Port) {
# Requires to be executed outside of activated ESP-IDF
cargo +$ToolchainName build --target $Target --release --features "${Board} native"
} else {
# Build and flash directly using `cargo install cargo-espflash --git https://github.com/jessebraham/espflash.git --branch fixes/partition-table
cargo +$ToolchainName espflash $Port --target $Target --release --features "${Board} native"
}