-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupload_littlefs.ps1
More file actions
26 lines (20 loc) · 954 Bytes
/
Copy pathupload_littlefs.ps1
File metadata and controls
26 lines (20 loc) · 954 Bytes
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
param(
[string]$Port = "COM4"
)
$ErrorActionPreference = "Stop"
$mklittlefs = "C:\Users\gao19\AppData\Local\Arduino15\packages\esp32\tools\mklittlefs\4.0.2-db0513a-cn\mklittlefs.exe"
$esptool = "C:\Users\gao19\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\5.1.0-cn\esptool.exe"
$projectRoot = Split-Path -Parent $PSScriptRoot
$dataDir = Join-Path $projectRoot "data"
$buildDir = Join-Path $projectRoot "build\littlefs"
$imagePath = Join-Path $buildDir "littlefs.bin"
New-Item -ItemType Directory -Force -Path $buildDir | Out-Null
& $mklittlefs -c $dataDir -b 4096 -p 256 -s 10354688 $imagePath
if ($LASTEXITCODE -ne 0) {
throw "mklittlefs failed with exit code $LASTEXITCODE"
}
& $esptool --chip esp32s3 --port $Port --baud 921600 --before default-reset --after hard-reset write-flash 0x610000 $imagePath
if ($LASTEXITCODE -ne 0) {
throw "esptool failed with exit code $LASTEXITCODE"
}
Write-Host "LittleFS uploaded to $Port"