mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Got bootloader burning working.
Wrapped some long lines.
This commit is contained in:
parent
e5b5f25476
commit
8720addcba
@ -45,7 +45,8 @@ public class AvrdudeUploader extends Uploader {
|
||||
public boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
|
||||
throws RunnerException {
|
||||
this.verbose = verbose;
|
||||
String uploadUsing = Preferences.get("boards." + Preferences.get("board") + ".upload.using");
|
||||
String uploadUsing =
|
||||
Preferences.get("boards." + Preferences.get("board") + ".upload.using");
|
||||
if (uploadUsing == null) {
|
||||
// fall back on global preference
|
||||
uploadUsing = Preferences.get("upload.using");
|
||||
@ -62,19 +63,21 @@ public class AvrdudeUploader extends Uploader {
|
||||
private boolean uploadViaBootloader(String buildPath, String className)
|
||||
throws RunnerException {
|
||||
List commandDownloader = new ArrayList();
|
||||
String protocol = Preferences.get("boards." + Preferences.get("board") + ".upload.protocol");
|
||||
String protocol =
|
||||
Preferences.get("boards." + Preferences.get("board") + ".upload.protocol");
|
||||
|
||||
// avrdude wants "stk500v1" to distinguish it from stk500v2
|
||||
if (protocol.equals("stk500"))
|
||||
protocol = "stk500v1";
|
||||
commandDownloader.add("-c" + protocol);
|
||||
commandDownloader.add("-P" + (Base.isWindows() ? "\\\\.\\" : "") + Preferences.get("serial.port"));
|
||||
commandDownloader.add(
|
||||
"-P" + (Base.isWindows() ? "\\\\.\\" : "") + Preferences.get("serial.port"));
|
||||
commandDownloader.add(
|
||||
"-b" + Preferences.getInteger("boards." + Preferences.get("board") + ".upload.speed"));
|
||||
commandDownloader.add("-D"); // don't erase
|
||||
commandDownloader.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i");
|
||||
|
||||
if (Preferences.get("boards." + Preferences.get("board") + ".upload.disable_flushing") == null ||
|
||||
if (Preferences.get("boards", "board", "upload.disable_flushing") == null ||
|
||||
Preferences.getBoolean("boards." + Preferences.get("board") + ".upload.disable_flushing") == false) {
|
||||
flushSerialBuffer();
|
||||
}
|
||||
@ -115,11 +118,11 @@ public class AvrdudeUploader extends Uploader {
|
||||
throws RunnerException {
|
||||
List fuses = new ArrayList();
|
||||
fuses.add("-e"); // erase the chip
|
||||
fuses.add("-Ulock:w:" + Preferences.get("boards." + Preferences.get("board") + ".bootloader.unlock_bits") + ":m");
|
||||
if (Preferences.get("boards." + Preferences.get("board") + ".bootloader.extended_fuses") != null)
|
||||
fuses.add("-Uefuse:w:" + Preferences.get("boards." + Preferences.get("board") + ".bootloader.extended_fuses") + ":m");
|
||||
fuses.add("-Uhfuse:w:" + Preferences.get("boards." + Preferences.get("board") + ".bootloader.high_fuses") + ":m");
|
||||
fuses.add("-Ulfuse:w:" + Preferences.get("boards." + Preferences.get("board") + ".bootloader.low_fuses") + ":m");
|
||||
fuses.add("-Ulock:w:" + Preferences.get("boards", "board", "bootloader.unlock_bits") + ":m");
|
||||
if (Preferences.get("boards", "board", "bootloader.extended_fuses") != null)
|
||||
fuses.add("-Uefuse:w:" + Preferences.get("boards", "board", "bootloader.extended_fuses") + ":m");
|
||||
fuses.add("-Uhfuse:w:" + Preferences.get("boards", "board", "bootloader.high_fuses") + ":m");
|
||||
fuses.add("-Ulfuse:w:" + Preferences.get("boards", "board", "bootloader.low_fuses") + ":m");
|
||||
|
||||
if (!avrdude(params, fuses))
|
||||
return false;
|
||||
@ -128,11 +131,15 @@ public class AvrdudeUploader extends Uploader {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
String platform = Preferences.get("boards", "board", "build.core");
|
||||
File platformFile = Base.platformsTable.get(platform);
|
||||
String bootloadersPath = new File(platformFile, "bootloaders").getAbsolutePath();
|
||||
|
||||
List bootloader = new ArrayList();
|
||||
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");
|
||||
bootloader.add("-Uflash:w:" + bootloadersPath + File.separator +
|
||||
Preferences.get("boards", "board", "bootloader.path") + File.separator +
|
||||
Preferences.get("boards", "board", "bootloader.file") + ":i");
|
||||
bootloader.add("-Ulock:w:" + Preferences.get("boards", "board", "bootloader.lock_bits") + ":m");
|
||||
|
||||
return avrdude(params, bootloader);
|
||||
}
|
||||
@ -165,7 +172,7 @@ public class AvrdudeUploader extends Uploader {
|
||||
commandDownloader.add("-q");
|
||||
commandDownloader.add("-q");
|
||||
}
|
||||
commandDownloader.add("-p" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"));
|
||||
commandDownloader.add("-p" + Preferences.get("boards", "board", "build.mcu"));
|
||||
commandDownloader.addAll(params);
|
||||
|
||||
return executeUploadCommand(commandDownloader);
|
||||
|
@ -36,7 +36,7 @@ import java.util.zip.*;
|
||||
|
||||
public class Compiler implements MessageConsumer {
|
||||
static final String BUGS_URL =
|
||||
"https://developer.berlios.de/bugs/?group_id=3590";
|
||||
"http://code.google.com/p/arduino/issues/list";
|
||||
static final String SUPER_BADNESS =
|
||||
"Compiler error, please submit this code to " + BUGS_URL;
|
||||
|
||||
@ -112,9 +112,10 @@ public class Compiler implements MessageConsumer {
|
||||
|
||||
for (File libraryFolder : sketch.getImportedLibraries()) {
|
||||
File outputFolder = new File(buildPath, libraryFolder.getName());
|
||||
File utilityFolder = new File(libraryFolder, "utility");
|
||||
createFolder(outputFolder);
|
||||
// this library can use includes in its utility/ folder
|
||||
includePaths.add(libraryFolder.getPath() + File.separator + "utility");
|
||||
includePaths.add(utilityFolder.getAbsolutePath());
|
||||
objectFiles.addAll(
|
||||
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||
findFilesInFolder(libraryFolder, "S", false),
|
||||
@ -124,9 +125,9 @@ public class Compiler implements MessageConsumer {
|
||||
createFolder(outputFolder);
|
||||
objectFiles.addAll(
|
||||
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||
findFilesInFolder(new File(libraryFolder, "utility"), "S", false),
|
||||
findFilesInFolder(new File(libraryFolder, "utility"), "c", false),
|
||||
findFilesInFolder(new File(libraryFolder, "utility"), "cpp", false)));
|
||||
findFilesInFolder(utilityFolder, "S", false),
|
||||
findFilesInFolder(utilityFolder, "c", false),
|
||||
findFilesInFolder(utilityFolder, "cpp", false)));
|
||||
// other libraries should not see this library's utility/ folder
|
||||
includePaths.remove(includePaths.size() - 1);
|
||||
}
|
||||
@ -145,7 +146,7 @@ public class Compiler implements MessageConsumer {
|
||||
avrBasePath + "avr-gcc",
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"),
|
||||
"-mmcu=" + Preferences.get("boards", "board", "build.mcu"),
|
||||
"-o",
|
||||
buildPath + File.separator + primaryClassName + ".elf"
|
||||
}));
|
||||
@ -321,7 +322,9 @@ public class Compiler implements MessageConsumer {
|
||||
// attemping to compare
|
||||
//
|
||||
//String buildPathSubst = buildPath.replace(File.separatorChar, '/') + "/";
|
||||
String buildPathSubst = buildPath.replace(File.separatorChar,File.separatorChar) + File.separatorChar;
|
||||
String buildPathSubst =
|
||||
buildPath.replace(File.separatorChar,File.separatorChar) +
|
||||
File.separatorChar;
|
||||
|
||||
String partialTempPath = null;
|
||||
int partialStartIndex = -1; //s.indexOf(partialTempPath);
|
||||
@ -451,8 +454,8 @@ public class Compiler implements MessageConsumer {
|
||||
"-c", // compile, don't link
|
||||
"-g", // include debugging info (so errors include line numbers)
|
||||
"-assembler-with-cpp",
|
||||
"-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"),
|
||||
"-mmcu=" + Preferences.get("boards", "board", "build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards", "board", "build.f_cpu"),
|
||||
"-DARDUINO=" + Base.REVISION,
|
||||
}));
|
||||
|
||||
@ -478,8 +481,8 @@ public class Compiler implements MessageConsumer {
|
||||
"-w", // surpress all warnings
|
||||
"-ffunction-sections", // place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"),
|
||||
"-mmcu=" + Preferences.get("boards", "board", "build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards", "board", "build.f_cpu"),
|
||||
"-DARDUINO=" + Base.REVISION,
|
||||
}));
|
||||
|
||||
@ -506,8 +509,8 @@ public class Compiler implements MessageConsumer {
|
||||
"-fno-exceptions",
|
||||
"-ffunction-sections", // place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"),
|
||||
"-mmcu=" + Preferences.get("boards", "board", "build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("boards", "board", "build.f_cpu"),
|
||||
"-DARDUINO=" + Base.REVISION,
|
||||
}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user