-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmake.ps1
54 lines (46 loc) · 932 Bytes
/
make.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
45
46
47
48
49
50
51
52
53
54
# Windows Powershell Teensy 3.2 Rust build->flash
# The following parameters are available with automcomplete from the command line
# Example: ./make.ps1 -clean -flash
param (
[switch]$clean = $false,
[switch]$test = $false,
[switch]$bench = $false,
[switch]$flash = $false
)
# Change BIN to match the name of your executable
$BIN="teensy"
# Change TARGET if needed for a different device
$TARGET="thumbv7em-none-eabi"
$OUTDIR="target/$TARGET/release"
$HEX="$OUTDIR/$BIN.hex"
$ELF="$OUTDIR/$BIN"
if ($clean) {
cargo clean
if (-Not $?) {
# Stop the script on error result from the previous command
exit
}
}
if ($test) {
cargo test
if (-Not $?) {
exit
}
}
if ($bench) {
cargo bench
if (-Not $?) {
exit
}
}
cargo build --target=$TARGET --release
if (-Not $?) {
exit
}
arm-none-eabi-objcopy -O ihex $ELF $HEX
if (-Not $?) {
exit
}
if ($flash) {
teensy_loader_cli -w -mmcu=mk20dx256 $HEX -v
}