From e63c2d1429b5d7421c6da4d12e2bae92fb201d60 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 22 Dec 2011 13:07:39 +0100 Subject: [PATCH] Various post-merge refinements. --- app/src/processing/app/Base.java | 7 ++- .../processing/app/debug/AvrdudeUploader.java | 5 --- app/src/processing/app/debug/Compiler.java | 45 +++++++++---------- hardware/arduino/boards.txt | 2 +- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 23aabc575..1585b21d0 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1654,12 +1654,11 @@ static public Map getPlatformPreferences() { static public Map getBoardPreferences() { Target target = getTarget(); - Map map = new LinkedHashMap(); if (target != null) { - map = target.getBoards(); - map = (Map) map.get(Preferences.get("board")); + String board = Preferences.get("board"); + return target.getBoards().get(board); } - return map; + return new HashMap(); } static public File getSketchbookFolder() { diff --git a/app/src/processing/app/debug/AvrdudeUploader.java b/app/src/processing/app/debug/AvrdudeUploader.java index d5db258ad..c3536d1ca 100755 --- a/app/src/processing/app/debug/AvrdudeUploader.java +++ b/app/src/processing/app/debug/AvrdudeUploader.java @@ -28,14 +28,10 @@ package processing.app.debug; import processing.app.Base; import processing.app.Preferences; -import processing.app.Serial; import processing.app.SerialException; import java.io.*; import java.util.*; -import java.util.zip.*; -import javax.swing.*; -import gnu.io.*; public class AvrdudeUploader extends Uploader { @@ -44,7 +40,6 @@ public class AvrdudeUploader extends Uploader { public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer) throws RunnerException, SerialException { - this.verbose = verbose; Map boardPreferences = Base.getBoardPreferences(); // if no protocol is specified for this board, assume it lacks a diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index ecaf38048..93bf02b99 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -33,7 +33,6 @@ import static processing.app.I18n._; import java.io.*; import java.util.*; -import java.util.zip.*; import java.text.MessageFormat; @@ -54,7 +53,6 @@ public class Compiler implements MessageConsumer { RunnerException exception; HashMap configPreferences; - HashMap boardPreferences; HashMap platformPreferences; String avrBasePath; @@ -84,8 +82,6 @@ public class Compiler implements MessageConsumer { this.verbose = verbose; objectFiles = new ArrayList(); - // the pms object isn't used for anything but storage - MessageStream pms = new MessageStream(this); Map boardPreferences = Base.getBoardPreferences(); //Check for null platform, and use system default if not found @@ -153,25 +149,20 @@ public class Compiler implements MessageConsumer { String variant = boardPreferences.get("build.variant"); String variantPath = null; - String pins = configPreferences.get("build.pins"); - String pinsPath = null; - if (variant != null) { if (variant.indexOf(':') == -1) { - Target t = Base.getTarget(); - File variantFolder = new File(new File(t.getFolder(), "variants"), variant); - variantPath = variantFolder.getAbsolutePath(); + Target t = Base.getTarget(); + File variantFolder = new File(new File(t.getFolder(), "variants"), variant); + variantPath = variantFolder.getAbsolutePath(); } else { - Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':'))); - File variantFolder = new File(t.getFolder(), "variants"); - variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1)); - variantPath = variantFolder.getAbsolutePath(); + Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':'))); + File variantFolder = new File(t.getFolder(), "variants"); + variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1)); + variantPath = variantFolder.getAbsolutePath(); } } - // 0. include paths for core + all libraries - sketch.setCompilingProgress(20); ArrayList includePaths = new ArrayList(); includePaths.add(corePath); @@ -224,7 +215,7 @@ public class Compiler implements MessageConsumer { System.out.println("3. compileCore"); System.out.println("corePath: " + corePath); sketch.setCompilingProgress(50); - compileCore(avrBasePath, buildPath, corePath, pins, pinsPath, configPreferences); + compileCore(avrBasePath, buildPath, corePath, variant, variantPath, configPreferences); /* @@ -859,7 +850,9 @@ public class Compiler implements MessageConsumer { // 2. compile the libraries, outputting .o files to: // // - void compileLibraries (String avrBasePath, String buildPath, ArrayList includePaths, HashMap configPreferences) + void compileLibraries (String avrBasePath, String buildPath, + ArrayList includePaths, + HashMap configPreferences) throws RunnerException { System.out.println("compileLibraries: start"); @@ -883,7 +876,7 @@ public class Compiler implements MessageConsumer { findFilesInFolder(libraryFolder, "S", false), findFilesInFolder(libraryFolder, "c", false), findFilesInFolder(libraryFolder, "cpp", false), - boardPreferences)); + configPreferences)); outputFolder = new File(outputFolder, "utility"); createFolder(outputFolder); objectFiles.addAll( @@ -891,7 +884,7 @@ public class Compiler implements MessageConsumer { findFilesInFolder(utilityFolder, "S", false), findFilesInFolder(utilityFolder, "c", false), findFilesInFolder(utilityFolder, "cpp", false), - boardPreferences)); + configPreferences)); // other libraries should not see this library's utility/ folder includePaths.remove(includePaths.size() - 1); } @@ -899,14 +892,16 @@ public class Compiler implements MessageConsumer { // 3. compile the core, outputting .o files to and then // collecting them into the core.a library file. - void compileCore (String avrBasePath, String buildPath, String corePath, String pins, String pinsPath, HashMap configPreferences) + void compileCore (String avrBasePath, String buildPath, + String corePath, String variant, String variantPath, + HashMap configPreferences) throws RunnerException { System.out.println("compileCore(...) start"); ArrayList includePaths = new ArrayList(); includePaths.add(corePath); //include core path only - if (pinsPath != null) includePaths.add(pinsPath); + if (variantPath != null) includePaths.add(variantPath); //debug includePaths System.out.println("includePaths: "); @@ -952,13 +947,15 @@ public class Compiler implements MessageConsumer { } // 4. link it all together into the .elf file - void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList includePaths, HashMap configPreferences) + void compileLink(String avrBasePath, String buildPath, + String corePath, ArrayList includePaths, + HashMap configPreferences) throws RunnerException { // For atmega2560, need --relax linker option to link larger // programs correctly. String optRelax = ""; - if (boardPreferences.get("build.mcu").equals("atmega2560")) + if (configPreferences.get("build.mcu").equals("atmega2560")) optRelax = ",--relax"; System.out.println("compileLink: start"); diff --git a/hardware/arduino/boards.txt b/hardware/arduino/boards.txt index 942ffe07c..d6acbf682 100644 --- a/hardware/arduino/boards.txt +++ b/hardware/arduino/boards.txt @@ -2,7 +2,7 @@ uno.name=Arduino Uno uno.platform=avr -uno.upload.protocol=stk500 +uno.upload.protocol=arduino uno.upload.maximum_size=32256 uno.upload.speed=115200 uno.bootloader.low_fuses=0xff