Last active
July 17, 2023 10:41
-
-
Save nyomo/45cbebc3b273f05d0ae28949158df88f to your computer and use it in GitHub Desktop.
WSLでavrdudeを簡単に使う為の奴
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#つかいかた | |
#書き込みたいファイルのPATHの変換やってないのでディレクトリ指定があると駄目かも | |
#sh avrdude.sh 書き込みたいファイル.hex | |
#ここにbin/avrdude.exeとetc/avrdude.confのあるディレクトリをLinuxの形式で書く | |
AVRDIR="/mnt/c/Users/nyomoko/tools/arduino/hardware/tools/avr/" | |
WINDIR=$(echo ${AVRDIR}|sed -e 's/\/mnt\/c\//C:\\/'|sed -e 's/\//\\/g') | |
MODECMD='/mnt/c/Windows/System32/mode.com' | |
COMPORT1=$(${MODECMD}|grep -o 'COM[0-9]*') | |
COMPORT2="" | |
while [ "$COMPORT2" = "" ];do | |
sleep 0.5 | |
printf "." | |
COMPORT2=$(${MODECMD}|grep -v $COMPORT1|grep -o 'COM[0-9]*') | |
done | |
echo $COMPORT2 | |
${AVRDIR}bin/avrdude.exe -C ${WINDIR}\etc\\avrdude.conf -c avr109 -p m32u4 -P ${COMPORT2} -U flash:w:$* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これでcmd立ち上げなくて大丈夫な筈だー(∩´∀`)∩ワーイ