@@ -229,6 +229,53 @@ public boolean compile(Sketch sketch,
229
229
execAsynchronously (commandObjcopy );
230
230
231
231
return true ;
232
+ /*
233
+
234
+ logger.debug("corePaths: " + this.corePath);
235
+
236
+
237
+ this.objectFiles = new ArrayList<File>();
238
+
239
+ // 0. include paths for core + all libraries
240
+ logger.debug("0. getIncludes");
241
+ this.includePaths = getIncludes(this.corePath);
242
+
243
+ // 1. compile the sketch (already in the buildPath)
244
+ logger.debug("1. compileSketch");
245
+ compileSketch(avrBasePath, buildPath, includePaths, configPreferences);
246
+
247
+ // 2. compile the libraries, outputting .o files to:
248
+ // <buildPath>/<library>/
249
+ //Doesn't really use configPreferences
250
+ logger.debug("2. compileLibraries");
251
+ compileLibraries(avrBasePath, buildPath, includePaths, configPreferences);
252
+
253
+ // 3. compile the core, outputting .o files to <buildPath> and then
254
+ // collecting them into the core.a library file.
255
+ logger.debug("3. compileCore");
256
+ compileCore(avrBasePath, buildPath, this.corePath, configPreferences);
257
+
258
+ // 4. link it all together into the .elf file
259
+ logger.debug("4. compileLink");
260
+ compileLink(avrBasePath, buildPath, this.corePath, includePaths, configPreferences);
261
+
262
+ // 5. extract EEPROM data (from EEMEM directive) to .eep file.
263
+ logger.debug("5. compileEep");
264
+ compileEep(avrBasePath, buildPath, includePaths, configPreferences);
265
+
266
+ // 6. build the .hex file
267
+ logger.debug("6. compileHex");
268
+ compileHex(avrBasePath, buildPath, includePaths, configPreferences);
269
+
270
+ //done
271
+ logger.debug("7. compile done");
272
+ return true;
273
+
274
+
275
+
276
+ */
277
+
278
+
232
279
}
233
280
234
281
@@ -531,4 +578,81 @@ static public ArrayList<File> findFilesInFolder(File folder, String extension,
531
578
532
579
return files ;
533
580
}
581
+
582
+
583
+ //merge all the preferences file in the correct order of precedence
584
+ HashMap mergePreferences (Map Preferences , Map platformPreferences , Map boardPreferences )
585
+ {
586
+ HashMap _map = new HashMap ();
587
+
588
+ Iterator iterator = Preferences .entrySet ().iterator ();
589
+
590
+ while (iterator .hasNext ())
591
+ {
592
+ Map .Entry pair = (Map .Entry )iterator .next ();
593
+ if (pair .getValue () == null )
594
+ {
595
+ _map .put (pair .getKey (), "" );
596
+ }
597
+ else
598
+ {
599
+ _map .put (pair .getKey (), pair .getValue ());
600
+ }
601
+ }
602
+
603
+ //logger.debug("Done: Preferences");
604
+
605
+ iterator = platformPreferences .entrySet ().iterator ();
606
+
607
+ while (iterator .hasNext ())
608
+ {
609
+ Map .Entry pair = (Map .Entry )iterator .next ();
610
+
611
+ if (pair .getValue () == null )
612
+ {
613
+ _map .put (pair .getKey (), "" );
614
+ }
615
+ else
616
+ {
617
+ _map .put (pair .getKey (), pair .getValue ());
618
+ }
619
+ //System.out.println(pair.getKey() + " = " + pair.getValue());
620
+ }
621
+
622
+ //System.out.println("Done: platformPreferences");
623
+ iterator = boardPreferences .entrySet ().iterator ();
624
+
625
+ while (iterator .hasNext ())
626
+ {
627
+ Map .Entry pair = (Map .Entry )iterator .next ();
628
+
629
+ if (pair .getValue () == null )
630
+ {
631
+ _map .put (pair .getKey (), "" );
632
+ }
633
+ else
634
+ {
635
+ _map .put (pair .getKey (), pair .getValue ());
636
+ }
637
+ //System.out.println(pair.getKey() + " = " + pair.getValue());
638
+ }
639
+ //System.out.println("Done: boardPreferences");
640
+
641
+
642
+ return _map ;
643
+ }
644
+
645
+ private static String preparePaths (ArrayList <String > includePaths ) {
646
+ //getIncludes to String
647
+ //logger.debug("Start: Prepare paths");
648
+ String includes = "" ;
649
+ for (int i = 0 ; i < includePaths .size (); i ++)
650
+ {
651
+ includes = includes + (" -I" + (String ) includePaths .get (i )) + "::" ;
652
+ }
653
+ //logger.debug("Paths prepared: " + includes);
654
+ return includes ;
655
+ }
656
+
657
+
534
658
}
0 commit comments