Description
Problem
When selecting 'upload using programmer' targeting an alternative CPU, the command string passed to avrdude does not contain the path to the custom avrdud.conf file. If using the USB port (normal way to upload sketches), the correct path is passed and all works well. However, when using the programmer the 'standard' path is passed and avrdude faults out with 'unrecognized CPU type' error.
Details
If using USB port to upload a program, AVRdude is passed the following:
C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\Win7\AppData\Local\Arduino15\packages\ATmegaCAN\hardware\avr\1.0.2/avrdude.conf -v -patmega64m1 -carduino -PCOM22 -b57600 -D -Uflash:w:C:\Users\Win7\AppData\Local\Temp\build2af98d057f4e31a77cc1e543f707ebe2.tmp/sketch_feb27a.ino.hex:i
However, if 'upload using programmer' is selected, the following is passed:
C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega64m1 -cusbasp -Pusb -Uflash:w:C:\Users\Win7\AppData\Local\Temp\build2af98d057f4e31a77cc1e543f707ebe2.tmp/sketch_feb27a.ino.hex:i
Environment
Arduino IDE 1.6.7
Added in custom board script via board manager:
https://thomasonw.github.io/ATmegaCAN/package_thomasonw_ATmegaCAN_index.json
(Support for ATmegaxxM1 uC's)
Win 7
Attached files: platform.txt, boards.txt, and programmers.txt included in ATmegaCAN board download.
Additional
It appears to me that the relevant lines in platform.txt are:
- tools.avrdude.config.path={runtime.platform.path}/avrdude.conf
- tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"
- tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
in that the last line: tools.avrdude.program.pattern=
... is what is used when selecting 'Upload using programmer'? And it also seems that the {config.path} is not being picked up correctly, using the default path vs. the one defined in the custom platform.txt file? (I am only speculating here)
Related?
" board.*.tool in boards.txt and tools directives in platforms.txt are ignored #3463 "
https://github.com/arduino/Arduino/issues/3463