mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Allowing third-party hardware platforms to reference programmers defined in other platforms (issue #283).
This commit is contained in:
parent
52e0e1a999
commit
03a62f38d2
@ -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<String, String> programmerPreferences = target.getProgrammers().get(programmer);
|
||||
List params = new ArrayList();
|
||||
params.add("-c" + programmerPreferences.get("protocol"));
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user