Skip to content

Instantly share code, notes, and snippets.

@nyomo
Last active July 17, 2023 10:41
Show Gist options
  • Save nyomo/45cbebc3b273f05d0ae28949158df88f to your computer and use it in GitHub Desktop.
Save nyomo/45cbebc3b273f05d0ae28949158df88f to your computer and use it in GitHub Desktop.
WSLでavrdudeを簡単に使う為の奴
#つかいかた
#書き込みたいファイルの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:$*
@nyomo
Copy link
Author

nyomo commented Jun 6, 2018

これでcmd立ち上げなくて大丈夫な筈だー(∩´∀`)∩ワーイ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment