-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquickFilePathAction.psm1
More file actions
64 lines (62 loc) · 1.87 KB
/
quickFilePathAction.psm1
File metadata and controls
64 lines (62 loc) · 1.87 KB
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
function EmbedEnv() {
$Env:cubeCLIdir = "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin"
$diradd = @(
$Env:cubeCLIdir
)
foreach ($d in $diradd) {
$Env:Path += ";" + $d;
}
}
function keilLoad($uv4project = "$pwd", $project_dir = "$uv4project\*.uvprojx") {
cd $uv4project
if (fd -HI "uvprojx") {
$project_metabuild_path = rvpa $project_dir
while ($true) {
uv4 $project_metabuild_path -f -j0 -l "$uv4project\flash_log.txt" && sleep 3 `
&& Get-Content -Tail 10 .\flash_log.txt && sleep 1
}
}
}
function Invoke-FlashChip() {
$count = 0
$logfile = "flash_log.txt"
uv4 (fd '.uvprojx' -HI) -f -j0 -l $logfile
while ( -not (rg "Programming Done" -g $logfile)) {
Write-Host "waiting $count"
Start-Sleep -Milliseconds 500
if (($count -gt 9) -and (rg "Error")) {
Write-Host "Break at $count because error"
break
}
if ($count -gt 15) {
Write-Host "Break at $count timeout"
break
}
$count += 1
}
[console]::beep(500, 400)
Get-Content -Tail 10 $logfile
}
function Build-FromKeil($clean = $null) {
$count = 0
$logfile = "build_log.txt"
$buildflag = $clean ? "-c" : "-b"
Invoke-Expression('uv4 ' + $buildflag + ' -j0 (fd ".uvprojx" -HI) -l "$logfile"')
$parsedString = $clean ? "Clean done" : "Build Time"
while (-not (rg $parsedString -g $logfile)) {
Write-Host "Waiting for $count..."
Start-Sleep -Milliseconds 500
$count += 1
}
Get-Content -Tail 10 $logfile
}
function Copy-Just($directory = "$(zq newplus templates)\justfile") {
if (Test-Path "justfile") {
Copy-Item $directory -Confirm
}
else {
Copy-Item $directory
}
}
Set-Alias -Name cpjust -Value Copy-Just
# EmbedEnv