1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-14 11:29:26 +01:00

Various post-merge refinements.

This commit is contained in:
Cristian Maglie 2011-12-22 13:07:39 +01:00
parent 65c15d93eb
commit e63c2d1429
4 changed files with 25 additions and 34 deletions

View File

@ -1654,12 +1654,11 @@ static public Map<String, String> getPlatformPreferences() {
static public Map<String, String> getBoardPreferences() { static public Map<String, String> getBoardPreferences() {
Target target = getTarget(); Target target = getTarget();
Map map = new LinkedHashMap();
if (target != null) { if (target != null) {
map = target.getBoards(); String board = Preferences.get("board");
map = (Map) map.get(Preferences.get("board")); return target.getBoards().get(board);
} }
return map; return new HashMap<String, String>();
} }
static public File getSketchbookFolder() { static public File getSketchbookFolder() {

View File

@ -28,14 +28,10 @@ package processing.app.debug;
import processing.app.Base; import processing.app.Base;
import processing.app.Preferences; import processing.app.Preferences;
import processing.app.Serial;
import processing.app.SerialException; import processing.app.SerialException;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.zip.*;
import javax.swing.*;
import gnu.io.*;
public class AvrdudeUploader extends Uploader { public class AvrdudeUploader extends Uploader {
@ -44,7 +40,6 @@ public class AvrdudeUploader extends Uploader {
public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer) public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer)
throws RunnerException, SerialException { throws RunnerException, SerialException {
this.verbose = verbose;
Map<String, String> boardPreferences = Base.getBoardPreferences(); Map<String, String> boardPreferences = Base.getBoardPreferences();
// if no protocol is specified for this board, assume it lacks a // if no protocol is specified for this board, assume it lacks a

View File

@ -33,7 +33,6 @@ import static processing.app.I18n._;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.zip.*;
import java.text.MessageFormat; import java.text.MessageFormat;
@ -54,7 +53,6 @@ public class Compiler implements MessageConsumer {
RunnerException exception; RunnerException exception;
HashMap<String, String> configPreferences; HashMap<String, String> configPreferences;
HashMap<String, String> boardPreferences;
HashMap<String, String> platformPreferences; HashMap<String, String> platformPreferences;
String avrBasePath; String avrBasePath;
@ -84,8 +82,6 @@ public class Compiler implements MessageConsumer {
this.verbose = verbose; this.verbose = verbose;
objectFiles = new ArrayList<File>(); objectFiles = new ArrayList<File>();
// the pms object isn't used for anything but storage
MessageStream pms = new MessageStream(this);
Map<String, String> boardPreferences = Base.getBoardPreferences(); Map<String, String> boardPreferences = Base.getBoardPreferences();
//Check for null platform, and use system default if not found //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 variant = boardPreferences.get("build.variant");
String variantPath = null; String variantPath = null;
String pins = configPreferences.get("build.pins");
String pinsPath = null;
if (variant != null) { if (variant != null) {
if (variant.indexOf(':') == -1) { if (variant.indexOf(':') == -1) {
Target t = Base.getTarget(); Target t = Base.getTarget();
File variantFolder = new File(new File(t.getFolder(), "variants"), variant); File variantFolder = new File(new File(t.getFolder(), "variants"), variant);
variantPath = variantFolder.getAbsolutePath(); variantPath = variantFolder.getAbsolutePath();
} else { } else {
Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':'))); Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':')));
File variantFolder = new File(t.getFolder(), "variants"); File variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1)); variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1));
variantPath = variantFolder.getAbsolutePath(); variantPath = variantFolder.getAbsolutePath();
} }
} }
// 0. include paths for core + all libraries // 0. include paths for core + all libraries
sketch.setCompilingProgress(20); sketch.setCompilingProgress(20);
ArrayList<String> includePaths = new ArrayList<String>(); ArrayList<String> includePaths = new ArrayList<String>();
includePaths.add(corePath); includePaths.add(corePath);
@ -224,7 +215,7 @@ public class Compiler implements MessageConsumer {
System.out.println("3. compileCore"); System.out.println("3. compileCore");
System.out.println("corePath: " + corePath); System.out.println("corePath: " + corePath);
sketch.setCompilingProgress(50); 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: // 2. compile the libraries, outputting .o files to:
// <buildPath>/<library>/ // <buildPath>/<library>/
void compileLibraries (String avrBasePath, String buildPath, ArrayList<String> includePaths, HashMap<String, String> configPreferences) void compileLibraries (String avrBasePath, String buildPath,
ArrayList<String> includePaths,
HashMap<String, String> configPreferences)
throws RunnerException throws RunnerException
{ {
System.out.println("compileLibraries: start"); System.out.println("compileLibraries: start");
@ -883,7 +876,7 @@ public class Compiler implements MessageConsumer {
findFilesInFolder(libraryFolder, "S", false), findFilesInFolder(libraryFolder, "S", false),
findFilesInFolder(libraryFolder, "c", false), findFilesInFolder(libraryFolder, "c", false),
findFilesInFolder(libraryFolder, "cpp", false), findFilesInFolder(libraryFolder, "cpp", false),
boardPreferences)); configPreferences));
outputFolder = new File(outputFolder, "utility"); outputFolder = new File(outputFolder, "utility");
createFolder(outputFolder); createFolder(outputFolder);
objectFiles.addAll( objectFiles.addAll(
@ -891,7 +884,7 @@ public class Compiler implements MessageConsumer {
findFilesInFolder(utilityFolder, "S", false), findFilesInFolder(utilityFolder, "S", false),
findFilesInFolder(utilityFolder, "c", false), findFilesInFolder(utilityFolder, "c", false),
findFilesInFolder(utilityFolder, "cpp", false), findFilesInFolder(utilityFolder, "cpp", false),
boardPreferences)); configPreferences));
// other libraries should not see this library's utility/ folder // other libraries should not see this library's utility/ folder
includePaths.remove(includePaths.size() - 1); includePaths.remove(includePaths.size() - 1);
} }
@ -899,14 +892,16 @@ public class Compiler implements MessageConsumer {
// 3. compile the core, outputting .o files to <buildPath> and then // 3. compile the core, outputting .o files to <buildPath> and then
// collecting them into the core.a library file. // collecting them into the core.a library file.
void compileCore (String avrBasePath, String buildPath, String corePath, String pins, String pinsPath, HashMap<String, String> configPreferences) void compileCore (String avrBasePath, String buildPath,
String corePath, String variant, String variantPath,
HashMap<String, String> configPreferences)
throws RunnerException throws RunnerException
{ {
System.out.println("compileCore(...) start"); System.out.println("compileCore(...) start");
ArrayList<String> includePaths = new ArrayList(); ArrayList<String> includePaths = new ArrayList();
includePaths.add(corePath); //include core path only includePaths.add(corePath); //include core path only
if (pinsPath != null) includePaths.add(pinsPath); if (variantPath != null) includePaths.add(variantPath);
//debug includePaths //debug includePaths
System.out.println("includePaths: "); System.out.println("includePaths: ");
@ -952,13 +947,15 @@ public class Compiler implements MessageConsumer {
} }
// 4. link it all together into the .elf file // 4. link it all together into the .elf file
void compileLink(String avrBasePath, String buildPath, String corePath, ArrayList<String> includePaths, HashMap<String, String> configPreferences) void compileLink(String avrBasePath, String buildPath,
String corePath, ArrayList<String> includePaths,
HashMap<String, String> configPreferences)
throws RunnerException throws RunnerException
{ {
// For atmega2560, need --relax linker option to link larger // For atmega2560, need --relax linker option to link larger
// programs correctly. // programs correctly.
String optRelax = ""; String optRelax = "";
if (boardPreferences.get("build.mcu").equals("atmega2560")) if (configPreferences.get("build.mcu").equals("atmega2560"))
optRelax = ",--relax"; optRelax = ",--relax";
System.out.println("compileLink: start"); System.out.println("compileLink: start");

View File

@ -2,7 +2,7 @@
uno.name=Arduino Uno uno.name=Arduino Uno
uno.platform=avr uno.platform=avr
uno.upload.protocol=stk500 uno.upload.protocol=arduino
uno.upload.maximum_size=32256 uno.upload.maximum_size=32256
uno.upload.speed=115200 uno.upload.speed=115200
uno.bootloader.low_fuses=0xff uno.bootloader.low_fuses=0xff