Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unl-ece-keychain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pscalise2
unl-ece-keychain
Commits
459916ce
Commit
459916ce
authored
4 months ago
by
pscalise2
Browse files
Options
Downloads
Patches
Plain Diff
Delete py32-env-setup.ps1
parent
b12e371b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py32-env-setup.ps1
+0
-158
0 additions, 158 deletions
py32-env-setup.ps1
with
0 additions
and
158 deletions
py32-env-setup.ps1
deleted
100644 → 0
+
0
−
158
View file @
b12e371b
param
(
[
switch
]
$AcceptSEGGERLicense
)
$x86_JLink
=
"JLink_Windows_x86_64.exe"
$downloads
=
(
New-Object
-ComObject
Shell.Application
)
.
NameSpace
(
'shell:Downloads'
)
.
Self
.
Path
$segger_DL_Path
=
-join
(
$downloads
,
'\SEGGER\'
)
$x86programPath
=
-join
(
$segger_DL_Path
,
$x86_JLink
)
$arm64_JLink
=
"JLink_Windows_arm64.exe"
$arm64programPath
=
-join
(
$segger_DL_Path
,
$arm86_JLink
)
$architecture
=
(
Get-CimInstance
-ClassName
Win32_OperatingSystem
)
.
OSArchitecture
$
env
:
Path
=
[
System.Environment
]::
GetEnvironmentVariable
(
"Path"
,
"Machine"
)
if
(
$architecture
-match
"64"
)
{
$architecture
=
"x86"
}
elseif
(
$architecture
-match
"ARM"
)
{
$architecture
=
"ARM"
}
if
(
-not
([
Security.Principal.WindowsPrincipal
]
[
Security.Principal.WindowsIdentity
]::
GetCurrent
())
.
IsInRole
([
Security.Principal.WindowsBuiltInRole
]
"Administrator"
))
{
Write-Output
"Script is not running as administrator. Please run as admin."
exit
}
else
{
if
(
$AcceptSEGGERLicense
)
{
# Check if Chocolatey is installed
if
(
Get-Command
choco
-ErrorAction
SilentlyContinue
)
{
Write-Host
"Chocolatey is already installed. Version:
$(
choco
--version
)
"
}
else
{
Write-Host
"Chocolatey is not installed. Installing now..."
# Set execution policy to allow script execution
Set-ExecutionPolicy
Bypass
-Scope
Process
-Force
# Download and install Chocolatey
[
System.Net.ServicePointManager
]::
SecurityProtocol
=
[
System.Net.SecurityProtocolType
]::
Tls12
iex
((
New-Object
System.Net.WebClient
)
.
DownloadString
(
'https://chocolatey.org/install.ps1'
))
# Wait for installation to complete
Start-Sleep
-Seconds
5
# Refresh the environment variable to include the new Chocolatey path
$
env
:
Path
+=
";
$
env
:
ProgramData
\chocolatey\bin"
# Check if installation was successful
if
(
Get-Command
choco
-ErrorAction
SilentlyContinue
)
{
Write-Host
"Chocolatey installed successfully. Version:
$(
choco
--version
)
"
}
else
{
Write-Host
"Chocolatey installation failed."
}
}
#Check to see if depends are installed, if not, install them
if
(
Get-Command
make
-ErrorAction
SilentlyContinue
)
{
Write-Host
"Make is installed."
}
else
{
Write-Host
"Installing Make..."
choco
install
make
-y
}
if
(
Get-Command
curl.exe
-ErrorAction
SilentlyContinue
)
{
Write-Host
"Curl is installed"
}
else
{
Write-Host
"Installing Curl..."
choco
install
curl
-y
}
if
(
Get-Command
arm-none-eabi-gcc
-ErrorAction
SilentlyContinue
)
{
Write-Host
"ARM GCC Tools are installed"
}
else
{
Write-Host
"Installing ARM GCC Tools..."
choco
install
gcc-arm-embedded
-y
}
# Check to see if Jlink V8+ is installed
if
(
!
(
Test-Path
"C:\Program Files\SEGGER\V8*"
)){
# Download the updated SEGGER JLink software
New-Item
-Path
$segger_DL_Path
-ItemType
Directory
-ErrorAction
SilentlyContinue
Write-Host
"Downloading Latest SEGGER JLink Tools. This may take a minute..."
if
(
$architecture
-eq
"x86"
){
$verboseOutput
=
curl.exe
-v
-d
"accept_license_agreement=accepted&submit=Download+software"
https://www.segger.com/downloads/jlink/JLink_Windows_x86_64.exe
-o
$x86programPath
2
>
&
1
}
elseif
(
$architecture
-eq
"ARM"
){
$verboseOutput
=
curl.exe
-v
-d
"accept_license_agreement=accepted&submit=Download+software"
https://www.segger.com/downloads/jlink/JLink_Windows_arm64.exe
-o
$x86programPath
2
>
&
1
}
# Extract the HTTP status code from the verbose output
$httpCode
=
$verboseOutput
|
Select-String
-Pattern
"HTTP/.*"
|
ForEach-Object
{
if
(
$_
-match
'HTTP/.* (\d{3}) OK'
)
{
$matches
[
1
]
}
}
|
Select-Object
-First
1
if
(
$httpCode
-eq
"200"
)
{
Write-Host
"JLink Software Download successful (HTTP Status Code:
$statusCode
)"
Write-Host
"Opening JLink Installer..."
Write-Host
"Script will continue after the installation of JLink Software is complete... Continue with the install wizard."
if
(
$architecture
-eq
"x86"
){
Start-Process
-FilePath
$x86programPath
-Wait
}
elseif
(
$architecture
-eq
"ARM"
){
Start-Process
-FilePath
$arm64programPath
-Wait
}
}
else
{
Write-Host
"Download failed (HTTP Status Code:
$statusCode
). Run the script again."
}
}
else
{
Write-Host
"JLink tools V8+ already installed."
}
# Check if JLinkDevices folder exists
$jlinkDevices
=
"
$
env
:
USERPROFILE
\AppData\Roaming\SEGGER\JLinkDevices"
if
(
!
(
Test-Path
$jlinkDevices
)){
New-Item
-Path
$jlinkDevices
-ItemType
Directory
Write-Host
"Creating JLinkDevices directory."
}
else
{
Write-Host
"JLinkDevices directory exists."
}
# Check if Puya parent folder exists
$puyadir
=
"
$
env
:
USERPROFILE
\AppData\Roaming\SEGGER\JLinkDevices\Puya"
$fullPuyaPath
=
"
$
env
:
USERPROFILE
\AppData\Roaming\SEGGER\JLinkDevices\Puya\PY32"
if
(
!
(
Test-Path
$puyadir
)){
# Add Puya Parent folder if it does not exist
New-Item
-Path
$fullPuyaPath
-ItemType
Directory
}
else
{
if
(
!
(
Test-Path
$fullPuyaPath
)){
# Add PY32 family folder
New-Item
-Path
$fullPuyaPath
-ItemType
Directory
}
else
{
}
}
$scriptDirectory
=
Split-Path
-Path
$MyInvocation
.
MyCommand
.
Definition
-Parent
$sourceDirectory
=
"
$scriptDirectory
\PY32"
# Copy the flash algorithm files and JLinkDevices.xml to the PY32 folder.
Copy-Item
-Path
"
$sourceDirectory
\*"
-Destination
$fullPuyaPath
-Recurse
-Force
# Get the path to the recently added SEGGER exe's
$latestSeggerVersionPath
=
(
Get-ChildItem
"C:\Program Files\SEGGER"
-Directory
|
Sort-Object
LastWriteTime
-Descending
|
Select-Object
-First
1
)
.
FullName
$pathExists
=
$
env
:
Path
-split
';'
|
Where-Object
{
$_
-eq
$latestSeggerVersionPath
}
if
(
$pathExists
)
{
"SEGGER Binaries already exist in the PATH. No action necessary."
}
else
{
[
Environment
]::
SetEnvironmentVariable
(
"Path"
,
$
env
:
Path
+
$latestSeggerVersionPath
,
[
EnvironmentVariableTarget
]::
Machine
)
Write-Host
"Added
$atestSeggerVersionPath
to the System PATH."
}
Write-Host
"
`n
If there are no errors setup is complete. Open (or restart if already open) vscode.
`n
"
}
else
{
Write-Host
"Please accept the SEGGER License to download the software. Add --AcceptSEGGERLicense in the command line."
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment