queezythegreat / arduino-cmake

Arduino CMake Build system
648 stars 216 forks source link

Error in avrdude arguments #14

Closed treaves closed 12 years ago

treaves commented 12 years ago

When I run the xxx-upload target, it fails with: avrdude: can't open config file "/usr/local/etc/avrdude.conf": No such file or directory avrdude: error reading system wide configuration file "/usr/local/etc/avrdude.conf"

It should not be looking there. So I looked in the cache file, and the avrdude.conf file is actually found at: CMakeCache.txt:ARDUINO_AVRDUDE_CONFIG_PATH:FILEPATH=/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf

I was able to track down the issue to the AVRDUDE_ARGS variable. In the generated make file, the command is: src/CMakeFiles/blink-upload: src/blink.elf cd /Users/treaves/Development/qp/blink/builds/unix/src && /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude AVRDUDE_ARGS -C\Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -patmega328p -carduino -b115200 -P/dev/tty.usbmodem1d11 -D -V -Uflash:w:blink.hex

As you can see, the variable name itself is inserted in to the arg list. If I copy this command to the command line, remove the AVRDUDE_ARGS, it runs fine.

treaves commented 12 years ago

The solution is to modify FindArduino.cmake, and edit lines 587 & 636 to be set(AVRDUDE_ARGS) instead of set(AVRDUDE_ARGS ${OUTPUT_VAR})

queezythegreat commented 12 years ago

Nice catch, it should actually be:

set(AVRDUDE_ARGS ${${OUTPUT_VAR}})

I've commited in the changes...