From 03a62f38d27587509cc60a55b81aa1c1bc4b124b Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 10 Jul 2010 21:29:32 +0000 Subject: [PATCH] Allowing third-party hardware platforms to reference programmers defined in other platforms (issue #283). --- .../processing/app/debug/AvrdudeUploader.java | 20 +++++++++++++------ build/shared/revisions.txt | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/processing/app/debug/AvrdudeUploader.java b/app/src/processing/app/debug/AvrdudeUploader.java index 02fdc7837..877d24f73 100755 --- a/app/src/processing/app/debug/AvrdudeUploader.java +++ b/app/src/processing/app/debug/AvrdudeUploader.java @@ -54,8 +54,17 @@ public class AvrdudeUploader extends Uploader { if (uploadUsing.equals("bootloader")) { return uploadViaBootloader(buildPath, className); } else { - // XXX: this needs to handle programmers in other targets. - Collection params = getProgrammerCommands(Base.getTarget().getName(), uploadUsing); + Target t; + + if (uploadUsing.indexOf(':') == -1) { + t = Base.getTarget(); // the current target (associated with the board) + } else { + String targetName = uploadUsing.substring(0, uploadUsing.indexOf(':')); + t = Base.targetsTable.get(targetName); + uploadUsing = uploadUsing.substring(uploadUsing.indexOf(':') + 1); + } + + Collection params = getProgrammerCommands(t, uploadUsing); params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i"); return avrdude(params); } @@ -86,12 +95,11 @@ public class AvrdudeUploader extends Uploader { return avrdude(commandDownloader); } - public boolean burnBootloader(String target, String programmer) throws RunnerException { - return burnBootloader(getProgrammerCommands(target, programmer)); + public boolean burnBootloader(String targetName, String programmer) throws RunnerException { + return burnBootloader(getProgrammerCommands(Base.targetsTable.get(targetName), programmer)); } - private Collection getProgrammerCommands(String targetName, String programmer) { - Target target = Base.targetsTable.get(targetName); + private Collection getProgrammerCommands(Target target, String programmer) { Map programmerPreferences = target.getProgrammers().get(programmer); List params = new ArrayList(); params.add("-c" + programmerPreferences.get("protocol")); diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index f5bb63ba5..778e87427 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -41,6 +41,9 @@ ARDUINO 0019 * Fixed problem with tabs of the same name but different extensions. http://code.google.com/p/arduino/issues/detail?id=191 +* Allowing third-party hardware platforms to reference programmers defined + in other platforms. http://code.google.com/p/arduino/issues/detail?id=283 + ARDUINO 0018 - 2010.01.29 [core / libraries]