-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild-ProductionImage.ps1
21 lines (16 loc) · 1.06 KB
/
Build-ProductionImage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[CmdletBinding()]
Param(
[Parameter(Position=1)]$IARRoot = "${env:ProgramFiles(x86)}\IAR Systems\Embedded Workbench 7.3"
)
# NOTE: Also requires the "strings" tool from sysinternals on your path
# choco install -y sysinternals is an easy way to make that happen.
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
# Build with IAR
Start-Process (Join-Path $IARRoot "common\bin\IarBuild.exe") -ArgumentList @('Project.ewp', '-build', 'Production') -WorkingDirectory $PSScriptRoot -NoNewWindow -Wait
# Generate the config file by grepping for the build string in the elf file.
# Couldn't find any better way to extract this from the object files or final elf file...
$BuildString = (strings (Join-Path $PSScriptRoot 'Production\Exe\Project.out') | Select-String -Pattern '\[Sensics')
Out-File (Join-Path $PSScriptRoot 'Production\Exe\Config.txt') -InputObject $BuildString
Write-Host 'Completed build identified as:'
Write-Host $BuildString
Write-Host "See the .hex and Config.txt files in $(Join-Path $PSScriptRoot 'Production\Exe')"