Skip to content

Commit b0556c2

Browse files
committed
Changed :: to , for platforms.txt. Also, changes to compile process to support execAsynchronously changed to Stringp[]
1 parent f977f5f commit b0556c2

File tree

2 files changed

+139
-40
lines changed

2 files changed

+139
-40
lines changed

app/src/processing/app/debug/Compiler.java

+120-21
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public boolean compile(Sketch sketch,
209209

210210
// 3. compile the core, outputting .o files to <buildPath> and then
211211
// collecting them into the core.a library file.
212-
212+
/*
213213
includePaths.clear();
214214
includePaths.add(corePath); // include path for core only
215215
if (pinsPath != null) includePaths.add(pinsPath);
@@ -231,9 +231,9 @@ public boolean compile(Sketch sketch,
231231
commandAR.add(file.getAbsolutePath());
232232
execAsynchronously(commandAR);
233233
}
234-
234+
*/
235235
// 4. link it all together into the .elf file
236-
236+
/*
237237
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
238238
avrBasePath + "avr-gcc",
239239
"-Os",
@@ -260,8 +260,10 @@ public boolean compile(Sketch sketch,
260260
}));
261261
262262
List commandObjcopy;
263+
*/
263264

264265
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
266+
/*
265267
commandObjcopy = new ArrayList(baseCommandObjcopy);
266268
commandObjcopy.add(2, "ihex");
267269
commandObjcopy.set(3, "-j");
@@ -281,6 +283,7 @@ public boolean compile(Sketch sketch,
281283
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf");
282284
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex");
283285
execAsynchronously(commandObjcopy);
286+
*/
284287

285288
return true;
286289
/*
@@ -348,7 +351,7 @@ private List<File> compileFiles(String avrBasePath,
348351
execAsynchronously(getCommandCompilerS(avrBasePath, includePaths,
349352
file.getAbsolutePath(),
350353
objectPath,
351-
boardPreferences));
354+
configPreferences));
352355
}
353356

354357
for (File file : cSources) {
@@ -357,7 +360,7 @@ private List<File> compileFiles(String avrBasePath,
357360
execAsynchronously(getCommandCompilerC(avrBasePath, includePaths,
358361
file.getAbsolutePath(),
359362
objectPath,
360-
boardPreferences));
363+
configPreferences));
361364
}
362365

363366
for (File file : cppSources) {
@@ -366,7 +369,7 @@ private List<File> compileFiles(String avrBasePath,
366369
execAsynchronously(getCommandCompilerCPP(avrBasePath, includePaths,
367370
file.getAbsolutePath(),
368371
objectPath,
369-
boardPreferences));
372+
configPreferences));
370373
}
371374

372375
return objectPaths;
@@ -379,9 +382,9 @@ private List<File> compileFiles(String avrBasePath,
379382
/**
380383
* Either succeeds or throws a RunnerException fit for public consumption.
381384
*/
382-
private void execAsynchronously(List commandList) throws RunnerException {
383-
String[] command = new String[commandList.size()];
384-
commandList.toArray(command);
385+
private void execAsynchronously(String[] command) throws RunnerException {
386+
// String[] command = new String[commandList.size()];
387+
//commandList.toArray(command);
385388
int result = 0;
386389

387390
if (verbose || Preferences.getBoolean("build.verbose")) {
@@ -504,7 +507,7 @@ public void message(String s) {
504507
}
505508

506509
/////////////////////////////////////////////////////////////////////////////
507-
510+
/*
508511
static private List getCommandCompilerS(String avrBasePath, List includePaths,
509512
String sourceName, String objectName, Map<String, String> boardPreferences) {
510513
List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
@@ -526,7 +529,39 @@ static private List getCommandCompilerS(String avrBasePath, List includePaths,
526529
527530
return baseCommandCompiler;
528531
}
532+
*/
529533

534+
// ///////////////////////////////////////////////////////////////////////////
535+
static private String[] getCommandCompilerS(String avrBasePath,
536+
ArrayList<String> includePaths, String sourceName, String objectName,
537+
HashMap<String, String> configPreferences)
538+
{
539+
System.out.println("getCommandCompilerS: start");
540+
String baseCommandString = configPreferences.get("recipe.cpp.o.pattern");
541+
MessageFormat compileFormat = new MessageFormat(baseCommandString);
542+
//getIncludes to String
543+
544+
String includes = preparePaths(includePaths);
545+
Object[] Args = {
546+
avrBasePath,
547+
configPreferences.get("compiler.cpp.cmd"),
548+
configPreferences.get("compiler.S.flags"),
549+
configPreferences.get("compiler.cpudef"),
550+
configPreferences.get("build.mcu"),
551+
configPreferences.get("build.f_cpu"),
552+
configPreferences.get("board"),
553+
Base.REVISION,
554+
includes,
555+
sourceName,
556+
objectName
557+
};
558+
559+
String command = compileFormat.format( Args );
560+
String[] commandArray = command.split(",");
561+
return commandArray;
562+
}
563+
564+
/*
530565
531566
static private List getCommandCompilerC(String avrBasePath, List includePaths,
532567
String sourceName, String objectName, Map<String, String> boardPreferences) {
@@ -553,7 +588,38 @@ static private List getCommandCompilerC(String avrBasePath, List includePaths,
553588
554589
return baseCommandCompiler;
555590
}
591+
*/
556592

593+
//removed static
594+
private String[] getCommandCompilerC(String avrBasePath,
595+
ArrayList<String> includePaths, String sourceName, String objectName,
596+
HashMap<String, String> configPreferences)
597+
{
598+
System.out.println("getCommandCompilerC: start");
599+
String baseCommandString = configPreferences.get("recipe.c.o.pattern");
600+
MessageFormat compileFormat = new MessageFormat(baseCommandString);
601+
//getIncludes to String
602+
String includes = preparePaths(includePaths);
603+
604+
Object[] Args = {
605+
avrBasePath,
606+
configPreferences.get("compiler.c.cmd"),
607+
configPreferences.get("compiler.c.flags"),
608+
configPreferences.get("compiler.cpudef"),
609+
configPreferences.get("build.mcu"),
610+
configPreferences.get("build.f_cpu"),
611+
configPreferences.get("board"),
612+
Base.REVISION,
613+
includes,
614+
sourceName,
615+
objectName
616+
};
617+
618+
String command = compileFormat.format( Args );
619+
String[] commandArray = command.split(",");
620+
return commandArray;
621+
}
622+
/*
557623
558624
static private List getCommandCompilerCPP(String avrBasePath,
559625
List includePaths, String sourceName, String objectName,
@@ -582,7 +648,37 @@ static private List getCommandCompilerCPP(String avrBasePath,
582648
583649
return baseCommandCompilerCPP;
584650
}
651+
*/
585652

653+
static private String[] getCommandCompilerCPP(String avrBasePath,
654+
ArrayList<String> includePaths, String sourceName, String objectName,
655+
HashMap<String, String> configPreferences)
656+
{
657+
System.out.println("getCommandCompilerCPP: start");
658+
String baseCommandString = configPreferences.get("recipe.cpp.o.pattern");
659+
MessageFormat compileFormat = new MessageFormat(baseCommandString);
660+
//getIncludes to String
661+
String includes = preparePaths(includePaths);
662+
663+
Object[] Args = {
664+
avrBasePath,
665+
configPreferences.get("compiler.cpp.cmd"),
666+
configPreferences.get("compiler.cpp.flags"),
667+
configPreferences.get("compiler.cpudef"),
668+
configPreferences.get("build.mcu"),
669+
configPreferences.get("build.f_cpu"),
670+
configPreferences.get("board"),
671+
Base.REVISION,
672+
includes,
673+
sourceName,
674+
objectName
675+
};
676+
677+
String command = compileFormat.format( Args );
678+
System.out.println("command:" + command);
679+
String[] commandArray = command.split(",");
680+
return commandArray;
681+
}
586682

587683

588684
/////////////////////////////////////////////////////////////////////////////
@@ -714,8 +810,12 @@ void compileCore (String avrBasePath, String buildPath, String corePath, HashMap
714810
//objectName
715811
file.getAbsolutePath()
716812
};
813+
717814
commandString = compileFormat.format( Args );
718-
execAsynchronously(commandString);
815+
String[] commandArray = commandString.split(",");
816+
execAsynchronously(commandArray);
817+
818+
719819
}
720820
}
721821

@@ -730,7 +830,7 @@ void compileLink(String avrBasePath, String buildPath, String corePath, ArrayLis
730830
String objectFileList = "";
731831

732832
for (File file : objectFiles) {
733-
objectFileList = objectFileList + file.getAbsolutePath() + "::";
833+
objectFileList = objectFileList + file.getAbsolutePath() + ",";
734834
}
735835

736836
Object[] Args = {
@@ -747,8 +847,8 @@ void compileLink(String avrBasePath, String buildPath, String corePath, ArrayLis
747847
corePath,
748848
configPreferences.get("ldscript"),
749849
};
750-
commandString = compileFormat.format( Args );
751-
execAsynchronously(commandString);
850+
String[] commandArray = commandString.split(",");
851+
execAsynchronously(commandArray);
752852
}
753853

754854
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
@@ -769,8 +869,8 @@ void compileEep (String avrBasePath, String buildPath, ArrayList<String> include
769869
buildPath + File.separator + primaryClassName
770870
};
771871
commandString = compileFormat.format( Args );
772-
773-
execAsynchronously(commandString);
872+
String[] commandArray = commandString.split(",");
873+
execAsynchronously(commandArray);
774874
}
775875

776876
// 6. build the .hex file
@@ -790,10 +890,9 @@ void compileHex (String avrBasePath, String buildPath, ArrayList<String> include
790890
buildPath + File.separator + primaryClassName,
791891
buildPath + File.separator + primaryClassName
792892
};
793-
commandString = compileFormat.format( Args );
794-
795-
execAsynchronously(commandString);
796-
893+
commandString = compileFormat.format( Args );
894+
String[] commandArray = commandString.split(",");
895+
execAsynchronously(commandArray);
797896
}
798897

799898

@@ -867,7 +966,7 @@ private static String preparePaths(ArrayList<String> includePaths) {
867966
String includes = "";
868967
for (int i = 0; i < includePaths.size(); i++)
869968
{
870-
includes = includes + (" -I" + (String) includePaths.get(i)) + "::";
969+
includes = includes + (" -I" + (String) includePaths.get(i)) + ",";
871970
}
872971
//logger.debug("Paths prepared: " + includes);
873972
return includes;

hardware/arduino/platforms.txt

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@
22
##compile c object files
33
##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide.
44

5-
#default.recipe.c.o.pattern={0}{1}::{2}::{3}{4}::-DF_CPU={5}::-D{6}={7}::{8}::{9}::-o::{10}
6-
#default.recipe.cpp.o.pattern={0}{1}::{2}::{3}{4}::-DF_CPU={5}::-D{6}={7}::{8}::{9}::-o::{10}
7-
#default.recipe.ar.pattern={0}{1}::{2}::{3}{4}::{5}
8-
#default.recipe.c.combine.pattern={0}{1}::{2}::{3}{4}::-o::{5}{6}.elf::{7}::{8}::-L{9}::-lm
9-
#default.recipe.objcopy.eep.pattern={0}{1}::{2}::{3}.elf::{4}.eep
10-
#default.recipe.objcopy.hex.pattern={0}{1}::{2}::{3}.elf::{4}.hex
5+
#default.recipe.c.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
6+
#default.recipe.cpp.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
7+
#default.recipe.ar.pattern={0}{1},{2},{3}{4},{5}
8+
#default.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7},{8},-L{9},-lm
9+
#default.recipe.objcopy.eep.pattern={0}{1},{2},{3}.elf,{4}.eep
10+
#default.recipe.objcopy.hex.pattern={0}{1},{2},{3}.elf,{4}.hex
1111

1212
########avr compile pattern ##########
1313
#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}
1414
#object name seems to have build path in it.
15-
avr.recipe.c.o.pattern={0}{1}::{2}::{3}{4}::-DF_CPU={5}::-D{6}={7}::{8}::{9}::-o::{10}
15+
avr.recipe.c.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
1616

1717

1818
##compile cc object files
1919
#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}
20-
avr.recipe.cpp.o.pattern={0}{1}::{2}::{3}{4}::-DF_CPU={5}::-D{6}={7}::{8}::{9}::-o::{10}
20+
avr.recipe.cpp.o.pattern={0}{1},{2},{3}{4},-DF_CPU={5},-D{6}={7},{8},{9},-o,{10}
2121
##create archives
2222
#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}
23-
avr.recipe.ar.pattern={0}{1}::{2}::{3}{4}::{5}
23+
avr.recipe.ar.pattern={0}{1},{2},{3}{4},{5}
2424

2525
##combine gc-sections, archives, and objects
2626
#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
27-
#avr.recipe.c.combine.pattern={0}{1}::{2}::{3}{4}::-o::{5}{6}.elf::{7}{8}::{9}::-L{10}::-lm
28-
avr.recipe.c.combine.pattern={0}{1}::{2}::{3}{4}::-o::{5}{6}.elf::{7}::{8}::-L{9}::-lm
27+
#avr.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7}{8},{9},-L{10},-lm
28+
avr.recipe.c.combine.pattern={0}{1},{2},{3}{4},-o,{5}{6}.elf,{7},{8},-L{9},-lm
2929

3030
##create eeprom
3131
#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
32-
avr.recipe.objcopy.eep.pattern={0}{1}::{2}::{3}.elf::{4}.eep
32+
avr.recipe.objcopy.eep.pattern={0}{1},{2},{3}.elf,{4}.eep
3333

3434
##create hex
3535
#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
36-
avr.recipe.objcopy.hex.pattern={0}{1}::{2}::{3}.elf::{4}.hex
36+
avr.recipe.objcopy.hex.pattern={0}{1},{2},{3}.elf,{4}.hex
3737

3838

3939

@@ -42,17 +42,17 @@ avr.name=Arduino
4242
#avr.compiler.path Official default is correct, only need to change this if you want to overide the initial default
4343
#avr.compiler.path={0}/hardware/tools/avr/bin/
4444
avr.compiler.c.cmd=avr-gcc
45-
avr.compiler.c.flags=::-c::-g::-Os::-w::-ffunction-sections::-fdata-sections
46-
avr.compiler.c.elf.flags=::-Os::-Wl,--gc-sections
45+
avr.compiler.c.flags=,-c,-g,-Os,-w,-ffunction-sections,-fdata-sections
46+
avr.compiler.c.elf.flags=,-Os,-Wl,--gc-sections
4747
avr.compiler.c.elf.cmd=avr-gcc
48-
avr.compiler.S.flags=::-c::-g::-assembler-with-cpp
48+
avr.compiler.S.flags=,-c,-g,-assembler-with-cpp
4949
avr.compiler.cpp.cmd=avr-g++
50-
avr.compiler.cpp.flags=::-c::-g::-Os::-w::-fno-exceptions::-ffunction-sections::-fdata-sections
50+
avr.compiler.cpp.flags=,-c,-g,-Os,-w,-fno-exceptions,-ffunction-sections,-fdata-sections
5151
avr.compiler.ar.cmd=avr-ar
5252
avr.compiler.ar.flags=rcs
5353
avr.compiler.objcopy.cmd=avr-objcopy
54-
avr.compiler.objcopy.eep.flags=::-O::ihex::-j::.eeprom::--set-section-flags=.eeprom=alloc,load::--no-change-warnings::--change-section-lma::.eeprom=0
55-
avr.compiler.elf2hex.flags=::-O::ihex::-R::.eeprom
54+
avr.compiler.objcopy.eep.flags=,-O,ihex,-j,.eeprom,--set-section-flags=.eeprom=alloc,load,--no-change-warnings,--change-section-lma,.eeprom=0
55+
avr.compiler.elf2hex.flags=,-O,ihex,-R,.eeprom
5656
avr.compiler.elf2hex.cmd=avr-objcopy
5757
avr.compiler.ldflags=
5858
avr.compiler.cpudef=-mmcu=

0 commit comments

Comments
 (0)