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*********************
19
reg import "%~dp0clearhexassoc.reg"
20
reg add HKEY_CLASSES_ROOT\Applications\%~n0.bat\shell\open\command /ve /d "%~0 ""%%1""" /t REG_SZ /f
21
reg add HKEY_CLASSES_ROOT\.hex /ve /d "hexfile" /t REG_SZ /f
22
reg add HKEY_CLASSES_ROOT\hexfile\Shell\Open\Command /ve /d "%~0" /t REG_SZ /f
23
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.hex /ve /d "hexfile" /t REG_SZ /f
24
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hexfile\Shell\Open\Command /ve /d "%~0 ""%%1""" /t REG_SZ /f
25
reg add HKEY_CURRENT_USER\SOFTWARE\Classes\.hex /ve /d "hexfile" /t REG_SZ /f
26
reg add HKEY_CURRENT_USER\SOFTWARE\Classes\hexfile\Shell\Open\Command /ve /d "%~0 ""%%1""" /t REG_SZ /f
27
rem reg add HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hex\UserChoice /v "ProgId" /d "Applications\%~n0.bat" /t REG_SZ /f
33
@ECHO Hex files associated. Double click any hex to flash
46
mode con: cols=%width% lines=%height%
47
powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%bufwidth%;$B.height=%bufheight%;$W.buffersize=$B;}"
49
SET file=%~d1%~p1%~n1.hex
51
REM Reconstruct the elf file:
53
del tmp.elf tmp.bin tmp.hex > nul
54
avr-objcopy -I ihex -O elf32-avr "%file%" tmp.elf > nul
55
avr-objcopy -I ihex -O binary "%file%" tmp.bin > nul
56
avr-objcopy -I binary -O elf32-avr tmp.bin tmp.elf > nul
58
copy "%file%" tmp.hex > nul
61
avrdude -p %mcu% -c usbasp -u -e
62
avrdude -c usbasp -p %mcu% -U lfuse:w:%lfuse%:m -U hfuse:w:%hfuse%:m -U efuse:w:%efuse%:m
63
avrdude -c usbasp -p %mcu% -U flash:w:tmp.hex
64
avr-size -C --mcu=%mcu% tmp.elf
66
@del tmp.elf tmp.bin tmp.hex
69
@ECHO This window will self destruct in 45 seconds:
73
@ping -n 45 127.0.0.1 > nul