mirror of https://github.com/noisymime/Arduino.git
Lock / unlock fuses and hex file now optional for burn bootloader command.
This allows the "burn bootloader" command to be used, for example, to set the fuses on a microcontroller without actually loading a bootloader onto it. http://code.google.com/p/arduino/issues/detail?id=683 http://code.google.com/p/arduino/issues/detail?id=684
This commit is contained in:
parent
ec09ead6ac
commit
b14a3c501e
|
@ -132,6 +132,7 @@ public class AvrdudeUploader extends Uploader {
|
|||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||
List fuses = new ArrayList();
|
||||
fuses.add("-e"); // erase the chip
|
||||
if (boardPreferences.get("bootloader.unlock_bits") != null)
|
||||
fuses.add("-Ulock:w:" + boardPreferences.get("bootloader.unlock_bits") + ":m");
|
||||
if (boardPreferences.get("bootloader.extended_fuses") != null)
|
||||
fuses.add("-Uefuse:w:" + boardPreferences.get("bootloader.extended_fuses") + ":m");
|
||||
|
@ -146,8 +147,10 @@ public class AvrdudeUploader extends Uploader {
|
|||
} catch (InterruptedException e) {}
|
||||
|
||||
Target t;
|
||||
List bootloader = new ArrayList();
|
||||
String bootloaderPath = boardPreferences.get("bootloader.path");
|
||||
|
||||
if (bootloaderPath != null) {
|
||||
if (bootloaderPath.indexOf(':') == -1) {
|
||||
t = Base.getTarget(); // the current target (associated with the board)
|
||||
} else {
|
||||
|
@ -160,12 +163,16 @@ public class AvrdudeUploader extends Uploader {
|
|||
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
|
||||
bootloaderPath = bootloaderFile.getAbsolutePath();
|
||||
|
||||
List bootloader = new ArrayList();
|
||||
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator +
|
||||
boardPreferences.get("bootloader.file") + ":i");
|
||||
}
|
||||
if (boardPreferences.get("bootloader.lock_bits") != null)
|
||||
bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m");
|
||||
|
||||
if (bootloader.size() > 0)
|
||||
return avrdude(params, bootloader);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean avrdude(Collection p1, Collection p2) throws RunnerException {
|
||||
|
|
Loading…
Reference in New Issue