mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Merge remote branch 'ricklon/platforms' into platforms
This commit is contained in:
@ -80,10 +80,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
this.buildPath = buildPath;
|
this.buildPath = buildPath;
|
||||||
this.primaryClassName = primaryClassName;
|
this.primaryClassName = primaryClassName;
|
||||||
this.verbose = verbose;
|
this.verbose = verbose;
|
||||||
|
objectFiles = new ArrayList<File>();
|
||||||
|
|
||||||
// the pms object isn't used for anything but storage
|
// the pms object isn't used for anything but storage
|
||||||
MessageStream pms = new MessageStream(this);
|
MessageStream pms = new MessageStream(this);
|
||||||
|
|
||||||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||||
|
|
||||||
//Check for null platform, and use system default if not found
|
//Check for null platform, and use system default if not found
|
||||||
@ -97,16 +97,19 @@ public class Compiler implements MessageConsumer {
|
|||||||
platformPreferences = new HashMap(Base.getPlatformPreferences(platform));
|
platformPreferences = new HashMap(Base.getPlatformPreferences(platform));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("////////////////////////////compiler.java is doing stuff/////////////////");
|
||||||
//Put all the global preference configuration into one Master configpreferences
|
//Put all the global preference configuration into one Master configpreferences
|
||||||
configPreferences = mergePreferences( Preferences.getMap(), platformPreferences, boardPreferences);
|
configPreferences = mergePreferences( Preferences.getMap(), platformPreferences, boardPreferences);
|
||||||
avrBasePath = configPreferences.get("compiler.path");
|
avrBasePath = configPreferences.get("compiler.path");
|
||||||
if (avrBasePath == null)
|
if (avrBasePath == null)
|
||||||
{
|
{
|
||||||
avrBasePath = Base.getAvrBasePath();
|
avrBasePath = Base.getAvrBasePath();
|
||||||
|
System.out.println("avrBasePath: " + avrBasePath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
System.out.println("avrBasePath:exists: " + avrBasePath);
|
||||||
|
|
||||||
//Put in the system path in the compiler path if available
|
//Put in the system path in the compiler path if available
|
||||||
MessageFormat compileFormat = new MessageFormat(avrBasePath);
|
MessageFormat compileFormat = new MessageFormat(avrBasePath);
|
||||||
String basePath = System.getProperty("user.dir");
|
String basePath = System.getProperty("user.dir");
|
||||||
@ -116,6 +119,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
Object[] Args = {basePath};
|
Object[] Args = {basePath};
|
||||||
avrBasePath = compileFormat.format( Args );
|
avrBasePath = compileFormat.format( Args );
|
||||||
|
System.out.println("avrBasePath:new: " + avrBasePath);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.board = configPreferences.get("board");
|
this.board = configPreferences.get("board");
|
||||||
@ -159,7 +164,6 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objectFiles = new ArrayList<File>();
|
|
||||||
|
|
||||||
// 0. include paths for core + all libraries
|
// 0. include paths for core + all libraries
|
||||||
|
|
||||||
@ -171,17 +175,17 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. compile the sketch (already in the buildPath)
|
// 1. compile the sketch (already in the buildPath)
|
||||||
|
System.out.println("1. compileSketch");
|
||||||
compileSketch(avrBasePath, buildPath, includePaths, configPreferences);
|
compileSketch(avrBasePath, buildPath, includePaths, configPreferences);
|
||||||
/*
|
|
||||||
objectFiles.addAll(
|
|
||||||
compileFiles(avrBasePath, buildPath, includePaths,
|
|
||||||
findFilesInPath(buildPath, "S", false),
|
|
||||||
findFilesInPath(buildPath, "c", false),
|
|
||||||
findFilesInPath(buildPath, "cpp", false),
|
|
||||||
boardPreferences));
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 2. compile the libraries, outputting .o files to: <buildPath>/<library>/
|
// 2. compile the libraries, outputting .o files to: <buildPath>/<library>/
|
||||||
|
// 2. compile the libraries, outputting .o files to:
|
||||||
|
// <buildPath>/<library>/
|
||||||
|
//Doesn't really use configPreferences
|
||||||
|
System.out.println("2. compileLibraries");
|
||||||
|
compileLibraries(avrBasePath, buildPath, includePaths, configPreferences);
|
||||||
|
/*
|
||||||
|
|
||||||
for (File libraryFolder : sketch.getImportedLibraries()) {
|
for (File libraryFolder : sketch.getImportedLibraries()) {
|
||||||
File outputFolder = new File(buildPath, libraryFolder.getName());
|
File outputFolder = new File(buildPath, libraryFolder.getName());
|
||||||
@ -206,9 +210,15 @@ public class Compiler implements MessageConsumer {
|
|||||||
// other libraries should not see this library's utility/ folder
|
// other libraries should not see this library's utility/ folder
|
||||||
includePaths.remove(includePaths.size() - 1);
|
includePaths.remove(includePaths.size() - 1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// 3. compile the core, outputting .o files to <buildPath> and then
|
// 3. compile the core, outputting .o files to <buildPath> and then
|
||||||
// collecting them into the core.a library file.
|
// collecting them into the core.a library file.
|
||||||
|
System.out.println("3. compileCore");
|
||||||
|
System.out.println("corePath: " + corePath);
|
||||||
|
compileCore(avrBasePath, buildPath, corePath, pins, pinsPath, configPreferences);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
includePaths.clear();
|
includePaths.clear();
|
||||||
includePaths.add(corePath); // include path for core only
|
includePaths.add(corePath); // include path for core only
|
||||||
@ -233,6 +243,9 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// 4. link it all together into the .elf file
|
// 4. link it all together into the .elf file
|
||||||
|
System.out.println("4. compileLink");
|
||||||
|
compileLink(avrBasePath, buildPath, corePath, includePaths, configPreferences);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
|
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
|
||||||
avrBasePath + "avr-gcc",
|
avrBasePath + "avr-gcc",
|
||||||
@ -263,76 +276,14 @@ public class Compiler implements MessageConsumer {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
|
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
|
||||||
/*
|
System.out.println("5. compileEep");
|
||||||
commandObjcopy = new ArrayList(baseCommandObjcopy);
|
|
||||||
commandObjcopy.add(2, "ihex");
|
|
||||||
commandObjcopy.set(3, "-j");
|
|
||||||
commandObjcopy.add(".eeprom");
|
|
||||||
commandObjcopy.add("--set-section-flags=.eeprom=alloc,load");
|
|
||||||
commandObjcopy.add("--no-change-warnings");
|
|
||||||
commandObjcopy.add("--change-section-lma");
|
|
||||||
commandObjcopy.add(".eeprom=0");
|
|
||||||
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf");
|
|
||||||
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".eep");
|
|
||||||
execAsynchronously(commandObjcopy);
|
|
||||||
|
|
||||||
// 6. build the .hex file
|
|
||||||
commandObjcopy = new ArrayList(baseCommandObjcopy);
|
|
||||||
commandObjcopy.add(2, "ihex");
|
|
||||||
commandObjcopy.add(".eeprom"); // remove eeprom data
|
|
||||||
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf");
|
|
||||||
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex");
|
|
||||||
execAsynchronously(commandObjcopy);
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
|
||||||
/*
|
|
||||||
|
|
||||||
logger.debug("corePaths: " + this.corePath);
|
|
||||||
|
|
||||||
|
|
||||||
this.objectFiles = new ArrayList<File>();
|
|
||||||
|
|
||||||
// 0. include paths for core + all libraries
|
|
||||||
logger.debug("0. getIncludes");
|
|
||||||
this.includePaths = getIncludes(this.corePath);
|
|
||||||
|
|
||||||
// 1. compile the sketch (already in the buildPath)
|
|
||||||
logger.debug("1. compileSketch");
|
|
||||||
compileSketch(avrBasePath, buildPath, includePaths, configPreferences);
|
|
||||||
|
|
||||||
// 2. compile the libraries, outputting .o files to:
|
|
||||||
// <buildPath>/<library>/
|
|
||||||
//Doesn't really use configPreferences
|
|
||||||
logger.debug("2. compileLibraries");
|
|
||||||
compileLibraries(avrBasePath, buildPath, includePaths, configPreferences);
|
|
||||||
|
|
||||||
// 3. compile the core, outputting .o files to <buildPath> and then
|
|
||||||
// collecting them into the core.a library file.
|
|
||||||
logger.debug("3. compileCore");
|
|
||||||
compileCore(avrBasePath, buildPath, this.corePath, configPreferences);
|
|
||||||
|
|
||||||
// 4. link it all together into the .elf file
|
|
||||||
logger.debug("4. compileLink");
|
|
||||||
compileLink(avrBasePath, buildPath, this.corePath, includePaths, configPreferences);
|
|
||||||
|
|
||||||
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
|
|
||||||
logger.debug("5. compileEep");
|
|
||||||
compileEep(avrBasePath, buildPath, includePaths, configPreferences);
|
compileEep(avrBasePath, buildPath, includePaths, configPreferences);
|
||||||
|
|
||||||
// 6. build the .hex file
|
// 6. build the .hex file
|
||||||
logger.debug("6. compileHex");
|
System.out.println("6. compileHex");
|
||||||
compileHex(avrBasePath, buildPath, includePaths, configPreferences);
|
compileHex(avrBasePath, buildPath, includePaths, configPreferences);
|
||||||
|
|
||||||
//done
|
|
||||||
logger.debug("7. compile done");
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -383,8 +334,17 @@ public class Compiler implements MessageConsumer {
|
|||||||
* Either succeeds or throws a RunnerException fit for public consumption.
|
* Either succeeds or throws a RunnerException fit for public consumption.
|
||||||
*/
|
*/
|
||||||
private void execAsynchronously(String[] command) throws RunnerException {
|
private void execAsynchronously(String[] command) throws RunnerException {
|
||||||
// String[] command = new String[commandList.size()];
|
|
||||||
//commandList.toArray(command);
|
//eliminate any empty array entries
|
||||||
|
List<String> stringList = new ArrayList<String>();
|
||||||
|
for(String string : command) {
|
||||||
|
string = string.trim();
|
||||||
|
if(string != null && string.length() > 0) {
|
||||||
|
stringList.add(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
command = stringList.toArray(new String[stringList.size()]);
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
if (verbose || Preferences.getBoolean("build.verbose")) {
|
if (verbose || Preferences.getBoolean("build.verbose")) {
|
||||||
@ -443,6 +403,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
re.hideStackTrace();
|
re.hideStackTrace();
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
System.out.println("execAsync: Done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -549,7 +510,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
configPreferences.get("compiler.cpudef"),
|
configPreferences.get("compiler.cpudef"),
|
||||||
configPreferences.get("build.mcu"),
|
configPreferences.get("build.mcu"),
|
||||||
configPreferences.get("build.f_cpu"),
|
configPreferences.get("build.f_cpu"),
|
||||||
configPreferences.get("board"),
|
configPreferences.get("software"),
|
||||||
Base.REVISION,
|
Base.REVISION,
|
||||||
includes,
|
includes,
|
||||||
sourceName,
|
sourceName,
|
||||||
@ -557,7 +518,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
String command = compileFormat.format( Args );
|
String command = compileFormat.format( Args );
|
||||||
String[] commandArray = command.split(",");
|
String[] commandArray = command.split("\\|");
|
||||||
return commandArray;
|
return commandArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,7 +569,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
configPreferences.get("compiler.cpudef"),
|
configPreferences.get("compiler.cpudef"),
|
||||||
configPreferences.get("build.mcu"),
|
configPreferences.get("build.mcu"),
|
||||||
configPreferences.get("build.f_cpu"),
|
configPreferences.get("build.f_cpu"),
|
||||||
configPreferences.get("board"),
|
configPreferences.get("software"),
|
||||||
Base.REVISION,
|
Base.REVISION,
|
||||||
includes,
|
includes,
|
||||||
sourceName,
|
sourceName,
|
||||||
@ -616,7 +577,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
String command = compileFormat.format( Args );
|
String command = compileFormat.format( Args );
|
||||||
String[] commandArray = command.split(",");
|
String[] commandArray = command.split("\\|");
|
||||||
return commandArray;
|
return commandArray;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -667,7 +628,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
configPreferences.get("compiler.cpudef"),
|
configPreferences.get("compiler.cpudef"),
|
||||||
configPreferences.get("build.mcu"),
|
configPreferences.get("build.mcu"),
|
||||||
configPreferences.get("build.f_cpu"),
|
configPreferences.get("build.f_cpu"),
|
||||||
configPreferences.get("board"),
|
configPreferences.get("software"),
|
||||||
Base.REVISION,
|
Base.REVISION,
|
||||||
includes,
|
includes,
|
||||||
sourceName,
|
sourceName,
|
||||||
@ -675,8 +636,15 @@ public class Compiler implements MessageConsumer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
String command = compileFormat.format( Args );
|
String command = compileFormat.format( Args );
|
||||||
|
String[] commandArray = command.split("\\|");
|
||||||
|
|
||||||
|
/*
|
||||||
System.out.println("command:" + command);
|
System.out.println("command:" + command);
|
||||||
String[] commandArray = command.split(",");
|
for (int ii = 0; ii < commandArray.length; ii++)
|
||||||
|
{
|
||||||
|
System.out.println("'" + commandArray[ii] + "'");
|
||||||
|
}
|
||||||
|
*/
|
||||||
return commandArray;
|
return commandArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,6 +674,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
|
|
||||||
static public ArrayList<File> findFilesInPath(String path, String extension,
|
static public ArrayList<File> findFilesInPath(String path, String extension,
|
||||||
boolean recurse) {
|
boolean recurse) {
|
||||||
|
System.out.println("findFilesInPath: " + path);
|
||||||
return findFilesInFolder(new File(path), extension, recurse);
|
return findFilesInFolder(new File(path), extension, recurse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,6 +703,12 @@ public class Compiler implements MessageConsumer {
|
|||||||
void compileSketch(String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
void compileSketch(String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
||||||
throws RunnerException
|
throws RunnerException
|
||||||
{
|
{
|
||||||
|
System.out.println("compileSketch: start");
|
||||||
|
System.out.println("includePaths: ");
|
||||||
|
for (int i = 0; i < includePaths.size(); i++) {
|
||||||
|
System.out.println("-I" + (String) includePaths.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
//logger.debug("compileSketch: start");
|
//logger.debug("compileSketch: start");
|
||||||
this.objectFiles.addAll(compileFiles(avrBasePath, buildPath, includePaths,
|
this.objectFiles.addAll(compileFiles(avrBasePath, buildPath, includePaths,
|
||||||
findFilesInPath(buildPath, "S", false),
|
findFilesInPath(buildPath, "S", false),
|
||||||
@ -747,46 +722,62 @@ public class Compiler implements MessageConsumer {
|
|||||||
void compileLibraries (String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
void compileLibraries (String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
||||||
throws RunnerException
|
throws RunnerException
|
||||||
{
|
{
|
||||||
//logger.debug("compileLibraries: start");
|
System.out.println("compileLibraries: start");
|
||||||
for (File libraryFolder : sketch.getImportedLibraries())
|
|
||||||
{
|
for (File libraryFolder : sketch.getImportedLibraries()) {
|
||||||
|
System.out.println("libraryFolder: " + libraryFolder);
|
||||||
File outputFolder = new File(buildPath, libraryFolder.getName());
|
File outputFolder = new File(buildPath, libraryFolder.getName());
|
||||||
File utilityFolder = new File(libraryFolder, "utility");
|
File utilityFolder = new File(libraryFolder, "utility");
|
||||||
createFolder(outputFolder);
|
createFolder(outputFolder);
|
||||||
// this library can use includes in its utility/ folder
|
// this library can use includes in its utility/ folder
|
||||||
this.includePaths.add(utilityFolder.getAbsolutePath());
|
includePaths.add(utilityFolder.getAbsolutePath());
|
||||||
this.objectFiles.addAll(compileFiles(avrBasePath,
|
//debug includePaths
|
||||||
outputFolder.getAbsolutePath(), includePaths,
|
System.out.println("includePaths: ");
|
||||||
|
for (int i = 0; i < includePaths.size(); i++) {
|
||||||
|
System.out.println("-I" + (String) includePaths.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
objectFiles.addAll(
|
||||||
|
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||||
findFilesInFolder(libraryFolder, "S", false),
|
findFilesInFolder(libraryFolder, "S", false),
|
||||||
findFilesInFolder(libraryFolder, "c", false),
|
findFilesInFolder(libraryFolder, "c", false),
|
||||||
findFilesInFolder(libraryFolder, "cpp", false),
|
findFilesInFolder(libraryFolder, "cpp", false),
|
||||||
configPreferences));
|
boardPreferences));
|
||||||
outputFolder = new File(outputFolder, "utility");
|
outputFolder = new File(outputFolder, "utility");
|
||||||
createFolder(outputFolder);
|
createFolder(outputFolder);
|
||||||
this.objectFiles.addAll(compileFiles(avrBasePath,
|
objectFiles.addAll(
|
||||||
outputFolder.getAbsolutePath(), includePaths,
|
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||||
findFilesInFolder(utilityFolder, "S", false),
|
findFilesInFolder(utilityFolder, "S", false),
|
||||||
findFilesInFolder(utilityFolder, "c", false),
|
findFilesInFolder(utilityFolder, "c", false),
|
||||||
findFilesInFolder(utilityFolder, "cpp", false),
|
findFilesInFolder(utilityFolder, "cpp", false),
|
||||||
configPreferences));
|
boardPreferences));
|
||||||
// other libraries should not see this library's utility/ folder
|
// other libraries should not see this library's utility/ folder
|
||||||
this.includePaths.remove(includePaths.size() - 1);
|
includePaths.remove(includePaths.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. compile the core, outputting .o files to <buildPath> and then
|
// 3. compile the core, outputting .o files to <buildPath> and then
|
||||||
// collecting them into the core.a library file.
|
// collecting them into the core.a library file.
|
||||||
void compileCore (String avrBasePath, String buildPath, String corePath, HashMap<String, String> configPreferences)
|
void compileCore (String avrBasePath, String buildPath, String corePath, String pins, String pinsPath, HashMap<String, String> configPreferences)
|
||||||
throws RunnerException
|
throws RunnerException
|
||||||
{
|
{
|
||||||
//logger.debug("compileCore(...) start");
|
System.out.println("compileCore(...) start");
|
||||||
|
|
||||||
ArrayList<String> includePaths = new ArrayList();
|
ArrayList<String> includePaths = new ArrayList();
|
||||||
includePaths.add(corePath); //include core path only
|
includePaths.add(corePath); //include core path only
|
||||||
|
if (pinsPath != null) includePaths.add(pinsPath);
|
||||||
|
|
||||||
|
//debug includePaths
|
||||||
|
System.out.println("includePaths: ");
|
||||||
|
for (int i = 0; i < includePaths.size(); i++) {
|
||||||
|
System.out.println("-I" + (String) includePaths.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
String baseCommandString = configPreferences.get("recipe.ar.pattern");
|
String baseCommandString = configPreferences.get("recipe.ar.pattern");
|
||||||
String commandString = "";
|
String commandString = "";
|
||||||
MessageFormat compileFormat = new MessageFormat(baseCommandString);
|
MessageFormat compileFormat = new MessageFormat(baseCommandString);
|
||||||
|
System.out.println("corePath: " + corePath);
|
||||||
List<File> coreObjectFiles = compileFiles(
|
List<File> coreObjectFiles = compileFiles(
|
||||||
avrBasePath,
|
avrBasePath,
|
||||||
buildPath,
|
buildPath,
|
||||||
@ -810,9 +801,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
//objectName
|
//objectName
|
||||||
file.getAbsolutePath()
|
file.getAbsolutePath()
|
||||||
};
|
};
|
||||||
|
System.out.println("compileCore(...) substitute");
|
||||||
|
|
||||||
commandString = compileFormat.format( Args );
|
commandString = compileFormat.format( Args );
|
||||||
String[] commandArray = commandString.split(",");
|
String[] commandArray = commandString.split("\\|");
|
||||||
execAsynchronously(commandArray);
|
execAsynchronously(commandArray);
|
||||||
|
|
||||||
|
|
||||||
@ -823,15 +815,16 @@ public class Compiler implements MessageConsumer {
|
|||||||
void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
|
||||||
throws RunnerException
|
throws RunnerException
|
||||||
{
|
{
|
||||||
//logger.debug("compileLink: start");
|
System.out.println("compileLink: start");
|
||||||
String baseCommandString = configPreferences.get("recipe.c.combine.pattern");
|
String baseCommandString = configPreferences.get("recipe.c.combine.pattern");
|
||||||
String commandString = "";
|
String commandString = "";
|
||||||
MessageFormat compileFormat = new MessageFormat(baseCommandString);
|
MessageFormat compileFormat = new MessageFormat(baseCommandString);
|
||||||
String objectFileList = "";
|
String objectFileList = "";
|
||||||
|
|
||||||
for (File file : objectFiles) {
|
for (File file : objectFiles) {
|
||||||
objectFileList = objectFileList + file.getAbsolutePath() + ",";
|
objectFileList = objectFileList + file.getAbsolutePath() + "|";
|
||||||
}
|
}
|
||||||
|
System.out.println("objectFileList: " + objectFileList);
|
||||||
|
|
||||||
Object[] Args = {
|
Object[] Args = {
|
||||||
avrBasePath,
|
avrBasePath,
|
||||||
@ -847,7 +840,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
corePath,
|
corePath,
|
||||||
configPreferences.get("ldscript"),
|
configPreferences.get("ldscript"),
|
||||||
};
|
};
|
||||||
String[] commandArray = commandString.split(",");
|
commandString = compileFormat.format( Args );
|
||||||
|
String[] commandArray = commandString.split("\\|");
|
||||||
execAsynchronously(commandArray);
|
execAsynchronously(commandArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,7 +863,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
buildPath + File.separator + primaryClassName
|
buildPath + File.separator + primaryClassName
|
||||||
};
|
};
|
||||||
commandString = compileFormat.format( Args );
|
commandString = compileFormat.format( Args );
|
||||||
String[] commandArray = commandString.split(",");
|
String[] commandArray = commandString.split("\\|");
|
||||||
execAsynchronously(commandArray);
|
execAsynchronously(commandArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,13 +885,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
buildPath + File.separator + primaryClassName
|
buildPath + File.separator + primaryClassName
|
||||||
};
|
};
|
||||||
commandString = compileFormat.format( Args );
|
commandString = compileFormat.format( Args );
|
||||||
String[] commandArray = commandString.split(",");
|
String[] commandArray = commandString.split("\\|");
|
||||||
execAsynchronously(commandArray);
|
execAsynchronously(commandArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//merge all the preferences file in the correct order of precedence
|
//merge all the preferences file in the correct order of precedence
|
||||||
HashMap mergePreferences(Map Preferences, Map platformPreferences, Map boardPreferences)
|
HashMap mergePreferences(Map Preferences, Map platformPreferences, Map boardPreferences)
|
||||||
{
|
{
|
||||||
@ -966,7 +957,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
String includes = "";
|
String includes = "";
|
||||||
for (int i = 0; i < includePaths.size(); i++)
|
for (int i = 0; i < includePaths.size(); i++)
|
||||||
{
|
{
|
||||||
includes = includes + (i > 0 ? "," : "") + ("-I" + (String) includePaths.get(i));
|
includes = includes + (" -I" + (String) includePaths.get(i)) + "|";
|
||||||
}
|
}
|
||||||
//logger.debug("Paths prepared: " + includes);
|
//logger.debug("Paths prepared: " + includes);
|
||||||
return includes;
|
return includes;
|
||||||
|
@ -240,6 +240,7 @@ run.present.exclusive.macosx = true
|
|||||||
board = uno
|
board = uno
|
||||||
target = arduino
|
target = arduino
|
||||||
platform = avr
|
platform = avr
|
||||||
|
software=ARDUINO
|
||||||
|
|
||||||
programmer = arduino:avrispmkii
|
programmer = arduino:avrispmkii
|
||||||
|
|
||||||
|
@ -2,38 +2,38 @@
|
|||||||
##compile c object files
|
##compile c object files
|
||||||
##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide.
|
##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide.
|
||||||
|
|
||||||
#default.recipe.c.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
|
#default.recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10}
|
||||||
#default.recipe.cpp.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
|
#default.recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10}
|
||||||
#default.recipe.ar.pattern={0}{1},{2},{3}{4},{5}
|
#default.recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5}
|
||||||
#default.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7},{8},-L{9},-lm
|
#default.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm
|
||||||
#default.recipe.objcopy.eep.pattern={0}{1},{2},{3}.elf,{4}.eep
|
#default.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep
|
||||||
#default.recipe.objcopy.hex.pattern={0}{1},{2},{3}.elf,{4}.hex
|
#default.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex
|
||||||
|
|
||||||
########avr compile pattern ##########
|
########avr compile pattern ##########
|
||||||
#avr.recipe.c.o.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-D{7=ARDUINO}={6=Base.REVISION}{7=-I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=OBJECT_NAME}
|
#avr.recipe.c.o.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-D{7=ARDUINO}={6=Base.REVISION}{7=-I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=OBJECT_NAME}
|
||||||
#object name seems to have build path in it.
|
#object name seems to have build path in it.
|
||||||
avr.recipe.c.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
|
avr.recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10}
|
||||||
|
|
||||||
|
|
||||||
##compile cc object files
|
##compile cc object files
|
||||||
#avr.recipe.cc.o.pattern={0=compiler.path}{1=compiler.cc.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-DARDUINO={6=Base.REVISION}{-7=I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=BUILD_PATH}{10=OBJECT_NAME}
|
#avr.recipe.cc.o.pattern={0=compiler.path}{1=compiler.cc.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-DARDUINO={6=Base.REVISION}{-7=I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=BUILD_PATH}{10=OBJECT_NAME}
|
||||||
avr.recipe.cpp.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
|
avr.recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10}
|
||||||
##create archives
|
##create archives
|
||||||
#avr.recipe.ar.pattern={0=compiler.path}{1=compiler.ar.cmd}{2=compiler.ar.flags}{3=BUILD_PATH}{4=CORE_NAME=core.a}{5=BUILD_PATH}{6=OBJECT_NAME}
|
#avr.recipe.ar.pattern={0=compiler.path}{1=compiler.ar.cmd}{2=compiler.ar.flags}{3=BUILD_PATH}{4=CORE_NAME=core.a}{5=BUILD_PATH}{6=OBJECT_NAME}
|
||||||
avr.recipe.ar.pattern={0}{1},{2},{3}{4},{5}
|
avr.recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5}
|
||||||
|
|
||||||
##combine gc-sections, archives, and objects
|
##combine gc-sections| archives, and objects
|
||||||
#avr.recipe.c.combine.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.combine.flags}{3=compiler.cpudef}{4=build.mcu} -o {5=BUILD_PATH}{6=SOURCE_NAME}.elf {7=BUILD_PATH}{8=SOURCE_NAME}.o {9=BUILD_PATH}{10=CORE_NAME=core.a} -L{11=BUILD_PATH} -lm
|
#avr.recipe.c.combine.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.combine.flags}{3=compiler.cpudef}{4=build.mcu} -o {5=BUILD_PATH}{6=SOURCE_NAME}.elf {7=BUILD_PATH}{8=SOURCE_NAME}.o {9=BUILD_PATH}{10=CORE_NAME=core.a} -L{11=BUILD_PATH} -lm
|
||||||
#avr.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7}{8},{9},-L{10},-lm
|
#avr.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}{8}|{9}|-L{10}|-lm
|
||||||
avr.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7},{8},-L{9},-lm
|
avr.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm
|
||||||
|
|
||||||
##create eeprom
|
##create eeprom
|
||||||
#avr.recipe.objcopy.eep.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.eep.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.eep
|
#avr.recipe.objcopy.eep.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.eep.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.eep
|
||||||
avr.recipe.objcopy.eep.pattern={0}{1},{2},{3}.elf,{4}.eep
|
avr.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep
|
||||||
|
|
||||||
##create hex
|
##create hex
|
||||||
#avr.recipe.objcopy.hex.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.elf.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.hex
|
#avr.recipe.objcopy.hex.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.elf.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.hex
|
||||||
avr.recipe.objcopy.hex.pattern={0}{1},{2},{3}.elf,{4}.hex
|
avr.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -42,22 +42,23 @@ avr.name=Arduino
|
|||||||
#avr.compiler.path Official default is correct, only need to change this if you want to overide the initial default
|
#avr.compiler.path Official default is correct, only need to change this if you want to overide the initial default
|
||||||
#avr.compiler.path={0}/hardware/tools/avr/bin/
|
#avr.compiler.path={0}/hardware/tools/avr/bin/
|
||||||
avr.compiler.c.cmd=avr-gcc
|
avr.compiler.c.cmd=avr-gcc
|
||||||
avr.compiler.c.flags=-c,-g,-Os,-w,-ffunction-sections,-fdata-sections
|
avr.compiler.c.flags=|-c|-g|-Os|-w|-ffunction-sections|-fdata-sections
|
||||||
avr.compiler.c.elf.flags=-Os,-Wl,--gc-sections
|
avr.compiler.c.elf.flags=|-Os|-Wl|--gc-sections
|
||||||
avr.compiler.c.elf.cmd=avr-gcc
|
avr.compiler.c.elf.cmd=avr-gcc
|
||||||
avr.compiler.S.flags=-c,-g,-assembler-with-cpp
|
avr.compiler.S.flags=|-c|-g|-assembler-with-cpp
|
||||||
avr.compiler.cpp.cmd=avr-g++
|
avr.compiler.cpp.cmd=avr-g++
|
||||||
avr.compiler.cpp.flags=-c,-g,-Os,-w,-fno-exceptions,-ffunction-sections,-fdata-sections
|
avr.compiler.cpp.flags=|-c|-g|-Os|-w|-fno-exceptions|-ffunction-sections|-fdata-sections
|
||||||
avr.compiler.ar.cmd=avr-ar
|
avr.compiler.ar.cmd=avr-ar
|
||||||
avr.compiler.ar.flags=rcs
|
avr.compiler.ar.flags=rcs
|
||||||
avr.compiler.objcopy.cmd=avr-objcopy
|
avr.compiler.objcopy.cmd=avr-objcopy
|
||||||
avr.compiler.objcopy.eep.flags=-O,ihex,-j,.eeprom,--set-section-flags=.eeprom=alloc,load,--no-change-warnings,--change-section-lma,.eeprom=0
|
avr.compiler.objcopy.eep.flags=|-O|ihex|-j|.eeprom|--set-section-flags=.eeprom=alloc,load|--no-change-warnings|--change-section-lma|.eeprom=0
|
||||||
avr.compiler.elf2hex.flags=-O,ihex,-R,.eeprom
|
avr.compiler.elf2hex.flags=|-O|ihex|-R|.eeprom
|
||||||
avr.compiler.elf2hex.cmd=avr-objcopy
|
avr.compiler.elf2hex.cmd=avr-objcopy
|
||||||
avr.compiler.ldflags=
|
avr.compiler.ldflags=
|
||||||
avr.compiler.cpudef=-mmcu=
|
avr.compiler.cpudef=-mmcu=
|
||||||
avr.compiler.upload.cmd=
|
avr.compiler.upload.cmd=
|
||||||
avr.compiler.upload.flags=
|
avr.compiler.upload.flags=
|
||||||
|
avr.compiler.define=-DARDUINO=
|
||||||
avr.library.path=./hardware/arduino/cores/arduino
|
avr.library.path=./hardware/arduino/cores/arduino
|
||||||
avr.library.core.path=./libraries
|
avr.library.core.path=./libraries
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user