forked from miloush/netmf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install-CMSIS.ps1
42 lines (31 loc) · 1.26 KB
/
Install-CMSIS.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
<#
.SYNOPSIS
Retrieves and extracts the CMSIS pack supported by NETMF from the official GitHub release.
.EXAMPLE
Get-CMSIS
#>
Import-Module .\tools\scripts\Build-netmf.psm1
# current officially supported version
$packVersion = "4.3.0"
# FUll versioned pack file name to download
$packFileName = "ARM.CMSIS.$packVersion.pack"
# base URL to download the pack file from
$packSourceURLBase = "https://github.com/ARM-software/CMSIS/releases/download/v$packVersion"
# download the pack and extract the files into the curent directory
$dstPath = Join-Path $SPOCLIENT "CMSIS"
$packDescriptionPath = Join-Path $dstPath ARM.CMSIS.pdsc
if( Test-Path -PathType Leaf $packDescriptionPath )
{
# check for the correct version
[System.Xml.XmlDocument] $pdsc = New-Object System.Xml.XmlDocument
$pdsc.Load( $packDescriptionPath )
$releases = $pdsc.SelectNodes("/package/releases/release[@version='$packVersion']")
if( $releases.Count -ne 1 )
{
Write-Error "ERROR: Detected existing but Incompatible CMSIS version installed"
return
}
Write-Host "Existing installation of CMSIS found"
return
}
Invoke-WebRequest -UseBasicParsing -Uri "$packSourceURLBase/$packFileName" | Expand-Stream -Destination $dstPath