From decabdf75f35271ec886744ebec08d9076c62516 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 9 Dec 2023 09:18:39 -0800 Subject: [PATCH] updated the power shell script to be simpler --- flash_atiny13.ps1 | 55 ++++------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/flash_atiny13.ps1 b/flash_atiny13.ps1 index 491cb54..1a2bee9 100644 --- a/flash_atiny13.ps1 +++ b/flash_atiny13.ps1 @@ -1,54 +1,7 @@ # PowerShell script to flash a precompiled HEX file via avrdude.exe with a USBasp programmer -# Path to avrdude.exe -# $AvrdudePath = "C:\path\to\avrdude.exe" -$AvrdudePath = "avrdude.exe" +$Mcu = "t13" +$HexFile ="\pre_built\attiny13_4-8Mhz.hex" +$Programmer="usbasp" - -# Path to the USBasp configuration file (avrdude.conf) -$AvrdudeConf = "avrdude.conf" - -# Path to the HEX file to be flashed -$HexFile = "pre_built\atiny13_4-8.hex" - -# USBasp programmer options -$ProgrammerOptions = "-c usbasp" - -# Microcontroller options (replace with the appropriate values for your microcontroller) -$MCU = "-p attiny13" -$BaudRate = "-B 10" - -# Check if avrdude.exe exists -if (-not (Test-Path $AvrdudePath -PathType Leaf)) { - Write-Error "Error: avrdude.exe not found. Please set AvrdudePath in the script." - exit 1 -} - -# Check if the avrdude configuration file exists -if (-not (Test-Path $AvrdudeConf -PathType Leaf)) { - Write-Error "Error: avrdude.conf not found. Please set AvrdudeConf in the script." - exit 1 -} - -# Check if the HEX file exists -if (-not (Test-Path $HexFile -PathType Leaf)) { - Write-Error "Error: HEX file not found. Please set HexFile in the script." - exit 1 -} - -# Build avrdude command -$AvrdudeCommand = "$AvrdudePath -C $AvrdudeConf $ProgrammerOptions $MCU $BaudRate -U flash:w:$HexFile" - -# Run avrdude command -Write-Host "Flashing HEX file..." -Invoke-Expression $AvrdudeCommand - -# Check avrdude exit code -if ($LASTEXITCODE -eq 0) { - Write-Host "Flashing completed successfully." -} else { - Write-Host "Flashing failed. Check avrdude output for details." -} - -# Exit with avrdude exit code -exit $LASTEXITCODE +.\avrdude.exe -p $Mxu -B 10 -c $Programmer -U flash:w:$HexFile