828687b9ac
- preserve: bonding 정보 및 settings/NVS 유지, application만 다시 올리는 용도
30 lines
941 B
PowerShell
30 lines
941 B
PowerShell
param(
|
|
[string]$Hex = "build\merged.hex",
|
|
[string]$BuildDir = "build"
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$RepoRoot = Split-Path -Parent $PSScriptRoot
|
|
$HexPath = Join-Path $RepoRoot $Hex
|
|
$BuildPath = Join-Path $RepoRoot $BuildDir
|
|
$Cmake = "C:\ncs\toolchains\fd21892d0f\opt\bin\cmake.exe"
|
|
if (-not (Test-Path -LiteralPath $Cmake)) {
|
|
$Cmake = "cmake"
|
|
}
|
|
|
|
Write-Host "[FLASH] Rebuilding: $BuildPath"
|
|
& $Cmake --build $BuildPath
|
|
|
|
if (-not (Test-Path -LiteralPath $HexPath)) {
|
|
throw "Hex file not found: $HexPath. Build the project first."
|
|
}
|
|
|
|
Write-Host "[FLASH] PRESERVE mode"
|
|
Write-Host "[FLASH] Uses sector erase, so NVS/settings and BLE bonds are preserved if the hex has no records in settings_storage."
|
|
Write-Host "[FLASH] settings_storage is expected at 0xFE000-0x100000 for this project."
|
|
Write-Host "[FLASH] Programming: $HexPath"
|
|
|
|
nrfjprog --program $HexPath --sectorerase --verify --reset
|