diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 1b19435a8..a83cd7c9c 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -209,7 +209,7 @@ public class Compiler implements MessageConsumer { // 3. compile the core, outputting .o files to and then // collecting them into the core.a library file. - +/* includePaths.clear(); includePaths.add(corePath); // include path for core only if (pinsPath != null) includePaths.add(pinsPath); @@ -231,9 +231,9 @@ public class Compiler implements MessageConsumer { commandAR.add(file.getAbsolutePath()); execAsynchronously(commandAR); } - +*/ // 4. link it all together into the .elf file - +/* List baseCommandLinker = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-gcc", "-Os", @@ -260,8 +260,10 @@ public class Compiler implements MessageConsumer { })); List commandObjcopy; +*/ // 5. extract EEPROM data (from EEMEM directive) to .eep file. +/* commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy.add(2, "ihex"); commandObjcopy.set(3, "-j"); @@ -281,6 +283,7 @@ public class Compiler implements MessageConsumer { commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf"); commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex"); execAsynchronously(commandObjcopy); +*/ return true; /* @@ -348,7 +351,7 @@ public class Compiler implements MessageConsumer { execAsynchronously(getCommandCompilerS(avrBasePath, includePaths, file.getAbsolutePath(), objectPath, - boardPreferences)); + configPreferences)); } for (File file : cSources) { @@ -357,7 +360,7 @@ public class Compiler implements MessageConsumer { execAsynchronously(getCommandCompilerC(avrBasePath, includePaths, file.getAbsolutePath(), objectPath, - boardPreferences)); + configPreferences)); } for (File file : cppSources) { @@ -366,7 +369,7 @@ public class Compiler implements MessageConsumer { execAsynchronously(getCommandCompilerCPP(avrBasePath, includePaths, file.getAbsolutePath(), objectPath, - boardPreferences)); + configPreferences)); } return objectPaths; @@ -379,9 +382,9 @@ public class Compiler implements MessageConsumer { /** * Either succeeds or throws a RunnerException fit for public consumption. */ - private void execAsynchronously(List commandList) throws RunnerException { - String[] command = new String[commandList.size()]; - commandList.toArray(command); + private void execAsynchronously(String[] command) throws RunnerException { + // String[] command = new String[commandList.size()]; + //commandList.toArray(command); int result = 0; if (verbose || Preferences.getBoolean("build.verbose")) { @@ -504,7 +507,7 @@ public class Compiler implements MessageConsumer { } ///////////////////////////////////////////////////////////////////////////// - +/* static private List getCommandCompilerS(String avrBasePath, List includePaths, String sourceName, String objectName, Map boardPreferences) { List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] { @@ -526,7 +529,39 @@ public class Compiler implements MessageConsumer { return baseCommandCompiler; } +*/ + // /////////////////////////////////////////////////////////////////////////// + static private String[] getCommandCompilerS(String avrBasePath, + ArrayList includePaths, String sourceName, String objectName, + HashMap configPreferences) + { + System.out.println("getCommandCompilerS: start"); + String baseCommandString = configPreferences.get("recipe.cpp.o.pattern"); + MessageFormat compileFormat = new MessageFormat(baseCommandString); + //getIncludes to String + + String includes = preparePaths(includePaths); + Object[] Args = { + avrBasePath, + configPreferences.get("compiler.cpp.cmd"), + configPreferences.get("compiler.S.flags"), + configPreferences.get("compiler.cpudef"), + configPreferences.get("build.mcu"), + configPreferences.get("build.f_cpu"), + configPreferences.get("board"), + Base.REVISION, + includes, + sourceName, + objectName + }; + + String command = compileFormat.format( Args ); + String[] commandArray = command.split(","); + return commandArray; + } + +/* static private List getCommandCompilerC(String avrBasePath, List includePaths, String sourceName, String objectName, Map boardPreferences) { @@ -553,7 +588,38 @@ public class Compiler implements MessageConsumer { return baseCommandCompiler; } + */ + //removed static + private String[] getCommandCompilerC(String avrBasePath, + ArrayList includePaths, String sourceName, String objectName, + HashMap configPreferences) + { + System.out.println("getCommandCompilerC: start"); + String baseCommandString = configPreferences.get("recipe.c.o.pattern"); + MessageFormat compileFormat = new MessageFormat(baseCommandString); + //getIncludes to String + String includes = preparePaths(includePaths); + + Object[] Args = { + avrBasePath, + configPreferences.get("compiler.c.cmd"), + configPreferences.get("compiler.c.flags"), + configPreferences.get("compiler.cpudef"), + configPreferences.get("build.mcu"), + configPreferences.get("build.f_cpu"), + configPreferences.get("board"), + Base.REVISION, + includes, + sourceName, + objectName + }; + + String command = compileFormat.format( Args ); + String[] commandArray = command.split(","); + return commandArray; + } +/* static private List getCommandCompilerCPP(String avrBasePath, List includePaths, String sourceName, String objectName, @@ -582,7 +648,37 @@ public class Compiler implements MessageConsumer { return baseCommandCompilerCPP; } +*/ + static private String[] getCommandCompilerCPP(String avrBasePath, + ArrayList includePaths, String sourceName, String objectName, + HashMap configPreferences) + { + System.out.println("getCommandCompilerCPP: start"); + String baseCommandString = configPreferences.get("recipe.cpp.o.pattern"); + MessageFormat compileFormat = new MessageFormat(baseCommandString); + //getIncludes to String + String includes = preparePaths(includePaths); + + Object[] Args = { + avrBasePath, + configPreferences.get("compiler.cpp.cmd"), + configPreferences.get("compiler.cpp.flags"), + configPreferences.get("compiler.cpudef"), + configPreferences.get("build.mcu"), + configPreferences.get("build.f_cpu"), + configPreferences.get("board"), + Base.REVISION, + includes, + sourceName, + objectName + }; + + String command = compileFormat.format( Args ); + System.out.println("command:" + command); + String[] commandArray = command.split(","); + return commandArray; + } ///////////////////////////////////////////////////////////////////////////// @@ -714,8 +810,12 @@ public class Compiler implements MessageConsumer { //objectName file.getAbsolutePath() }; + commandString = compileFormat.format( Args ); - execAsynchronously(commandString); + String[] commandArray = commandString.split(","); + execAsynchronously(commandArray); + + } } @@ -730,7 +830,7 @@ public class Compiler implements MessageConsumer { String objectFileList = ""; for (File file : objectFiles) { - objectFileList = objectFileList + file.getAbsolutePath() + "::"; + objectFileList = objectFileList + file.getAbsolutePath() + ","; } Object[] Args = { @@ -747,8 +847,8 @@ public class Compiler implements MessageConsumer { corePath, configPreferences.get("ldscript"), }; - commandString = compileFormat.format( Args ); - execAsynchronously(commandString); + String[] commandArray = commandString.split(","); + execAsynchronously(commandArray); } // 5. extract EEPROM data (from EEMEM directive) to .eep file. @@ -769,8 +869,8 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName }; commandString = compileFormat.format( Args ); - - execAsynchronously(commandString); + String[] commandArray = commandString.split(","); + execAsynchronously(commandArray); } // 6. build the .hex file @@ -790,10 +890,9 @@ public class Compiler implements MessageConsumer { buildPath + File.separator + primaryClassName, buildPath + File.separator + primaryClassName }; - commandString = compileFormat.format( Args ); - - execAsynchronously(commandString); - + commandString = compileFormat.format( Args ); + String[] commandArray = commandString.split(","); + execAsynchronously(commandArray); } @@ -867,7 +966,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 ce35a3b36..d3a4c1bc4 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 #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=