Fix check-dev-env.ps1 encoding for Windows PowerShell

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yuquanjun 2026-08-26 07:28:03 +08:00
parent 89fa953006
commit 9ee3b562f6
1 changed files with 14 additions and 17 deletions

View File

@ -1,14 +1,14 @@
#Requires -Version 5.1 #Requires -Version 5.1
<# <#
.SYNOPSIS .SYNOPSIS
检查 YNGJ-GT1-M AT32F403ARCT7 工程开发环境是否就绪 Check YNGJ-GT1-M AT32F403ARCT7 development environment.
#> #>
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
$projectRoot = Split-Path $PSScriptRoot -Parent $projectRoot = Split-Path $PSScriptRoot -Parent
Write-Host "=== YNGJ-GT1-M 开发环境检查 ===" -ForegroundColor Cyan Write-Host "=== YNGJ-GT1-M Dev Environment Check ===" -ForegroundColor Cyan
Write-Host "工程路径: $projectRoot`n" Write-Host "Project: $projectRoot`n"
function Test-Command($name, $cmd) { function Test-Command($name, $cmd) {
$found = Get-Command $cmd -ErrorAction SilentlyContinue $found = Get-Command $cmd -ErrorAction SilentlyContinue
@ -16,21 +16,19 @@ function Test-Command($name, $cmd) {
Write-Host "[OK] $name -> $($found.Source)" -ForegroundColor Green Write-Host "[OK] $name -> $($found.Source)" -ForegroundColor Green
return $true return $true
} else { } else {
Write-Host "[缺失] $name" -ForegroundColor Red Write-Host "[MISS] $name" -ForegroundColor Red
return $false return $false
} }
} }
# Git
Test-Command "Git" "git" | Out-Null Test-Command "Git" "git" | Out-Null
# J-Link
$jlink = Test-Command "J-Link" "JLink" $jlink = Test-Command "J-Link" "JLink"
if (-not $jlink) { if (-not $jlink) {
Write-Host " 安装: winget install NordicSemiconductor.JLink" -ForegroundColor Yellow Write-Host " Install: winget install NordicSemiconductor.JLink" -ForegroundColor Yellow
Write-Host " Or download: https://www.segger.com/downloads/jlink/" -ForegroundColor Yellow
} }
# IAR - search common install paths
$iarPaths = @( $iarPaths = @(
"C:\Program Files\IAR Systems", "C:\Program Files\IAR Systems",
"C:\Program Files (x86)\IAR Systems", "C:\Program Files (x86)\IAR Systems",
@ -51,11 +49,10 @@ foreach ($base in $iarPaths) {
} }
} }
if (-not $iarFound) { if (-not $iarFound) {
Write-Host "[缺失] IAR Embedded Workbench for ARM" -ForegroundColor Red Write-Host "[MISS] IAR Embedded Workbench for ARM" -ForegroundColor Red
Write-Host " 下载: https://www.iar.com/embedded-development-tools/free-trials" -ForegroundColor Yellow Write-Host " Download: https://www.iar.com/embedded-development-tools/free-trials" -ForegroundColor Yellow
} }
# AT32 Device Pack - check for ArteryTek DDF in IAR config
$at32Pack = $false $at32Pack = $false
foreach ($base in $iarPaths) { foreach ($base in $iarPaths) {
$ddf = Get-ChildItem -Path $base -Recurse -Filter "AT32F403AxC*.ddf" -ErrorAction SilentlyContinue | Select-Object -First 1 $ddf = Get-ChildItem -Path $base -Recurse -Filter "AT32F403AxC*.ddf" -ErrorAction SilentlyContinue | Select-Object -First 1
@ -66,16 +63,16 @@ foreach ($base in $iarPaths) {
} }
} }
if (-not $at32Pack -and $iarFound) { if (-not $at32Pack -and $iarFound) {
Write-Host "[缺失] AT32 IAR Device Pack (ArteryTek)" -ForegroundColor Red Write-Host "[MISS] AT32 IAR Device Pack (ArteryTek)" -ForegroundColor Red
Write-Host " 下载: https://www.arterytek.com/cn/product/AT32F403A.jsp" -ForegroundColor Yellow Write-Host " Download: https://www.arterytek.com/cn/product/AT32F403A.jsp" -ForegroundColor Yellow
} }
# Project files
Write-Host "" Write-Host ""
if (Test-Path "$projectRoot\project\IAR_V7.4\YNGJ-GT1-M.eww") { if (Test-Path "$projectRoot\project\IAR_V7.4\YNGJ-GT1-M.eww") {
Write-Host "[OK] 主工程 YNGJ-GT1-M.eww" -ForegroundColor Green Write-Host "[OK] Main project YNGJ-GT1-M.eww" -ForegroundColor Green
} else { } else {
Write-Host "[缺失] 主工程文件" -ForegroundColor Red Write-Host "[MISS] Main project file" -ForegroundColor Red
} }
Write-Host "`n详细配置说明见: DEVELOPMENT_SETUP.md" -ForegroundColor Cyan Write-Host ""
Write-Host "See DEVELOPMENT_SETUP.md for full setup guide." -ForegroundColor Cyan