@@ -209,7 +209,7 @@ public boolean compile(Sketch sketch,
209
209
210
210
// 3. compile the core, outputting .o files to <buildPath> and then
211
211
// collecting them into the core.a library file.
212
-
212
+ /*
213
213
includePaths.clear();
214
214
includePaths.add(corePath); // include path for core only
215
215
if (pinsPath != null) includePaths.add(pinsPath);
@@ -231,9 +231,9 @@ public boolean compile(Sketch sketch,
231
231
commandAR.add(file.getAbsolutePath());
232
232
execAsynchronously(commandAR);
233
233
}
234
-
234
+ */
235
235
// 4. link it all together into the .elf file
236
-
236
+ /*
237
237
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
238
238
avrBasePath + "avr-gcc",
239
239
"-Os",
@@ -260,8 +260,10 @@ public boolean compile(Sketch sketch,
260
260
}));
261
261
262
262
List commandObjcopy;
263
+ */
263
264
264
265
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
266
+ /*
265
267
commandObjcopy = new ArrayList(baseCommandObjcopy);
266
268
commandObjcopy.add(2, "ihex");
267
269
commandObjcopy.set(3, "-j");
@@ -281,6 +283,7 @@ public boolean compile(Sketch sketch,
281
283
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf");
282
284
commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex");
283
285
execAsynchronously(commandObjcopy);
286
+ */
284
287
285
288
return true ;
286
289
/*
@@ -348,7 +351,7 @@ private List<File> compileFiles(String avrBasePath,
348
351
execAsynchronously (getCommandCompilerS (avrBasePath , includePaths ,
349
352
file .getAbsolutePath (),
350
353
objectPath ,
351
- boardPreferences ));
354
+ configPreferences ));
352
355
}
353
356
354
357
for (File file : cSources ) {
@@ -357,7 +360,7 @@ private List<File> compileFiles(String avrBasePath,
357
360
execAsynchronously (getCommandCompilerC (avrBasePath , includePaths ,
358
361
file .getAbsolutePath (),
359
362
objectPath ,
360
- boardPreferences ));
363
+ configPreferences ));
361
364
}
362
365
363
366
for (File file : cppSources ) {
@@ -366,7 +369,7 @@ private List<File> compileFiles(String avrBasePath,
366
369
execAsynchronously (getCommandCompilerCPP (avrBasePath , includePaths ,
367
370
file .getAbsolutePath (),
368
371
objectPath ,
369
- boardPreferences ));
372
+ configPreferences ));
370
373
}
371
374
372
375
return objectPaths ;
@@ -379,9 +382,9 @@ private List<File> compileFiles(String avrBasePath,
379
382
/**
380
383
* Either succeeds or throws a RunnerException fit for public consumption.
381
384
*/
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);
385
388
int result = 0 ;
386
389
387
390
if (verbose || Preferences .getBoolean ("build.verbose" )) {
@@ -504,7 +507,7 @@ public void message(String s) {
504
507
}
505
508
506
509
/////////////////////////////////////////////////////////////////////////////
507
-
510
+ /*
508
511
static private List getCommandCompilerS(String avrBasePath, List includePaths,
509
512
String sourceName, String objectName, Map<String, String> boardPreferences) {
510
513
List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
@@ -526,7 +529,39 @@ static private List getCommandCompilerS(String avrBasePath, List includePaths,
526
529
527
530
return baseCommandCompiler;
528
531
}
532
+ */
529
533
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
+ /*
530
565
531
566
static private List getCommandCompilerC(String avrBasePath, List includePaths,
532
567
String sourceName, String objectName, Map<String, String> boardPreferences) {
@@ -553,7 +588,38 @@ static private List getCommandCompilerC(String avrBasePath, List includePaths,
553
588
554
589
return baseCommandCompiler;
555
590
}
591
+ */
556
592
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
+ /*
557
623
558
624
static private List getCommandCompilerCPP(String avrBasePath,
559
625
List includePaths, String sourceName, String objectName,
@@ -582,7 +648,37 @@ static private List getCommandCompilerCPP(String avrBasePath,
582
648
583
649
return baseCommandCompilerCPP;
584
650
}
651
+ */
585
652
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
+ }
586
682
587
683
588
684
/////////////////////////////////////////////////////////////////////////////
@@ -714,8 +810,12 @@ void compileCore (String avrBasePath, String buildPath, String corePath, HashMap
714
810
//objectName
715
811
file .getAbsolutePath ()
716
812
};
813
+
717
814
commandString = compileFormat .format ( Args );
718
- execAsynchronously (commandString );
815
+ String [] commandArray = commandString .split ("," );
816
+ execAsynchronously (commandArray );
817
+
818
+
719
819
}
720
820
}
721
821
@@ -730,7 +830,7 @@ void compileLink(String avrBasePath, String buildPath, String corePath, ArrayLis
730
830
String objectFileList = "" ;
731
831
732
832
for (File file : objectFiles ) {
733
- objectFileList = objectFileList + file .getAbsolutePath () + ":: " ;
833
+ objectFileList = objectFileList + file .getAbsolutePath () + ", " ;
734
834
}
735
835
736
836
Object [] Args = {
@@ -747,8 +847,8 @@ void compileLink(String avrBasePath, String buildPath, String corePath, ArrayLis
747
847
corePath ,
748
848
configPreferences .get ("ldscript" ),
749
849
};
750
- commandString = compileFormat . format ( Args );
751
- execAsynchronously (commandString );
850
+ String [] commandArray = commandString . split ( "," );
851
+ execAsynchronously (commandArray );
752
852
}
753
853
754
854
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
@@ -769,8 +869,8 @@ void compileEep (String avrBasePath, String buildPath, ArrayList<String> include
769
869
buildPath + File .separator + primaryClassName
770
870
};
771
871
commandString = compileFormat .format ( Args );
772
-
773
- execAsynchronously (commandString );
872
+ String [] commandArray = commandString . split ( "," );
873
+ execAsynchronously (commandArray );
774
874
}
775
875
776
876
// 6. build the .hex file
@@ -790,10 +890,9 @@ void compileHex (String avrBasePath, String buildPath, ArrayList<String> include
790
890
buildPath + File .separator + primaryClassName ,
791
891
buildPath + File .separator + primaryClassName
792
892
};
793
- commandString = compileFormat .format ( Args );
794
-
795
- execAsynchronously (commandString );
796
-
893
+ commandString = compileFormat .format ( Args );
894
+ String [] commandArray = commandString .split ("," );
895
+ execAsynchronously (commandArray );
797
896
}
798
897
799
898
@@ -867,7 +966,7 @@ private static String preparePaths(ArrayList<String> includePaths) {
867
966
String includes = "" ;
868
967
for (int i = 0 ; i < includePaths .size (); i ++)
869
968
{
870
- includes = includes + (" -I" + (String ) includePaths .get (i )) + ":: " ;
969
+ includes = includes + (" -I" + (String ) includePaths .get (i )) + ", " ;
871
970
}
872
971
//logger.debug("Paths prepared: " + includes);
873
972
return includes ;
0 commit comments