diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 14a7377c343..4eb10599008 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -23,18 +23,26 @@ package processing.app.debug; +import static processing.app.I18n._; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + import processing.app.Base; +import processing.app.I18n; import processing.app.Preferences; import processing.app.Sketch; import processing.app.SketchCode; -import processing.core.*; -import processing.app.I18n; import processing.app.helpers.filefilters.OnlyDirs; -import static processing.app.I18n._; - -import java.io.*; -import java.util.*; -import java.util.zip.*; +import processing.core.PApplet; public class Compiler implements MessageConsumer { @@ -63,20 +71,42 @@ public Compiler() { } * @throws RunnerException Only if there's a problem. Only then. */ public boolean compile(Sketch sketch, + String buildPath, + String primaryClassName, + boolean verbose) throws RunnerException { + Map boardPreferences = Base.getBoardPreferences(); + + if (!Preferences.get("board").equals("buildall")) { + return compileForBoard(sketch, buildPath, primaryClassName, verbose, primaryClassName, boardPreferences); + } + + boolean compileOk = true; + for (Entry> board : Base.getTarget().getBoards().entrySet()) { + if (!compileForBoard(sketch, buildPath, primaryClassName, verbose, board.getKey(), board.getValue())) { + compileOk = false; + } + } + + return compileOk; + } + + private boolean compileForBoard(Sketch sketch, String buildPath, String primaryClassName, - boolean verbose) throws RunnerException { + boolean verbose, + String nameOfHex, + Map boardPreferences) throws RunnerException { this.sketch = sketch; this.buildPath = buildPath; this.primaryClassName = primaryClassName; this.verbose = verbose; this.sketchIsCompiled = false; - + // the pms object isn't used for anything but storage MessageStream pms = new MessageStream(this); String avrBasePath = Base.getAvrBasePath(); - Map boardPreferences = Base.getBoardPreferences(); + String core = boardPreferences.get("build.core"); if (core == null) { RunnerException re = new RunnerException(_("No board selected; please choose a board from the Tools > Board menu.")); @@ -268,7 +298,8 @@ public boolean compile(Sketch sketch, commandObjcopy.add(2, "ihex"); commandObjcopy.add(".eeprom"); // remove eeprom data commandObjcopy.add(buildPath + File.separator + primaryClassName + ".elf"); - commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex"); + commandObjcopy.add(buildPath + File.separator + nameOfHex + ".hex"); + execAsynchronously(commandObjcopy); sketch.setCompilingProgress(90); diff --git a/hardware/arduino/boards.txt b/hardware/arduino/boards.txt index fc29ee4f9db..613d2f02851 100644 --- a/hardware/arduino/boards.txt +++ b/hardware/arduino/boards.txt @@ -1,5 +1,24 @@ # See: http://code.google.com/p/arduino/wiki/Platforms +############################################################# + +buildall.name=Build all boards/Upload as Mega 2560 +buildall.upload.protocol=arduino +buildall.upload.protocol=wiring +buildall.upload.maximum_size=258048 +buildall.upload.speed=115200 +buildall.bootloader.low_fuses=0xFF +buildall.bootloader.high_fuses=0xD8 +buildall.bootloader.extended_fuses=0xFD +buildall.bootloader.path=stk500v2 +buildall.bootloader.file=stk500boot_v2_mega2560.hex +buildall.bootloader.unlock_bits=0x3F +buildall.bootloader.lock_bits=0x0F +buildall.build.mcu=atmega2560 +buildall.build.f_cpu=16000000L +buildall.build.core=arduino +buildall.build.variant=mega + ############################################################## uno.name=Arduino Uno