1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Allowing third-party hardware platforms to reference programmers defined in other platforms (issue #283).

This commit is contained in:
David A. Mellis 2010-07-10 21:29:32 +00:00
parent 52e0e1a999
commit 03a62f38d2
2 changed files with 17 additions and 6 deletions

View File

@ -54,8 +54,17 @@ public class AvrdudeUploader extends Uploader {
if (uploadUsing.equals("bootloader")) { if (uploadUsing.equals("bootloader")) {
return uploadViaBootloader(buildPath, className); return uploadViaBootloader(buildPath, className);
} else { } else {
// XXX: this needs to handle programmers in other targets. Target t;
Collection params = getProgrammerCommands(Base.getTarget().getName(), uploadUsing);
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"); params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i");
return avrdude(params); return avrdude(params);
} }
@ -86,12 +95,11 @@ public class AvrdudeUploader extends Uploader {
return avrdude(commandDownloader); return avrdude(commandDownloader);
} }
public boolean burnBootloader(String target, String programmer) throws RunnerException { public boolean burnBootloader(String targetName, String programmer) throws RunnerException {
return burnBootloader(getProgrammerCommands(target, programmer)); return burnBootloader(getProgrammerCommands(Base.targetsTable.get(targetName), programmer));
} }
private Collection getProgrammerCommands(String targetName, String programmer) { private Collection getProgrammerCommands(Target target, String programmer) {
Target target = Base.targetsTable.get(targetName);
Map<String, String> programmerPreferences = target.getProgrammers().get(programmer); Map<String, String> programmerPreferences = target.getProgrammers().get(programmer);
List params = new ArrayList(); List params = new ArrayList();
params.add("-c" + programmerPreferences.get("protocol")); params.add("-c" + programmerPreferences.get("protocol"));

View File

@ -41,6 +41,9 @@ ARDUINO 0019
* Fixed problem with tabs of the same name but different extensions. * Fixed problem with tabs of the same name but different extensions.
http://code.google.com/p/arduino/issues/detail?id=191 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 ARDUINO 0018 - 2010.01.29
[core / libraries] [core / libraries]