Enabling / integrating bootloader burning. (Should be tested with a serial AVRISP and a parallel programmer)

This commit is contained in:
David A. Mellis 2009-06-01 19:27:21 +00:00
parent 5f26d058e6
commit e2952cdc77
2 changed files with 30 additions and 6 deletions

View File

@ -883,8 +883,7 @@ public class Editor extends JFrame implements RunnerListener {
this.programmer = programmer;
}
public void actionPerformed(ActionEvent actionevent) {
// XXX: DAM: need to actually burn the bootloader here.
// handleBurnBootloader(programmer);
handleBurnBootloader(programmer);
}
}
@ -1084,7 +1083,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = newJMenuItemShift("Copy for Discourse", 'C');
item = newJMenuItemShift("Copy for Forum", 'C');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// SwingUtilities.invokeLater(new Runnable() {
@ -2207,6 +2206,31 @@ public class Editor extends JFrame implements RunnerListener {
}
protected void handleBurnBootloader(final String programmer) {
console.clear();
statusNotice("Burning bootloader to I/O Board (this may take a minute)...");
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
Uploader uploader = new AvrdudeUploader();
if (uploader.burnBootloader(programmer)) {
statusNotice("Done burning bootloader.");
} else {
statusError("Error while burning bootloader.");
// error message will already be visible
}
} catch (RunnerException e) {
statusError("Error while burning bootloader.");
e.printStackTrace();
//statusError(e);
} catch (Exception e) {
statusError("Error while burning bootloader.");
e.printStackTrace();
}
}});
}
/**
* Handler for File → Page Setup.
*/
@ -2376,7 +2400,7 @@ public class Editor extends JFrame implements RunnerListener {
});
this.add(copyItem);
discourseItem = new JMenuItem("Copy for Discourse");
discourseItem = new JMenuItem("Copy for Forum");
discourseItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleDiscourseCopy();

View File

@ -126,7 +126,7 @@ public class AvrdudeUploader extends Uploader {
} catch (InterruptedException e) {}
List bootloader = new ArrayList();
bootloader.add("-Uflash:w:" + "hardware" + File.separator + "bootloaders" + File.separator +
bootloader.add("-Uflash:w:" + Base.getHardwarePath() + File.separator + "bootloaders" + File.separator +
Preferences.get("boards." + Preferences.get("board") + ".bootloader.path") +
File.separator + Preferences.get("boards." + Preferences.get("board") + ".bootloader.file") + ":i");
bootloader.add("-Ulock:w:" + Preferences.get("boards." + Preferences.get("board") + ".bootloader.lock_bits") + ":m");
@ -148,7 +148,7 @@ public class AvrdudeUploader extends Uploader {
if (Base.isLinux()) {
// ???: is it better to have Linux users install avrdude themselves, in
// a way that it can find its own configuration file?
commandDownloader.add("-C" + "hardware/tools/avrdude.conf");
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
} else {
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
}