Skip to content

Commit e63c2d1

Browse files
committed
Various post-merge refinements.
1 parent 65c15d9 commit e63c2d1

File tree

4 files changed

+25
-34
lines changed

4 files changed

+25
-34
lines changed

app/src/processing/app/Base.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,12 +1654,11 @@ static public Map<String, String> bogusgetBoardPreferences() {
16541654

16551655
static public Map<String, String> getBoardPreferences() {
16561656
Target target = getTarget();
1657-
Map map = new LinkedHashMap();
16581657
if (target != null) {
1659-
map = target.getBoards();
1660-
map = (Map) map.get(Preferences.get("board"));
1658+
String board = Preferences.get("board");
1659+
return target.getBoards().get(board);
16611660
}
1662-
return map;
1661+
return new HashMap<String, String>();
16631662
}
16641663

16651664
static public File getSketchbookFolder() {

app/src/processing/app/debug/AvrdudeUploader.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@
2828

2929
import processing.app.Base;
3030
import processing.app.Preferences;
31-
import processing.app.Serial;
3231
import processing.app.SerialException;
3332

3433
import java.io.*;
3534
import java.util.*;
36-
import java.util.zip.*;
37-
import javax.swing.*;
38-
import gnu.io.*;
3935

4036

4137
public class AvrdudeUploader extends Uploader {
@@ -44,7 +40,6 @@ public AvrdudeUploader() {
4440

4541
public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer)
4642
throws RunnerException, SerialException {
47-
this.verbose = verbose;
4843
Map<String, String> boardPreferences = Base.getBoardPreferences();
4944

5045
// if no protocol is specified for this board, assume it lacks a

app/src/processing/app/debug/Compiler.java

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
import java.io.*;
3535
import java.util.*;
36-
import java.util.zip.*;
3736
import java.text.MessageFormat;
3837

3938

@@ -54,7 +53,6 @@ public class Compiler implements MessageConsumer {
5453
RunnerException exception;
5554

5655
HashMap<String, String> configPreferences;
57-
HashMap<String, String> boardPreferences;
5856
HashMap<String, String> platformPreferences;
5957

6058
String avrBasePath;
@@ -84,8 +82,6 @@ public boolean compile(Sketch sketch,
8482
this.verbose = verbose;
8583
objectFiles = new ArrayList<File>();
8684

87-
// the pms object isn't used for anything but storage
88-
MessageStream pms = new MessageStream(this);
8985
Map<String, String> boardPreferences = Base.getBoardPreferences();
9086

9187
//Check for null platform, and use system default if not found
@@ -153,25 +149,20 @@ public boolean compile(Sketch sketch,
153149
String variant = boardPreferences.get("build.variant");
154150
String variantPath = null;
155151

156-
String pins = configPreferences.get("build.pins");
157-
String pinsPath = null;
158-
159152
if (variant != null) {
160153
if (variant.indexOf(':') == -1) {
161-
Target t = Base.getTarget();
162-
File variantFolder = new File(new File(t.getFolder(), "variants"), variant);
163-
variantPath = variantFolder.getAbsolutePath();
154+
Target t = Base.getTarget();
155+
File variantFolder = new File(new File(t.getFolder(), "variants"), variant);
156+
variantPath = variantFolder.getAbsolutePath();
164157
} else {
165-
Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':')));
166-
File variantFolder = new File(t.getFolder(), "variants");
167-
variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1));
168-
variantPath = variantFolder.getAbsolutePath();
158+
Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':')));
159+
File variantFolder = new File(t.getFolder(), "variants");
160+
variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1));
161+
variantPath = variantFolder.getAbsolutePath();
169162
}
170163
}
171164

172-
173165
// 0. include paths for core + all libraries
174-
175166
sketch.setCompilingProgress(20);
176167
ArrayList<String> includePaths = new ArrayList<String>();
177168
includePaths.add(corePath);
@@ -224,7 +215,7 @@ public boolean compile(Sketch sketch,
224215
System.out.println("3. compileCore");
225216
System.out.println("corePath: " + corePath);
226217
sketch.setCompilingProgress(50);
227-
compileCore(avrBasePath, buildPath, corePath, pins, pinsPath, configPreferences);
218+
compileCore(avrBasePath, buildPath, corePath, variant, variantPath, configPreferences);
228219

229220

230221
/*
@@ -859,7 +850,9 @@ void compileSketch(String avrBasePath, String buildPath, ArrayList<String> inclu
859850

860851
// 2. compile the libraries, outputting .o files to:
861852
// <buildPath>/<library>/
862-
void compileLibraries (String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
853+
void compileLibraries (String avrBasePath, String buildPath,
854+
ArrayList<String> includePaths,
855+
HashMap<String, String> configPreferences)
863856
throws RunnerException
864857
{
865858
System.out.println("compileLibraries: start");
@@ -883,30 +876,32 @@ void compileLibraries (String avrBasePath, String buildPath, ArrayList<String> i
883876
findFilesInFolder(libraryFolder, "S", false),
884877
findFilesInFolder(libraryFolder, "c", false),
885878
findFilesInFolder(libraryFolder, "cpp", false),
886-
boardPreferences));
879+
configPreferences));
887880
outputFolder = new File(outputFolder, "utility");
888881
createFolder(outputFolder);
889882
objectFiles.addAll(
890883
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
891884
findFilesInFolder(utilityFolder, "S", false),
892885
findFilesInFolder(utilityFolder, "c", false),
893886
findFilesInFolder(utilityFolder, "cpp", false),
894-
boardPreferences));
887+
configPreferences));
895888
// other libraries should not see this library's utility/ folder
896889
includePaths.remove(includePaths.size() - 1);
897890
}
898891
}
899892

900893
// 3. compile the core, outputting .o files to <buildPath> and then
901894
// collecting them into the core.a library file.
902-
void compileCore (String avrBasePath, String buildPath, String corePath, String pins, String pinsPath, HashMap<String, String> configPreferences)
895+
void compileCore (String avrBasePath, String buildPath,
896+
String corePath, String variant, String variantPath,
897+
HashMap<String, String> configPreferences)
903898
throws RunnerException
904899
{
905900
System.out.println("compileCore(...) start");
906901

907902
ArrayList<String> includePaths = new ArrayList();
908903
includePaths.add(corePath); //include core path only
909-
if (pinsPath != null) includePaths.add(pinsPath);
904+
if (variantPath != null) includePaths.add(variantPath);
910905

911906
//debug includePaths
912907
System.out.println("includePaths: ");
@@ -952,13 +947,15 @@ void compileCore (String avrBasePath, String buildPath, String corePath, String
952947
}
953948

954949
// 4. link it all together into the .elf file
955-
void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList<String> includePaths, HashMap<String, String> configPreferences)
950+
void compileLink(String avrBasePath, String buildPath,
951+
String corePath, ArrayList<String> includePaths,
952+
HashMap<String, String> configPreferences)
956953
throws RunnerException
957954
{
958955
// For atmega2560, need --relax linker option to link larger
959956
// programs correctly.
960957
String optRelax = "";
961-
if (boardPreferences.get("build.mcu").equals("atmega2560"))
958+
if (configPreferences.get("build.mcu").equals("atmega2560"))
962959
optRelax = ",--relax";
963960

964961
System.out.println("compileLink: start");

hardware/arduino/boards.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
uno.name=Arduino Uno
44
uno.platform=avr
5-
uno.upload.protocol=stk500
5+
uno.upload.protocol=arduino
66
uno.upload.maximum_size=32256
77
uno.upload.speed=115200
88
uno.bootloader.low_fuses=0xff

0 commit comments

Comments
 (0)