环境
APM2 MacOS10.9 使用brew安装avrdude
avrdude用法整理
常用参数
- -C 使用配置文件,举例例如
-C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf
这个conf是在网上下载的avrdude中包含的。 - -v verbose模式没什么可说的
- -c 指定烧写器型号,例如usbtiny
- -e 擦除rom,注意也会擦掉bootloader
-U 执行命令,包括烧录、设定fuse、执行指令等等。
具体说一下fuse参数 -U memtype:op:filename[:format]- -Uefuse:w:0xFD:m 设定extend fuse
- -Uhfuse:w:0xD8:m 设定fuse high位置
- -Ulfuse:w:0xFF:m 设定fuse low位置
- -Ulock:w:0x3F:m 解锁bootloader区域
- -Ulock:w:0x0f:m 锁bootlodaer区域
- -Uflash:w:~/stk500boot_v2_mega2560.hex:i 烧rom
——–以上是所用到的avrdude参数——–
以下是整理好的命令
第一步解锁bootloader area,第二步设定熔丝位
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m
开始烧程序
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cusbasp -Pusb -Uflash:w:/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/stk500v2/stk500boot_v2_mega2560.hex:i
重新上锁
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cusbtiny -Ulock:w:0x0F:m