mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
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,7 +132,8 @@ public class AvrdudeUploader extends Uploader {
|
||||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||
List fuses = new ArrayList();
|
||||
fuses.add("-e"); // erase the chip
|
||||
fuses.add("-Ulock:w:" + boardPreferences.get("bootloader.unlock_bits") + ":m");
|
||||
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");
|
||||
fuses.add("-Uhfuse:w:" + boardPreferences.get("bootloader.high_fuses") + ":m");
|
||||
@ -146,26 +147,32 @@ public class AvrdudeUploader extends Uploader {
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
Target t;
|
||||
List bootloader = new ArrayList();
|
||||
String bootloaderPath = boardPreferences.get("bootloader.path");
|
||||
|
||||
if (bootloaderPath.indexOf(':') == -1) {
|
||||
t = Base.getTarget(); // the current target (associated with the board)
|
||||
} else {
|
||||
String targetName = bootloaderPath.substring(0, bootloaderPath.indexOf(':'));
|
||||
t = Base.targetsTable.get(targetName);
|
||||
bootloaderPath = bootloaderPath.substring(bootloaderPath.indexOf(':') + 1);
|
||||
if (bootloaderPath != null) {
|
||||
if (bootloaderPath.indexOf(':') == -1) {
|
||||
t = Base.getTarget(); // the current target (associated with the board)
|
||||
} else {
|
||||
String targetName = bootloaderPath.substring(0, bootloaderPath.indexOf(':'));
|
||||
t = Base.targetsTable.get(targetName);
|
||||
bootloaderPath = bootloaderPath.substring(bootloaderPath.indexOf(':') + 1);
|
||||
}
|
||||
|
||||
File bootloadersFile = new File(t.getFolder(), "bootloaders");
|
||||
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
|
||||
bootloaderPath = bootloaderFile.getAbsolutePath();
|
||||
|
||||
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator +
|
||||
boardPreferences.get("bootloader.file") + ":i");
|
||||
}
|
||||
|
||||
File bootloadersFile = new File(t.getFolder(), "bootloaders");
|
||||
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");
|
||||
bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m");
|
||||
if (boardPreferences.get("bootloader.lock_bits") != null)
|
||||
bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m");
|
||||
|
||||
return avrdude(params, bootloader);
|
||||
if (bootloader.size() > 0)
|
||||
return avrdude(params, bootloader);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean avrdude(Collection p1, Collection p2) throws RunnerException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user