mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Appled Hans Steiner's patch to search for avr=tools in path on Linux (instead of requiring symlinks to the Arduino tools directory). Added an upload.verbose preference for dumping details of the upload process.
This commit is contained in:
parent
3dbf0d32b2
commit
fc1ca8a066
@ -83,10 +83,20 @@ public class Compiler implements MessageConsumer {
|
|||||||
// } catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
// throw new RunnerException(e.getMessage());
|
// throw new RunnerException(e.getMessage());
|
||||||
// }
|
// }
|
||||||
|
String avrBasePath;
|
||||||
|
if(Base.isMacOS()) {
|
||||||
|
avrBasePath = new String("tools/avr/bin/");
|
||||||
|
}
|
||||||
|
else if(Base.isLinux()) {
|
||||||
|
avrBasePath = new String("");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
avrBasePath = new String(userdir + "tools/avr/bin/");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String preCommandCompiler[] = new String[] {
|
String preCommandCompiler[] = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-gcc" :
|
avrBasePath + "avr-gcc",
|
||||||
userdir + "tools/avr/bin/avr-gcc"),
|
|
||||||
"-c", // compile, don't link
|
"-c", // compile, don't link
|
||||||
"-g", // include debugging info (so errors include line numbers)
|
"-g", // include debugging info (so errors include line numbers)
|
||||||
"-Os", // optimize for size
|
"-Os", // optimize for size
|
||||||
@ -111,8 +121,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String preCommandCompilerCPP[] = new String[] {
|
String preCommandCompilerCPP[] = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-g++" :
|
avrBasePath + "avr-g++",
|
||||||
userdir + "tools/avr/bin/avr-g++"),
|
|
||||||
"-c", // compile, don't link
|
"-c", // compile, don't link
|
||||||
"-g", // include debugging info (so errors include line numbers)
|
"-g", // include debugging info (so errors include line numbers)
|
||||||
"-Os", // optimize for size
|
"-Os", // optimize for size
|
||||||
@ -132,8 +141,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String preCommandLinker[] = new String[] {
|
String preCommandLinker[] = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-gcc" :
|
avrBasePath + "avr-gcc",
|
||||||
userdir + "tools/avr/bin/avr-gcc"),
|
|
||||||
" ",
|
" ",
|
||||||
"-mmcu=" + Preferences.get("build.mcu"),
|
"-mmcu=" + Preferences.get("build.mcu"),
|
||||||
"-o",
|
"-o",
|
||||||
@ -162,8 +170,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String baseCommandObjcopy[] = new String[] {
|
String baseCommandObjcopy[] = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-objcopy" :
|
avrBasePath + "avr-objcopy",
|
||||||
userdir + "tools/avr/bin/avr-objcopy"),
|
|
||||||
"-O",
|
"-O",
|
||||||
" ",
|
" ",
|
||||||
"-R",
|
"-R",
|
||||||
|
@ -315,10 +315,20 @@ public class Library implements MessageConsumer{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String userDir = System.getProperty("user.dir") + File.separator;
|
String userdir = System.getProperty("user.dir") + File.separator;
|
||||||
|
String avrBasePath;
|
||||||
|
if(Base.isMacOS()) {
|
||||||
|
avrBasePath = new String("tools/avr/bin/");
|
||||||
|
}
|
||||||
|
else if(Base.isLinux()) {
|
||||||
|
avrBasePath = new String("");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
avrBasePath = new String(userdir + "tools/avr/bin/");
|
||||||
|
}
|
||||||
|
|
||||||
String[] baseCompileCommandC = new String[] {
|
String[] baseCompileCommandC = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-gcc" : userDir + "tools/avr/bin/avr-gcc"),
|
avrBasePath + "avr-gcc",
|
||||||
"-c",
|
"-c",
|
||||||
"-g",
|
"-g",
|
||||||
"-Os",
|
"-Os",
|
||||||
@ -330,7 +340,7 @@ public class Library implements MessageConsumer{
|
|||||||
};
|
};
|
||||||
|
|
||||||
String[] baseCompileCommandCPP = new String[] {
|
String[] baseCompileCommandCPP = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-g++" : userDir + "tools/avr/bin/avr-g++"),
|
avrBasePath + "avr-g++",
|
||||||
"-c",
|
"-c",
|
||||||
"-g",
|
"-g",
|
||||||
"-Os",
|
"-Os",
|
||||||
|
@ -40,9 +40,18 @@ public class Sizer implements MessageConsumer {
|
|||||||
|
|
||||||
public long computeSize() throws RunnerException {
|
public long computeSize() throws RunnerException {
|
||||||
String userdir = System.getProperty("user.dir") + File.separator;
|
String userdir = System.getProperty("user.dir") + File.separator;
|
||||||
|
String avrBasePath;
|
||||||
|
if(Base.isMacOS()) {
|
||||||
|
avrBasePath = new String("tools/avr/bin/");
|
||||||
|
}
|
||||||
|
else if(Base.isLinux()) {
|
||||||
|
avrBasePath = new String("");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
avrBasePath = new String(userdir + "tools/avr/bin/");
|
||||||
|
}
|
||||||
String commandSize[] = new String[] {
|
String commandSize[] = new String[] {
|
||||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-size" :
|
avrBasePath + "avr-size",
|
||||||
userdir + "tools/avr/bin/avr-size"),
|
|
||||||
" "
|
" "
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Uploader - default downloader class that connects to uisp
|
Uploader - default downloader class that connects to uisp
|
||||||
Part of the Arduino project - http://arduino.berlios.de/
|
Part of the Arduino project - http://www.arduino.cc/
|
||||||
|
|
||||||
Copyright (c) 2004-05
|
Copyright (c) 2004-05
|
||||||
Hernando Barragan
|
Hernando Barragan
|
||||||
@ -134,13 +134,23 @@ public class Uploader implements MessageConsumer {
|
|||||||
int result=0; // pre-initialized to quiet a bogus warning from jikes
|
int result=0; // pre-initialized to quiet a bogus warning from jikes
|
||||||
try {
|
try {
|
||||||
List commandDownloader = new ArrayList();
|
List commandDownloader = new ArrayList();
|
||||||
commandDownloader.add((!Base.isMacOS() ? "" : userdir) + "tools/avr/bin/uisp");
|
String avrBasePath;
|
||||||
|
if(Base.isMacOS()) {
|
||||||
|
avrBasePath = new String("tools/avr/bin/");
|
||||||
|
}
|
||||||
|
else if(Base.isLinux()) {
|
||||||
|
avrBasePath = new String("");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
avrBasePath = new String(userdir + "tools/avr/bin/");
|
||||||
|
}
|
||||||
|
commandDownloader.add(avrBasePath + "uisp");
|
||||||
|
//commandDownloader.add((!Base.isMacOS() ? "" : userdir) + "tools/avr/bin/uisp");
|
||||||
|
if (Preferences.getBoolean("upload.verbose"))
|
||||||
|
commandDownloader.add("-v=4");
|
||||||
commandDownloader.add("-dpart=" + Preferences.get("build.mcu"));
|
commandDownloader.add("-dpart=" + Preferences.get("build.mcu"));
|
||||||
commandDownloader.addAll(params);
|
commandDownloader.addAll(params);
|
||||||
//commandDownloader.add("-v=4"); // extra verbosity for help debugging.
|
//commandDownloader.add("-v=4"); // extra verbosity for help debugging.
|
||||||
//for(int i = 0; i < commandDownloader.length; i++) {
|
|
||||||
// System.out.println(commandDownloader[i]);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Cleanup the serial buffer
|
// Cleanup the serial buffer
|
||||||
Serial serialPort = new Serial();
|
Serial serialPort = new Serial();
|
||||||
@ -152,7 +162,14 @@ public class Uploader implements MessageConsumer {
|
|||||||
serialPort.dispose();
|
serialPort.dispose();
|
||||||
|
|
||||||
String[] commandArray = new String[commandDownloader.size()];
|
String[] commandArray = new String[commandDownloader.size()];
|
||||||
Process process = Runtime.getRuntime().exec((String[]) commandDownloader.toArray(commandArray));
|
commandDownloader.toArray(commandArray);
|
||||||
|
if (Preferences.getBoolean("upload.verbose")) {
|
||||||
|
for(int i = 0; i < commandArray.length; i++) {
|
||||||
|
System.out.print(commandArray[i] + " ");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
Process process = Runtime.getRuntime().exec(commandArray);
|
||||||
new MessageSiphon(process.getInputStream(), this);
|
new MessageSiphon(process.getInputStream(), this);
|
||||||
new MessageSiphon(process.getErrorStream(), this);
|
new MessageSiphon(process.getErrorStream(), this);
|
||||||
|
|
||||||
|
@ -268,6 +268,7 @@ linestatus.color = #ffffff
|
|||||||
linestatus.height = 20
|
linestatus.height = 20
|
||||||
|
|
||||||
# set the upload defaults
|
# set the upload defaults
|
||||||
|
upload.verbose=false
|
||||||
upload.erase=false
|
upload.erase=false
|
||||||
upload.verify=false
|
upload.verify=false
|
||||||
upload.programmer=stk500
|
upload.programmer=stk500
|
||||||
|
Loading…
Reference in New Issue
Block a user