Skip to content

One click compile all known boards #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions app/src/processing/app/debug/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<String, String> boardPreferences = Base.getBoardPreferences();

if (!Preferences.get("board").equals("buildall")) {
return compileForBoard(sketch, buildPath, primaryClassName, verbose, primaryClassName, boardPreferences);
}

boolean compileOk = true;
for (Entry<String, Map<String, String>> 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<String, String> 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<String, String> 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."));
Expand Down Expand Up @@ -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);
Expand Down
19 changes: 19 additions & 0 deletions hardware/arduino/boards.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down