~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to Flintrock/bistro-hd/flashany_attiny25.bat

  • Committer: Selene Scriven
  • Date: 2019-05-24 00:00:21 UTC
  • mto: (483.1.1 fsm)
  • mto: This revision was merged to the branch mainline in revision 443.
  • Revision ID: bzr@toykeeper.net-20190524000021-2f8tp4zvfe9aas7f
added GXB172 firmware from loneoceans (tiny841 boost driver)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@echo off
 
2
REM ************* EDIT HERE ******************
 
3
 
 
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
 
6
 
 
7
 
 
8
SET lfuse=0xD2
 
9
SET hfuse=0xDE
 
10
SET efuse=0xff
 
11
SET mcu=attiny25
 
12
 
 
13
REM ********************** DON'T EDIT BELOW HERE*********************
 
14
 
 
15
echo percent one
 
16
echo %1
 
17
echo "%~1%"
 
18
echo %~dp0
 
19
 
 
20
if ["%~1%"]==[""]  (
 
21
  assoc .hex=hexfile
 
22
  echo assoc %0
 
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
 
32
  ftype hexfile=%0 "%1" 
 
33
 
 
34
@echo on
 
35
@ECHO.
 
36
@ECHO.
 
37
@ECHO Hex files associated.  Double click any hex to flash
 
38
@ECHO.
 
39
@ECHO.
 
40
 
 
41
goto end
 
42
)
 
43
 
 
44
 
 
45
SET width=180
 
46
SET height=40
 
47
SET bufheight=500
 
48
SET bufwidth=500
 
49
 
 
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;}"
 
52
 
 
53
SET file=%~d1%~p1%~n1.hex
 
54
 
 
55
REM Reconstruct the elf file:
 
56
 
 
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
 
61
 
 
62
copy "%file%" tmp.hex > nul
 
63
 
 
64
@echo on
 
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
 
69
 
 
70
@del tmp.elf tmp.bin tmp.hex 
 
71
 
 
72
:end
 
73
@ECHO This window will self destruct in 45 seconds:
 
74
@ECHO.
 
75
@ECHO.
 
76
 
 
77
@ping -n 45 127.0.0.1 > nul