2
REM ************* EDIT HERE ******************
4
rem #low C2, D2, E2 for 0ms, 4ms and 64ms startup. > nul
5
rem #fuses: high DD disabled DE 1.8V DF 2.7V > nul
13
REM ********************** DON'T EDIT BELOW HERE*********************
23
reg import "%~dp0clearhexassoc.reg"
24
reg add HKEY_CLASSES_ROOT\Applications\%~n0.bat\shell\open\command /ve /d "%~0 ""%%1""" /t REG_SZ /f
25
reg add HKEY_CLASSES_ROOT\.hex /ve /d "hexfile" /t REG_SZ /f
26
reg add HKEY_CLASSES_ROOT\hexfile\Shell\Open\Command /ve /d "%~0" /t REG_SZ /f
27
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.hex /ve /d "hexfile" /t REG_SZ /f
28
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hexfile\Shell\Open\Command /ve /d "%~0 ""%%1""" /t REG_SZ /f
29
reg add HKEY_CURRENT_USER\SOFTWARE\Classes\.hex /ve /d "hexfile" /t REG_SZ /f
30
reg add HKEY_CURRENT_USER\SOFTWARE\Classes\hexfile\Shell\Open\Command /ve /d "%~0 ""%%1""" /t REG_SZ /f
31
rem reg add HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hex\UserChoice /v "ProgId" /d "Applications\%~n0.bat" /t REG_SZ /f
37
@ECHO Hex files associated. Double click any hex to flash
50
mode con: cols=%width% lines=%height%
51
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%bufwidth%;$B.height=%bufheight%;$W.buffersize=$B;}"
53
SET file=%~d1%~p1%~n1.hex
55
REM Reconstruct the elf file:
57
del tmp.elf tmp.bin tmp.hex > nul
58
avr-objcopy -I ihex -O elf32-avr "%file%" tmp.elf > nul
59
avr-objcopy -I ihex -O binary "%file%" tmp.bin > nul
60
avr-objcopy -I binary -O elf32-avr tmp.bin tmp.elf > nul
62
copy "%file%" tmp.hex > nul
65
avrdude -p %mcu% -c usbasp -u -e
66
avrdude -c usbasp -p %mcu% -U lfuse:w:%lfuse%:m -U hfuse:w:%hfuse%:m -U efuse:w:%efuse%:m
67
avrdude -c usbasp -p %mcu% -U flash:w:tmp.hex
68
avr-size -C --mcu=%mcu% tmp.elf
70
@del tmp.elf tmp.bin tmp.hex
73
@ECHO This window will self destruct in 45 seconds:
77
@ping -n 45 127.0.0.1 > nul