forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-stm32-tools.ps1
66 lines (57 loc) · 2.41 KB
/
install-stm32-tools.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
55
56
57
58
59
60
61
62
63
64
65
66
$BOARD_NAME = "STM32"
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Write-Host "Install Tools to build nanoCLR into default folders and configure json files ..."
$env:BOARD_NAME = $BOARD_NAME
$env:NANOCLR_COMPORT = $COMPORT
# check if build folder` already exists
$buildPathExists = Test-Path "$PSScriptRoot\build\" -ErrorAction SilentlyContinue
If($buildPathExists -eq $False)
{
md $("$PSScriptRoot\build\" )
Write-Host "Create build folder ..."
}
Write-Host "BOARD_NAME=" $env:BOARD_NAME
If([string]::IsNullOrEmpty($env:GNU_GCC_TOOLCHAIN_PATH) -or $force)
{
$env:GNU_GCC_TOOLCHAIN_PATH='C:\GNU_Tools_ARM_Embedded\7-2018-q2-update'
Write-Host ("Set User Environment GNU_GCC_TOOLCHAIN_PATH='"+$env:GNU_GCC_TOOLCHAIN_PATH+"'")
[System.Environment]::SetEnvironmentVariable("GNU_GCC_TOOLCHAIN_PATH", $env:GNU_GCC_TOOLCHAIN_PATH, "User")
}
If([string]::IsNullOrEmpty($env:HEX2DFU_PATH) -or $force)
{
$env:HEX2DFU_PATH= 'C:\mytools\hex2dfu'
Write-Host ("Set User Environment HEX2DFU_PATH='"+$env:HEX2DFU_PATH+"'")
[System.Environment]::SetEnvironmentVariable("HEX2DFU_PATH", $env:HEX2DFU_PATH, "User")
}
If([string]::IsNullOrEmpty($env:NINJA_PATH) -or $force)
{
$env:NINJA_PATH= 'C:\mytools\ninja'
Write-Host ("Set User Environment NINJA_PATH='"+$env:NINJA_PATH+"'")
[System.Environment]::SetEnvironmentVariable("NINJA_PATH", $env:NINJA_PATH, "User")
}
# get build matrix
Invoke-Expression -Command .\get-stm32-targets-to-build.ps1
# install tools and utilities
Invoke-Expression -Command .\install-arm-gcc-toolchain.ps1
Invoke-Expression -Command .\install-ninja.ps1
Invoke-Expression -Command .\install-nf-hex2dfu.ps1
$test = [System.Environment]::GetEnvironmentVariable("NINJA_PATH", "User")
If($test -eq "")
{
[System.Environment]::SetEnvironmentVariable("NINJA_PATH", $env:NINJA_PATH, "User")
}
<#
.SYNOPSIS
Install the default tools to build nanoFramework for STM32 and setup build environemnt.
.DESCRIPTION
Power Shell Script to install the default tools to build nano Framework, including setting the machine path and other environment variables needed for STM32
.EXAMPLE
.\install-stm32-tools.ps1
Install the tools for STM32 to default path, define required envisonment variables and update VSCode files with paths and set COM19 in tasks.json
.NOTES
Tested on Windows 10
Author: nanoFramework Contributors
Created: September 9th, 2018
.LINK
https://https://github.com/nanoframework/Home
#>