mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-01 23:29:28 +01:00
This commit is contained in:
parent
c6704296c1
commit
4061d17578
@ -1805,7 +1805,7 @@ public class Editor extends JFrame
|
|||||||
//boolean success = sketch.isLibrary() ?
|
//boolean success = sketch.isLibrary() ?
|
||||||
//sketch.exportLibrary() : sketch.exportApplet();
|
//sketch.exportLibrary() : sketch.exportApplet();
|
||||||
Uploader uploader = new Uploader();
|
Uploader uploader = new Uploader();
|
||||||
boolean success = uploader.burnBootloader();
|
boolean success = uploader.burnBootloaderAVRISP();
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
message("Done burning bootloader.");
|
message("Done burning bootloader.");
|
||||||
|
@ -78,32 +78,7 @@ public class Uploader implements MessageConsumer {
|
|||||||
return uisp(commandDownloader);
|
return uisp(commandDownloader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean burnBootloader() throws RunnerException {
|
public boolean burnBootloaderAVRISP() throws RunnerException {
|
||||||
// I know this is ugly; apologies - that's what happens when you try to
|
|
||||||
// write Lisp-style code in Java.
|
|
||||||
|
|
||||||
// Some of these values should be specified in preferences.txt.
|
|
||||||
return
|
|
||||||
// unlock bootloader segment of flash memory
|
|
||||||
uploadUsingAVRISP(Arrays.asList(new String[] {
|
|
||||||
"--wr_lock=" + Preferences.get("bootloader.unlock_bits") })) &&
|
|
||||||
// write fuses:
|
|
||||||
// bootloader size of 512 words; from 0xE00-0xFFF
|
|
||||||
// clock speed of 16 MHz, external quartz
|
|
||||||
uploadUsingAVRISP(Arrays.asList(new String[] {
|
|
||||||
"--wr_fuse_l=" + Preferences.get("bootloader.low_fuses"),
|
|
||||||
"--wr_fuse_h=" + Preferences.get("bootloader.high_fuses") })) &&
|
|
||||||
// upload bootloader
|
|
||||||
uploadUsingAVRISP(Arrays.asList(new String[] {
|
|
||||||
"--erase", "--upload", "--verify",
|
|
||||||
"if=" + Preferences.get("bootloader.path") + File.separator +
|
|
||||||
Preferences.get("bootloader.file") })) &&
|
|
||||||
// lock bootloader segment
|
|
||||||
uploadUsingAVRISP(Arrays.asList(new String[] {
|
|
||||||
"--wr_lock=" + Preferences.get("bootloader.lock_bits") }));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean uploadUsingAVRISP(Collection params) throws RunnerException {
|
|
||||||
List commandDownloader = new ArrayList();
|
List commandDownloader = new ArrayList();
|
||||||
commandDownloader.add("-dprog=" + Preferences.get("bootloader.programmer"));
|
commandDownloader.add("-dprog=" + Preferences.get("bootloader.programmer"));
|
||||||
commandDownloader.add(
|
commandDownloader.add(
|
||||||
@ -111,12 +86,43 @@ public class Uploader implements MessageConsumer {
|
|||||||
"/dev/" + Preferences.get("serial.port").toLowerCase() :
|
"/dev/" + Preferences.get("serial.port").toLowerCase() :
|
||||||
Preferences.get("serial.port")));
|
Preferences.get("serial.port")));
|
||||||
commandDownloader.add("-dspeed=" + Preferences.get("serial.burn_rate"));
|
commandDownloader.add("-dspeed=" + Preferences.get("serial.burn_rate"));
|
||||||
commandDownloader.addAll(params);
|
return burnBootloader(commandDownloader);
|
||||||
//commandDownloader.add("--erase");
|
}
|
||||||
//commandDownloader.add("--upload");
|
|
||||||
//commandDownloader.add("--verify");
|
public boolean burnBootloaderParallel() throws RunnerException {
|
||||||
//commandDownloader.add("if=" + buildPath + File.separator + className + ".hex");
|
List commandDownloader = new ArrayList();
|
||||||
return uisp(commandDownloader);
|
commandDownloader.add("-dprog=dapa");
|
||||||
|
commandDownloader.add("-dlpt=" + Preferences.get("parallel.port"));
|
||||||
|
return burnBootloader(commandDownloader);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean burnBootloader(Collection params) throws RunnerException {
|
||||||
|
// I know this is ugly; apologies - that's what happens when you try to
|
||||||
|
// write Lisp-style code in Java.
|
||||||
|
return
|
||||||
|
// unlock bootloader segment of flash memory
|
||||||
|
uisp(params, Arrays.asList(new String[] {
|
||||||
|
"--wr_lock=" + Preferences.get("bootloader.unlock_bits") })) &&
|
||||||
|
// write fuses:
|
||||||
|
// bootloader size of 512 words; from 0xE00-0xFFF
|
||||||
|
// clock speed of 16 MHz, external quartz
|
||||||
|
uisp(params, Arrays.asList(new String[] {
|
||||||
|
"--wr_fuse_l=" + Preferences.get("bootloader.low_fuses"),
|
||||||
|
"--wr_fuse_h=" + Preferences.get("bootloader.high_fuses") })) &&
|
||||||
|
// upload bootloader
|
||||||
|
uisp(params, Arrays.asList(new String[] {
|
||||||
|
"--erase", "--upload", "--verify",
|
||||||
|
"if=" + Preferences.get("bootloader.path") + File.separator +
|
||||||
|
Preferences.get("bootloader.file") })) &&
|
||||||
|
// lock bootloader segment
|
||||||
|
uisp(params, Arrays.asList(new String[] {
|
||||||
|
"--wr_lock=" + Preferences.get("bootloader.lock_bits") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean uisp(Collection p1, Collection p2) throws RunnerException {
|
||||||
|
ArrayList p = new ArrayList(p1);
|
||||||
|
p.addAll(p2);
|
||||||
|
return uisp(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean uisp(Collection params) throws RunnerException {
|
public boolean uisp(Collection params) throws RunnerException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user