From 72c4404c6d92c06aad2c43bf841fedbcb17c9822 Mon Sep 17 00:00:00 2001 From: ricklon Date: Thu, 16 Jun 2011 20:36:39 -0400 Subject: [PATCH 1/6] Fixed compile process up to step 4. asyncExec cannot have null argmuments from the array. --- app/src/processing/app/debug/Compiler.java | 132 +++++++++++++++------ 1 file changed, 94 insertions(+), 38 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index a83cd7c9c..2ae80145b 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -97,16 +97,19 @@ public class Compiler implements MessageConsumer { platformPreferences = new HashMap(Base.getPlatformPreferences(platform)); } - + System.out.println("////////////////////////////compiler.java is doing stuff/////////////////"); //Put all the global preference configuration into one Master configpreferences configPreferences = mergePreferences( Preferences.getMap(), platformPreferences, boardPreferences); avrBasePath = configPreferences.get("compiler.path"); if (avrBasePath == null) { avrBasePath = Base.getAvrBasePath(); + System.out.println("avrBasePath: " + avrBasePath); } else { + System.out.println("avrBasePath:exists: " + avrBasePath); + //Put in the system path in the compiler path if available MessageFormat compileFormat = new MessageFormat(avrBasePath); String basePath = System.getProperty("user.dir"); @@ -116,6 +119,8 @@ public class Compiler implements MessageConsumer { } Object[] Args = {basePath}; avrBasePath = compileFormat.format( Args ); + System.out.println("avrBasePath:new: " + avrBasePath); + } this.board = configPreferences.get("board"); @@ -159,7 +164,7 @@ public class Compiler implements MessageConsumer { } } - List objectFiles = new ArrayList(); + objectFiles = new ArrayList(); // 0. include paths for core + all libraries @@ -171,6 +176,7 @@ public class Compiler implements MessageConsumer { } // 1. compile the sketch (already in the buildPath) + System.out.println("1. compileSketch"); compileSketch(avrBasePath, buildPath, includePaths, configPreferences); /* objectFiles.addAll( @@ -182,6 +188,12 @@ public class Compiler implements MessageConsumer { */ // 2. compile the libraries, outputting .o files to: // + // 2. compile the libraries, outputting .o files to: + // // + //Doesn't really use configPreferences + System.out.println("2. compileLibraries"); + compileLibraries(avrBasePath, buildPath, includePaths, configPreferences); +/* for (File libraryFolder : sketch.getImportedLibraries()) { File outputFolder = new File(buildPath, libraryFolder.getName()); @@ -206,9 +218,15 @@ public class Compiler implements MessageConsumer { // other libraries should not see this library's utility/ folder includePaths.remove(includePaths.size() - 1); } +*/ // 3. compile the core, outputting .o files to and then // 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.add(corePath); // include path for core only @@ -233,6 +251,9 @@ public class Compiler implements MessageConsumer { } */ // 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[] { avrBasePath + "avr-gcc", @@ -263,6 +284,9 @@ public class Compiler implements MessageConsumer { */ // 5. extract EEPROM data (from EEMEM directive) to .eep file. + System.out.println("5. compileEep"); + compileEep(avrBasePath, buildPath, includePaths, configPreferences); + /* commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy.add(2, "ihex"); @@ -275,8 +299,13 @@ public class Compiler implements MessageConsumer { commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf"); commandObjcopy.add(buildPath + File.separator + primaryClassName + ".eep"); execAsynchronously(commandObjcopy); +*/ // 6. build the .hex file + System.out.println("6. compileHex"); + compileHex(avrBasePath, buildPath, includePaths, configPreferences); + +/* commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy.add(2, "ihex"); commandObjcopy.add(".eeprom"); // remove eeprom data @@ -383,8 +412,17 @@ public class Compiler implements MessageConsumer { * Either succeeds or throws a RunnerException fit for public consumption. */ private void execAsynchronously(String[] command) throws RunnerException { - // String[] command = new String[commandList.size()]; - //commandList.toArray(command); + + //eliminate any empty array entries + List stringList = new ArrayList(); + 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; if (verbose || Preferences.getBoolean("build.verbose")) { @@ -443,6 +481,7 @@ public class Compiler implements MessageConsumer { re.hideStackTrace(); throw re; } + System.out.println("execAsync: Done."); } @@ -675,8 +714,15 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - System.out.println("command:" + command); String[] commandArray = command.split(","); + + /* + System.out.println("command:" + command); + for (int ii = 0; ii < commandArray.length; ii++) + { + System.out.println("'" + commandArray[ii] + "'"); + } + */ return commandArray; } @@ -706,6 +752,7 @@ public class Compiler implements MessageConsumer { static public ArrayList findFilesInPath(String path, String extension, boolean recurse) { + System.out.println("findFilesInPath: " + path); return findFilesInFolder(new File(path), extension, recurse); } @@ -747,46 +794,49 @@ public class Compiler implements MessageConsumer { void compileLibraries (String avrBasePath, String buildPath, ArrayList includePaths, HashMap configPreferences) throws RunnerException { - //logger.debug("compileLibraries: start"); - 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 - this.includePaths.add(utilityFolder.getAbsolutePath()); - this.objectFiles.addAll(compileFiles(avrBasePath, - outputFolder.getAbsolutePath(), includePaths, - findFilesInFolder(libraryFolder, "S", false), - findFilesInFolder(libraryFolder, "c", false), - findFilesInFolder(libraryFolder, "cpp", false), - configPreferences)); - outputFolder = new File(outputFolder, "utility"); - createFolder(outputFolder); - this.objectFiles.addAll(compileFiles(avrBasePath, - outputFolder.getAbsolutePath(), includePaths, - findFilesInFolder(utilityFolder, "S", false), - findFilesInFolder(utilityFolder, "c", false), - findFilesInFolder(utilityFolder, "cpp", false), - configPreferences)); - // other libraries should not see this library's utility/ folder - this.includePaths.remove(includePaths.size() - 1); - } - } + System.out.println("compileLibraries: start"); + + for (File libraryFolder : sketch.getImportedLibraries()) { + System.out.println("libraryFolder: " + libraryFolder); + 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(utilityFolder.getAbsolutePath()); + objectFiles.addAll( + compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths, + findFilesInFolder(libraryFolder, "S", false), + findFilesInFolder(libraryFolder, "c", false), + findFilesInFolder(libraryFolder, "cpp", false), + boardPreferences)); + outputFolder = new File(outputFolder, "utility"); + createFolder(outputFolder); + objectFiles.addAll( + compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths, + findFilesInFolder(utilityFolder, "S", false), + findFilesInFolder(utilityFolder, "c", false), + findFilesInFolder(utilityFolder, "cpp", false), + boardPreferences)); + // other libraries should not see this library's utility/ folder + includePaths.remove(includePaths.size() - 1); + } + } // 3. compile the core, outputting .o files to and then // collecting them into the core.a library file. - void compileCore (String avrBasePath, String buildPath, String corePath, HashMap configPreferences) + void compileCore (String avrBasePath, String buildPath, String corePath, String pins, String pinsPath, HashMap configPreferences) throws RunnerException { - //logger.debug("compileCore(...) start"); + System.out.println("compileCore(...) start"); ArrayList includePaths = new ArrayList(); includePaths.add(corePath); //include core path only + if (pinsPath != null) includePaths.add(pinsPath); + String baseCommandString = configPreferences.get("recipe.ar.pattern"); String commandString = ""; MessageFormat compileFormat = new MessageFormat(baseCommandString); - + System.out.println("corePath: " + corePath); List coreObjectFiles = compileFiles( avrBasePath, buildPath, @@ -810,6 +860,7 @@ public class Compiler implements MessageConsumer { //objectName file.getAbsolutePath() }; + System.out.println("compileCore(...) substitute"); commandString = compileFormat.format( Args ); String[] commandArray = commandString.split(","); @@ -823,8 +874,9 @@ public class Compiler implements MessageConsumer { void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList includePaths, HashMap configPreferences) throws RunnerException { - //logger.debug("compileLink: start"); + System.out.println("compileLink: start"); String baseCommandString = configPreferences.get("recipe.c.combine.pattern"); + System.out.println("baseCommandstring: " + baseCommandString); String commandString = ""; MessageFormat compileFormat = new MessageFormat(baseCommandString); String objectFileList = ""; @@ -832,6 +884,7 @@ public class Compiler implements MessageConsumer { for (File file : objectFiles) { objectFileList = objectFileList + file.getAbsolutePath() + ","; } + System.out.println("objectFileList: " + objectFileList); Object[] Args = { avrBasePath, @@ -848,6 +901,12 @@ public class Compiler implements MessageConsumer { configPreferences.get("ldscript"), }; String[] commandArray = commandString.split(","); + System.out.println("commandString: " + commandString); + for (int ii = 0; ii < commandArray.length; ii++) + { + System.out.println("'" + commandArray[ii] + "'"); + } + System.out.println("4. compileLink:prexec"); execAsynchronously(commandArray); } @@ -894,9 +953,6 @@ public class Compiler implements MessageConsumer { String[] commandArray = commandString.split(","); execAsynchronously(commandArray); } - - - //merge all the preferences file in the correct order of precedence HashMap mergePreferences(Map Preferences, Map platformPreferences, Map boardPreferences) From a57f35fb5114e7721785c5c6ee0c7ada3712ad32 Mon Sep 17 00:00:00 2001 From: ricklon Date: Thu, 16 Jun 2011 23:17:08 -0400 Subject: [PATCH 2/6] Fixed the missing line for messageformat args. --- app/src/processing/app/debug/Compiler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 2ae80145b..72e176576 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -900,6 +900,7 @@ public class Compiler implements MessageConsumer { corePath, configPreferences.get("ldscript"), }; + commandString = compileFormat.format( Args ); String[] commandArray = commandString.split(","); System.out.println("commandString: " + commandString); for (int ii = 0; ii < commandArray.length; ii++) From 67c9dfc6679ff231076afcb0546ffc5190179420 Mon Sep 17 00:00:00 2001 From: ricklon Date: Fri, 17 Jun 2011 00:54:58 -0400 Subject: [PATCH 3/6] A bit of cleanup. Delimeter not figured out yet. --- app/src/processing/app/debug/Compiler.java | 25 +++++--------- hardware/arduino/platforms.txt | 40 +++++++++++----------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 72e176576..a31837bcf 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -596,7 +596,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split(","); + String[] commandArray = command.split("\|"); return commandArray; } @@ -655,7 +655,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split(","); + String[] commandArray = command.split("\|"); return commandArray; } /* @@ -714,7 +714,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split(","); + String[] commandArray = command.split("\|"); /* System.out.println("command:" + command); @@ -863,7 +863,7 @@ public class Compiler implements MessageConsumer { System.out.println("compileCore(...) substitute"); commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split(","); + String[] commandArray = commandString.split("\|"); execAsynchronously(commandArray); @@ -876,13 +876,12 @@ public class Compiler implements MessageConsumer { { System.out.println("compileLink: start"); String baseCommandString = configPreferences.get("recipe.c.combine.pattern"); - System.out.println("baseCommandstring: " + baseCommandString); String commandString = ""; MessageFormat compileFormat = new MessageFormat(baseCommandString); String objectFileList = ""; for (File file : objectFiles) { - objectFileList = objectFileList + file.getAbsolutePath() + ","; + objectFileList = objectFileList + file.getAbsolutePath() + "\|"; } System.out.println("objectFileList: " + objectFileList); @@ -901,13 +900,7 @@ public class Compiler implements MessageConsumer { configPreferences.get("ldscript"), }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split(","); - System.out.println("commandString: " + commandString); - for (int ii = 0; ii < commandArray.length; ii++) - { - System.out.println("'" + commandArray[ii] + "'"); - } - System.out.println("4. compileLink:prexec"); + String[] commandArray = commandString.split("\|"); execAsynchronously(commandArray); } @@ -929,7 +922,7 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split(","); + String[] commandArray = commandString.split("\|"); execAsynchronously(commandArray); } @@ -951,7 +944,7 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split(","); + String[] commandArray = commandString.split("\|"); execAsynchronously(commandArray); } @@ -1023,7 +1016,7 @@ public class Compiler implements MessageConsumer { String includes = ""; for (int i = 0; i < includePaths.size(); i++) { - includes = includes + (" -I" + (String) includePaths.get(i)) + ","; + includes = includes + (" -I" + (String) includePaths.get(i)) + "\|"; } //logger.debug("Paths prepared: " + includes); return includes; diff --git a/hardware/arduino/platforms.txt b/hardware/arduino/platforms.txt index d3a4c1bc4..3f1d2eb7d 100755 --- a/hardware/arduino/platforms.txt +++ b/hardware/arduino/platforms.txt @@ -2,38 +2,38 @@ ##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.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.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.objcopy.eep.pattern={0}{1},{2},{3}.elf,{4}.eep -#default.recipe.objcopy.hex.pattern={0}{1},{2},{3}.elf,{4}.hex +#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.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.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep +#default.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex ########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} #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 #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 #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}{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}|{9}|-L{10}|-lm +avr.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm ##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}{1},{2},{3}.elf,{4}.eep +avr.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep ##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}{1},{2},{3}.elf,{4}.hex +avr.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex @@ -42,17 +42,17 @@ 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={0}/hardware/tools/avr/bin/ avr.compiler.c.cmd=avr-gcc -avr.compiler.c.flags=,-c,-g,-Os,-w,-ffunction-sections,-fdata-sections -avr.compiler.c.elf.flags=,-Os,-Wl,--gc-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.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.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.flags=rcs 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.elf2hex.flags=,-O,ihex,-R,.eeprom +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.cmd=avr-objcopy avr.compiler.ldflags= avr.compiler.cpudef=-mmcu= From aa01546b5599db1079aa29c25429dbe2f4ef93d5 Mon Sep 17 00:00:00 2001 From: ricklon Date: Fri, 17 Jun 2011 22:12:21 -0400 Subject: [PATCH 4/6] Switched to a nonconflicting delimeter |. Compile process is working. Need to make sure that it matches 1.0 process exactly. --- app/src/processing/app/debug/Compiler.java | 18 +++++++++--------- hardware/arduino/platforms.txt | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index a31837bcf..96cbfe7a4 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -596,7 +596,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split("\|"); + String[] commandArray = command.split("\\|"); return commandArray; } @@ -655,7 +655,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split("\|"); + String[] commandArray = command.split("\\|"); return commandArray; } /* @@ -714,7 +714,7 @@ public class Compiler implements MessageConsumer { }; String command = compileFormat.format( Args ); - String[] commandArray = command.split("\|"); + String[] commandArray = command.split("\\|"); /* System.out.println("command:" + command); @@ -863,7 +863,7 @@ public class Compiler implements MessageConsumer { System.out.println("compileCore(...) substitute"); commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split("\|"); + String[] commandArray = commandString.split("\\|"); execAsynchronously(commandArray); @@ -881,7 +881,7 @@ public class Compiler implements MessageConsumer { String objectFileList = ""; for (File file : objectFiles) { - objectFileList = objectFileList + file.getAbsolutePath() + "\|"; + objectFileList = objectFileList + file.getAbsolutePath() + "|"; } System.out.println("objectFileList: " + objectFileList); @@ -900,7 +900,7 @@ public class Compiler implements MessageConsumer { configPreferences.get("ldscript"), }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split("\|"); + String[] commandArray = commandString.split("\\|"); execAsynchronously(commandArray); } @@ -922,7 +922,7 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split("\|"); + String[] commandArray = commandString.split("\\|"); execAsynchronously(commandArray); } @@ -944,7 +944,7 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName }; commandString = compileFormat.format( Args ); - String[] commandArray = commandString.split("\|"); + String[] commandArray = commandString.split("\\|"); execAsynchronously(commandArray); } @@ -1016,7 +1016,7 @@ public class Compiler implements MessageConsumer { String includes = ""; for (int i = 0; i < includePaths.size(); i++) { - includes = includes + (" -I" + (String) includePaths.get(i)) + "\|"; + includes = includes + (" -I" + (String) includePaths.get(i)) + "|"; } //logger.debug("Paths prepared: " + includes); return includes; diff --git a/hardware/arduino/platforms.txt b/hardware/arduino/platforms.txt index 3f1d2eb7d..dbb3a4086 100755 --- a/hardware/arduino/platforms.txt +++ b/hardware/arduino/platforms.txt @@ -51,7 +51,7 @@ avr.compiler.cpp.flags=|-c|-g|-Os|-w|-fno-exceptions|-ffunction-sections|-fdata- avr.compiler.ar.cmd=avr-ar avr.compiler.ar.flags=rcs 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.cmd=avr-objcopy avr.compiler.ldflags= From 43a11be3c9ea51a4260ce80506f1040d68318ab4 Mon Sep 17 00:00:00 2001 From: ricklon Date: Sat, 18 Jun 2011 23:44:32 -0400 Subject: [PATCH 5/6] Cleaned up some of the code. Need to focus getting the 1.0 code compilation changes double checked. --- app/src/processing/app/debug/Compiler.java | 60 ++-------------------- 1 file changed, 3 insertions(+), 57 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 96cbfe7a4..8665f72d8 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -178,21 +178,14 @@ public class Compiler implements MessageConsumer { // 1. compile the sketch (already in the buildPath) System.out.println("1. compileSketch"); 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: // // 2. compile the libraries, outputting .o files to: // // //Doesn't really use configPreferences - System.out.println("2. compileLibraries"); - compileLibraries(avrBasePath, buildPath, includePaths, configPreferences); + System.out.println("2. compileLibraries"); + compileLibraries(avrBasePath, buildPath, includePaths, configPreferences); /* for (File libraryFolder : sketch.getImportedLibraries()) { @@ -315,53 +308,6 @@ public class Compiler implements MessageConsumer { */ return true; - /* - - logger.debug("corePaths: " + this.corePath); - - - this.objectFiles = new ArrayList(); - - // 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: - // // - //Doesn't really use configPreferences - logger.debug("2. compileLibraries"); - compileLibraries(avrBasePath, buildPath, includePaths, configPreferences); - - // 3. compile the core, outputting .o files to 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); - - // 6. build the .hex file - logger.debug("6. compileHex"); - compileHex(avrBasePath, buildPath, includePaths, configPreferences); - - //done - logger.debug("7. compile done"); - return true; - - - - */ - - } From dacfa8622316708af0cafb7dee5e965fedac7d64 Mon Sep 17 00:00:00 2001 From: ricklon Date: Wed, 22 Jun 2011 21:20:45 -0600 Subject: [PATCH 6/6] Addtional debuggin. Trying to find the pins compile issue. --- app/src/processing/app/debug/Compiler.java | 55 ++++++++++------------ build/shared/lib/preferences.txt | 1 + hardware/arduino/platforms.txt | 1 + 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 8665f72d8..cdae52013 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -80,10 +80,10 @@ public class Compiler implements MessageConsumer { this.buildPath = buildPath; this.primaryClassName = primaryClassName; this.verbose = verbose; + objectFiles = new ArrayList(); // the pms object isn't used for anything but storage MessageStream pms = new MessageStream(this); - Map boardPreferences = Base.getBoardPreferences(); //Check for null platform, and use system default if not found @@ -164,7 +164,6 @@ public class Compiler implements MessageConsumer { } } - objectFiles = new ArrayList(); // 0. include paths for core + all libraries @@ -279,33 +278,10 @@ public class Compiler implements MessageConsumer { // 5. extract EEPROM data (from EEMEM directive) to .eep file. System.out.println("5. compileEep"); compileEep(avrBasePath, buildPath, includePaths, configPreferences); - -/* - 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 System.out.println("6. compileHex"); - compileHex(avrBasePath, buildPath, includePaths, configPreferences); - -/* - 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); -*/ + compileHex(avrBasePath, buildPath, includePaths, configPreferences); return true; } @@ -534,7 +510,7 @@ public class Compiler implements MessageConsumer { configPreferences.get("compiler.cpudef"), configPreferences.get("build.mcu"), configPreferences.get("build.f_cpu"), - configPreferences.get("board"), + configPreferences.get("software"), Base.REVISION, includes, sourceName, @@ -593,7 +569,7 @@ public class Compiler implements MessageConsumer { configPreferences.get("compiler.cpudef"), configPreferences.get("build.mcu"), configPreferences.get("build.f_cpu"), - configPreferences.get("board"), + configPreferences.get("software"), Base.REVISION, includes, sourceName, @@ -652,7 +628,7 @@ public class Compiler implements MessageConsumer { configPreferences.get("compiler.cpudef"), configPreferences.get("build.mcu"), configPreferences.get("build.f_cpu"), - configPreferences.get("board"), + configPreferences.get("software"), Base.REVISION, includes, sourceName, @@ -727,6 +703,12 @@ public class Compiler implements MessageConsumer { void compileSketch(String avrBasePath, String buildPath, ArrayList includePaths, HashMap configPreferences) 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"); this.objectFiles.addAll(compileFiles(avrBasePath, buildPath, includePaths, findFilesInPath(buildPath, "S", false), @@ -741,7 +723,7 @@ public class Compiler implements MessageConsumer { throws RunnerException { System.out.println("compileLibraries: start"); - + for (File libraryFolder : sketch.getImportedLibraries()) { System.out.println("libraryFolder: " + libraryFolder); File outputFolder = new File(buildPath, libraryFolder.getName()); @@ -749,6 +731,13 @@ public class Compiler implements MessageConsumer { createFolder(outputFolder); // this library can use includes in its utility/ folder includePaths.add(utilityFolder.getAbsolutePath()); + //debug 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), @@ -778,6 +767,12 @@ public class Compiler implements MessageConsumer { ArrayList includePaths = new ArrayList(); 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 commandString = ""; diff --git a/build/shared/lib/preferences.txt b/build/shared/lib/preferences.txt index 336d94a96..c1d370cfe 100755 --- a/build/shared/lib/preferences.txt +++ b/build/shared/lib/preferences.txt @@ -240,6 +240,7 @@ run.present.exclusive.macosx = true board = uno target = arduino platform = avr +software=ARDUINO programmer = arduino:avrispmkii diff --git a/hardware/arduino/platforms.txt b/hardware/arduino/platforms.txt index dbb3a4086..d946b8274 100755 --- a/hardware/arduino/platforms.txt +++ b/hardware/arduino/platforms.txt @@ -58,6 +58,7 @@ avr.compiler.ldflags= avr.compiler.cpudef=-mmcu= avr.compiler.upload.cmd= avr.compiler.upload.flags= +avr.compiler.define=-DARDUINO= avr.library.path=./hardware/arduino/cores/arduino avr.library.core.path=./libraries