From d0352ac988c011039d5c496f1c9c070fa473e36d Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Tue, 26 Jun 2007 23:35:32 +0000 Subject: [PATCH] Now passing config file path to avrdude. --- app/AvrdudeUploader.java | 47 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/app/AvrdudeUploader.java b/app/AvrdudeUploader.java index 6d8537b6e..5ff1c6ffd 100755 --- a/app/AvrdudeUploader.java +++ b/app/AvrdudeUploader.java @@ -118,24 +118,37 @@ public class AvrdudeUploader extends Uploader { } public boolean uisp(Collection params) throws RunnerException { - flushSerialBuffer(); + flushSerialBuffer(); - List commandDownloader = new ArrayList(); - commandDownloader.add("avrdude"); - if (Preferences.getBoolean("upload.verbose")) { - commandDownloader.add("-v"); - commandDownloader.add("-v"); - commandDownloader.add("-v"); - commandDownloader.add("-v"); - } else { - commandDownloader.add("-q"); - commandDownloader.add("-q"); - } - // XXX: quick hack to chop the "atmega" off of "atmega8" and "atmega168", - // then shove an "m" at the beginning. won't work for attiny's, etc. - commandDownloader.add("-pm" + Preferences.get("build.mcu").substring(6)); - commandDownloader.addAll(params); + String userdir = System.getProperty("user.dir") + File.separator; + String avrBasePath; + if(Base.isMacOS()) { + avrBasePath = new String("tools/avr/etc/"); + } + else if(Base.isLinux()) { + avrBasePath = new String(""); + } + else { + avrBasePath = new String(userdir + "tools/avr/etc/"); + } - return executeUploadCommand(commandDownloader); + List commandDownloader = new ArrayList(); + commandDownloader.add("avrdude"); + commandDownloader.add("-C" + avrBasePath + File.separator + "avrdude.conf"); + if (Preferences.getBoolean("upload.verbose")) { + commandDownloader.add("-v"); + commandDownloader.add("-v"); + commandDownloader.add("-v"); + commandDownloader.add("-v"); + } else { + commandDownloader.add("-q"); + commandDownloader.add("-q"); + } + // XXX: quick hack to chop the "atmega" off of "atmega8" and "atmega168", + // then shove an "m" at the beginning. won't work for attiny's, etc. + commandDownloader.add("-pm" + Preferences.get("build.mcu").substring(6)); + commandDownloader.addAll(params); + + return executeUploadCommand(commandDownloader); } }