forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-esp32-openocd.ps1
26 lines (19 loc) · 1.03 KB
/
install-esp32-openocd.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
# This PS installs the OpenOCD ESP32 toolchain from Espressif downloads repository
# if it's not already available at ESP32_TOOLS_PATH\openocd-esp32
$env:ESP32_OPENOCD_PATH=($env:ESP32_TOOLS_PATH+'\openocd-esp32')
# check if path already exists
$OpenOCDPathExists = Test-Path $env:ESP32_OPENOCD_PATH -ErrorAction SilentlyContinue
If($OpenOCDPathExists -eq $False)
{
Write-Host "Downloading OpenOCD for ESP32 ..."
$url = "https://github.com/espressif/openocd-esp32/releases/download/v0.10.0-esp32-20180724/openocd-esp32-win32-0.10.0-esp32-20180724.zip"
$output = "$PSScriptRoot\openocd-esp32.zip"
# download zip with OpenOcd tool
(New-Object Net.WebClient).DownloadFile($url, $output)
Write-Host "Installing OpenOCD..."
# unzip
#Expand-Archive $output -DestinationPath $env:ESP32_OPENOCD_PATH
Expand-Archive $output -DestinationPath "$PSScriptRoot\openocd-esp32"
Move-Item -Path ("$PSScriptRoot\openocd-esp32\openocd-esp32\") -Destination $env:ESP32_OPENOCD_PATH
Remove-Item "$PSScriptRoot\openocd-esp32" -Force
}