Cristian Maglie 2013-04-17 17:53:03 +02:00
commit 443d0e1f26
18 changed files with 802 additions and 508 deletions

View File

@ -30,16 +30,17 @@ import java.util.List;
import javax.swing.*;
import processing.app.debug.TargetBoard;
import processing.app.debug.TargetPackage;
import processing.app.debug.TargetPlatform;
import processing.app.debug.TargetPlatformException;
import processing.app.helpers.FileUtils;
import processing.app.helpers.Maps;
import processing.app.helpers.PreferencesMap;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.packages.Library;
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
import processing.app.packages.Library;
import processing.app.packages.LibraryList;
import processing.app.tools.MapWithSubkeys;
import processing.app.tools.ZipDeflater;
import processing.core.*;
import static processing.app.I18n._;
@ -116,7 +117,6 @@ public class Base {
static File portableFolder = null;
static final String portableSketchbookFolder = "sketchbook";
static public void main(String args[]) throws Exception {
initPlatform();
@ -290,6 +290,11 @@ public class Base {
packages = new HashMap<String, TargetPackage>();
loadHardware(getHardwareFolder());
loadHardware(getSketchbookHardwareFolder());
if (packages.size() == 0) {
System.out.println(_("No valid configured cores found! Exiting..."));
System.exit(3);
}
// Setup board-dependent variables.
onBoardOrPortChange();
@ -403,8 +408,9 @@ public class Base {
* sketch that was used (if any), and restores other Editor settings.
* The complement to "storePreferences", this is called when the
* application is first launched.
* @throws Exception
*/
protected boolean restoreSketches() {
protected boolean restoreSketches() throws Exception {
// figure out window placement
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
@ -664,8 +670,9 @@ public class Base {
/**
* Create a new untitled document in a new sketch window.
* @throws Exception
*/
public void handleNew() {
public void handleNew() throws Exception {
try {
String path = createNewUntitled();
if (path != null) {
@ -733,8 +740,9 @@ public class Base {
/**
* Prompt for a sketch to open, and open it in a new window.
* @throws Exception
*/
public void handleOpenPrompt() {
public void handleOpenPrompt() throws Exception {
// get the frontmost window frame for placing file dialog
FileDialog fd = new FileDialog(activeEditor,
_("Open an Arduino sketch..."),
@ -769,13 +777,14 @@ public class Base {
* @param path Path to the pde file for the sketch in question
* @return the Editor object, so that properties (like 'untitled')
* can be set by the caller
* @throws Exception
*/
public Editor handleOpen(String path) {
public Editor handleOpen(String path) throws Exception {
return handleOpen(path, nextEditorLocation());
}
protected Editor handleOpen(String path, int[] location) {
protected Editor handleOpen(String path, int[] location) throws Exception {
// System.err.println("entering handleOpen " + path);
File file = new File(path);
@ -1007,7 +1016,11 @@ public class Base {
item = Editor.newJMenuItem(_("Open..."), 'O');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleOpenPrompt();
try {
handleOpenPrompt();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
menu.add(item);
@ -1073,6 +1086,7 @@ public class Base {
// Split between user supplied libraries and IDE libraries
TargetPlatform targetPlatform = getTargetPlatform();
if (targetPlatform != null) {
LibraryList ideLibs = getIDELibs();
LibraryList userLibs = getUserLibs();
@ -1080,11 +1094,14 @@ public class Base {
// Find the current target. Get the platform, and then select the
// correct name and core path.
PreferencesMap prefs = targetPlatform.getPreferences();
String targetname = prefs.get("name");
JMenuItem platformItem = new JMenuItem(_(targetname));
platformItem.setEnabled(false);
importMenu.add(platformItem);
if (prefs != null) {
String platformName = prefs.get("name");
if (platformName != null) {
JMenuItem platformItem = new JMenuItem(_(platformName));
platformItem.setEnabled(false);
importMenu.add(platformItem);
}
}
if (ideLibs.size() > 0) {
importMenu.addSeparator();
addLibraries(importMenu, ideLibs);
@ -1180,9 +1197,9 @@ public class Base {
try {
libraries = scanLibraries(librariesFolders);
} catch (IOException e) {
showWarning(_("Error"), _("Error reading preferences"), e);
showWarning(_("Error"), _("Error loading libraries"), e);
}
String currentArch = Base.getTargetPlatform().getName();
String currentArch = Base.getTargetPlatform().getId();
libraries = libraries.filterByArchitecture(currentArch);
// Populate importToLibraryTable
@ -1204,12 +1221,8 @@ public class Base {
editor.onBoardOrPortChange();
}
public void rebuildBoardsMenu(JMenu toolsMenu, final Editor editor) {
JMenu boardsMenu = makeOrGetBoardMenu(toolsMenu, _("Board"));
String selPackage = Preferences.get("target_package");
String selPlatform = Preferences.get("target_platform");
String selBoard = Preferences.get("board");
public void rebuildBoardsMenu(JMenu toolsMenu, Editor editor) throws Exception {
JMenu boardsMenu = getBoardCustomMenu();
boolean first = true;
@ -1218,97 +1231,42 @@ public class Base {
ButtonGroup boardsButtonGroup = new ButtonGroup();
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<String, ButtonGroup>();
// Generate custom menus for all platforms
Set<String> titles = new HashSet<String>();
for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.platforms())
titles.addAll(targetPlatform.getCustomMenus().values());
}
for (String title : titles)
makeBoardCustomMenu(toolsMenu, _(title));
// Cycle through all packages
for (TargetPackage targetPackage : packages.values()) {
String packageName = targetPackage.getName();
// For every package cycle through all platform
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
String platformName = targetPlatform.getName();
Map<String, PreferencesMap> boards = targetPlatform.getBoards();
if (targetPlatform.getPreferences().get("name") == null || targetPlatform.getBoards().isEmpty()) {
continue;
}
// Add a title for each group of boards
if (!first) {
// Add a separator from the previous platform
if (!first)
boardsMenu.add(new JSeparator());
}
first = false;
JMenuItem separator = new JMenuItem(_(targetPlatform.getPreferences().get("name")));
separator.setEnabled(false);
boardsMenu.add(separator);
// Add a title for each platform
String platformLabel = targetPlatform.getPreferences().get("name");
if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
JMenuItem menuLabel = new JMenuItem(_(platformLabel));
menuLabel.setEnabled(false);
boardsMenu.add(menuLabel);
}
// For every platform cycle through all boards
for (final String boardID : targetPlatform.getBoards().keySet()) {
// Setup a menu item for the current board
String boardName = boards.get(boardID).get("name");
@SuppressWarnings("serial")
Action action = new AbstractAction(boardName) {
public void actionPerformed(ActionEvent actionevent) {
selectBoard((String) getValue("b"), editor);
}
};
action.putValue("b", packageName + ":" + platformName + ":" + boardID);
JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);
// Cycle through all boards of this platform
for (TargetBoard board : targetPlatform.getBoards().values()) {
JMenuItem item = createBoardMenusAndCustomMenus(
editor,
menuItemsToClickAfterStartup,
buttonGroupsMap,
board, targetPlatform, targetPackage);
boardsMenu.add(item);
boardsButtonGroup.add(item);
if (selBoard.equals(boardID) && selPackage.equals(packageName)
&& selPlatform.equals(platformName)) {
menuItemsToClickAfterStartup.add(item);
}
if (targetPlatform.getCustomMenus() != null) {
List<String> customMenuIDs = new LinkedList<String>(targetPlatform.getCustomMenus().getKeys());
for (int i = 0; i < customMenuIDs.size(); i++) {
final String customMenuID = customMenuIDs.get(i);
JMenu menu = makeOrGetBoardMenu(toolsMenu, _(targetPlatform.getCustomMenus().getValueOf(customMenuID)));
MapWithSubkeys customMenu = targetPlatform.getCustomMenus().get(customMenuID);
if (customMenu.getKeys().contains(boardID)) {
MapWithSubkeys boardCustomMenu = customMenu.get(boardID);
final int currentIndex = i + 1 + 1; //plus 1 to skip the first board menu, plus 1 to keep the custom menu next to this one
for (final String customMenuOption : boardCustomMenu.getKeys()) {
@SuppressWarnings("serial")
Action subAction = new AbstractAction(_(boardCustomMenu.getValueOf(customMenuOption))) {
public void actionPerformed(ActionEvent e) {
Preferences.set("target_package", (String) getValue("package"));
Preferences.set("target_platform", (String) getValue("platform"));
Preferences.set("board", (String) getValue("board"));
Preferences.set("custom_" + customMenuID, boardID + "_" + (String) getValue("custom_menu_option"));
filterVisibilityOfSubsequentBoardMenus((String) getValue("board"), currentIndex);
onBoardOrPortChange();
Sketch.buildSettingChanged();
rebuildImportMenu(Editor.importMenu, editor);
rebuildExamplesMenu(Editor.examplesMenu);
}
};
subAction.putValue("board", boardID);
subAction.putValue("custom_menu_option", customMenuOption);
subAction.putValue("package", packageName);
subAction.putValue("platform", platformName);
if (!buttonGroupsMap.containsKey(customMenuID)) {
buttonGroupsMap.put(customMenuID, new ButtonGroup());
}
item = new JRadioButtonMenuItem(subAction);
menu.add(item);
buttonGroupsMap.get(customMenuID).add(item);
String selectedCustomMenuEntry = Preferences.get("custom_" + customMenuID);
if (selBoard.equals(boardID) && (boardID + "_" + customMenuOption).equals(selectedCustomMenuEntry)) {
menuItemsToClickAfterStartup.add(item);
}
}
}
}
}
}
}
}
@ -1323,6 +1281,87 @@ public class Base {
}
}
private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
final Editor editor,
List<JMenuItem> menuItemsToClickAfterStartup,
Map<String, ButtonGroup> buttonGroupsMap,
TargetBoard board, TargetPlatform targetPlatform, TargetPackage targetPackage)
throws Exception {
String selPackage = Preferences.get("target_package");
String selPlatform = Preferences.get("target_platform");
String selBoard = Preferences.get("board");
String boardId = board.getId();
String packageName = targetPackage.getId();
String platformName = targetPlatform.getId();
// Setup a menu item for the current board
@SuppressWarnings("serial")
Action action = new AbstractAction(board.getName()) {
public void actionPerformed(ActionEvent actionevent) {
selectBoard((String) getValue("b"), editor);
}
};
action.putValue("b", packageName + ":" + platformName + ":" + boardId);
JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);
if (selBoard.equals(boardId) && selPackage.equals(packageName)
&& selPlatform.equals(platformName)) {
menuItemsToClickAfterStartup.add(item);
}
int i = 0;
PreferencesMap customMenus = targetPlatform.getCustomMenus();
for (final String menuId : customMenus.keySet()) {
String title = customMenus.get(menuId);
JMenu menu = getBoardCustomMenu(_(title));
if (board.hasMenu(menuId)) {
PreferencesMap boardCustomMenu = board.getMenuLabels(menuId);
final int currentIndex = i + 1 + 1; //plus 1 to skip the first board menu, plus 1 to keep the custom menu next to this one
i++;
for (String customMenuOption : boardCustomMenu.keySet()) {
@SuppressWarnings("serial")
Action subAction = new AbstractAction(_(boardCustomMenu.get(customMenuOption))) {
public void actionPerformed(ActionEvent e) {
Preferences.set("target_package", (String) getValue("package"));
Preferences.set("target_platform", (String) getValue("platform"));
Preferences.set("board", (String) getValue("board"));
Preferences.set("custom_" + menuId, (String) getValue("board") + "_" + (String) getValue("custom_menu_option"));
filterVisibilityOfSubsequentBoardMenus((String) getValue("board"), currentIndex);
onBoardOrPortChange();
Sketch.buildSettingChanged();
rebuildImportMenu(Editor.importMenu, editor);
rebuildExamplesMenu(Editor.examplesMenu);
}
};
subAction.putValue("board", boardId);
subAction.putValue("custom_menu_option", customMenuOption);
subAction.putValue("package", packageName);
subAction.putValue("platform", platformName);
if (!buttonGroupsMap.containsKey(menuId)) {
buttonGroupsMap.put(menuId, new ButtonGroup());
}
JRadioButtonMenuItem subItem = new JRadioButtonMenuItem(subAction);
menu.add(subItem);
buttonGroupsMap.get(menuId).add(subItem);
String selectedCustomMenuEntry = Preferences.get("custom_" + menuId);
if (selBoard.equals(boardId) && (boardId + "_" + customMenuOption).equals(selectedCustomMenuEntry)) {
menuItemsToClickAfterStartup.add(subItem);
}
}
}
}
return item;
}
private static void filterVisibilityOfSubsequentBoardMenus(String boardID, int fromIndex) {
for (int i = fromIndex; i < Editor.boardsMenus.size(); i++) {
JMenu menu = Editor.boardsMenus.get(i);
@ -1330,9 +1369,9 @@ public class Base {
JMenuItem menuItem = menu.getItem(m);
menuItem.setVisible(menuItem.getAction().getValue("board").equals(boardID));
}
menu.setEnabled(ifThereAreVisibleItemsOn(menu));
menu.setVisible(ifThereAreVisibleItemsOn(menu));
if (menu.isEnabled()) {
if (menu.isVisible()) {
JMenuItem visibleSelectedOrFirstMenuItem = selectVisibleSelectedOrFirstMenuItem(menu);
if (!visibleSelectedOrFirstMenuItem.isSelected()) {
visibleSelectedOrFirstMenuItem.setSelected(true);
@ -1351,18 +1390,24 @@ public class Base {
return false;
}
private JMenu makeOrGetBoardMenu(JMenu toolsMenu, String label) {
for (JMenu menu : Editor.boardsMenus) {
if (label.equals(menu.getText())) {
return menu;
}
}
private JMenu makeBoardCustomMenu(JMenu toolsMenu, String label) {
JMenu menu = new JMenu(label);
Editor.boardsMenus.add(menu);
toolsMenu.add(menu);
return menu;
}
private JMenu getBoardCustomMenu() throws Exception {
return getBoardCustomMenu(_("Board"));
}
private JMenu getBoardCustomMenu(String label) throws Exception {
for (JMenu menu : Editor.boardsMenus)
if (label.equals(menu.getText()))
return menu;
throw new Exception("Custom menu not found!");
}
private static JMenuItem selectVisibleSelectedOrFirstMenuItem(JMenu menu) {
JMenuItem firstVisible = null;
for (int i = 0; i < menu.getItemCount(); i++) {
@ -1416,7 +1461,7 @@ public class Base {
for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
for (String programmer : targetPlatform.getProgrammers().keySet()) {
String id = targetPackage.getName() + ":" + programmer;
String id = targetPackage.getId() + ":" + programmer;
@SuppressWarnings("serial")
AbstractAction action = new AbstractAction(targetPlatform
@ -1494,7 +1539,11 @@ public class Base {
if (replace) {
handleOpenReplace(path);
} else {
handleOpen(path);
try {
handleOpen(path);
} catch (Exception e1) {
e1.printStackTrace();
}
}
} else {
showWarning(_("Sketch Does Not Exist"),
@ -1604,7 +1653,13 @@ public class Base {
if (target.equals("tools"))
continue;
File subfolder = new File(folder, target);
packages.put(target, new TargetPackage(target, subfolder));
try {
packages.put(target, new TargetPackage(target, subfolder));
} catch (TargetPlatformException e) {
System.out.println("WARNING: Error loading hardware folder " + target);
System.out.println(" " + e.getMessage());
}
}
}
@ -1921,22 +1976,26 @@ public class Base {
return getTargetPlatform(pack, Preferences.get("target_platform"));
}
static public Map<String, String> getBoardPreferences() {
TargetPlatform target = getTargetPlatform();
String board = Preferences.get("board");
Map<String, String> boardPreferences = Maps.merge(target.getBoards().get(board), new LinkedHashMap<String, String>());
if (target.getCustomMenus() != null) {
for (String customMenuID : target.getCustomMenus().getKeys()) {
MapWithSubkeys boardCustomMenu = target.getCustomMenus().get(customMenuID).get(board);
String selectedCustomMenuEntry = Preferences.get("custom_" + customMenuID);
if (boardCustomMenu != null && selectedCustomMenuEntry != null && selectedCustomMenuEntry.startsWith(board)) {
String menuEntryId = selectedCustomMenuEntry.substring(selectedCustomMenuEntry.indexOf("_") + 1);
Maps.merge(boardCustomMenu.get(menuEntryId).getValues(), boardPreferences);
boardPreferences.put("name", boardPreferences.get("name") + ", " + boardCustomMenu.getValueOf(menuEntryId));
}
static public PreferencesMap getBoardPreferences() {
TargetBoard board = getTargetBoard();
PreferencesMap prefs = new PreferencesMap(board.getPreferences());
for (String menuId : board.getMenuIds()) {
String entry = Preferences.get("custom_" + menuId);
if (board.hasMenu(menuId) && entry != null &&
entry.startsWith(board.getId())) {
String selectionId = entry.substring(entry.indexOf("_") + 1);
prefs.putAll(board.getMenuPreferences(menuId, selectionId));
prefs.put("name", prefs.get("name") + ", " +
board.getMenuLabel(menuId, selectionId));
}
}
return boardPreferences;
return prefs;
}
public static TargetBoard getTargetBoard() {
String boardId = Preferences.get("board");
return getTargetPlatform().getBoard(boardId);
}
static public File getPortableFolder() {

View File

@ -150,7 +150,7 @@ public class Editor extends JFrame implements RunnerListener {
Runnable exportAppHandler;
public Editor(Base ibase, String path, int[] location) {
public Editor(Base ibase, String path, int[] location) throws Exception {
super("Arduino");
this.base = ibase;
@ -476,7 +476,7 @@ public class Editor extends JFrame implements RunnerListener {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
protected void buildMenuBar() {
protected void buildMenuBar() throws Exception {
JMenuBar menubar = new JMenuBar();
menubar.add(buildFileMenu());
menubar.add(buildEditMenu());
@ -494,7 +494,11 @@ public class Editor extends JFrame implements RunnerListener {
item = newJMenuItem(_("New"), 'N');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleNew();
try {
base.handleNew();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
fileMenu.add(item);
@ -502,7 +506,11 @@ public class Editor extends JFrame implements RunnerListener {
item = Editor.newJMenuItem(_("Open..."), 'O');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleOpenPrompt();
try {
base.handleOpenPrompt();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
fileMenu.add(item);
@ -662,7 +670,7 @@ public class Editor extends JFrame implements RunnerListener {
}
protected JMenu buildToolsMenu() {
protected JMenu buildToolsMenu() throws Exception {
toolsMenu = new JMenu(_("Tools"));
JMenu menu = toolsMenu;
JMenuItem item;
@ -690,6 +698,11 @@ public class Editor extends JFrame implements RunnerListener {
if (boardsMenus == null) {
boardsMenus = new LinkedList<JMenu>();
JMenu boardsMenu = new JMenu(_("Board"));
Editor.boardsMenus.add(boardsMenu);
toolsMenu.add(boardsMenu);
base.rebuildBoardsMenu(toolsMenu, this);
//Debug: rebuild imports
importMenu.removeAll();

View File

@ -335,9 +335,13 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
case NEW:
if (shiftPressed) {
editor.base.handleNew();
try {
editor.base.handleNew();
} catch (Exception e1) {
e1.printStackTrace();
}
} else {
editor.base.handleNewReplace();
editor.base.handleNewReplace();
}
break;

View File

@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.List;
import processing.app.Base;
import processing.app.I18n;
import processing.app.Preferences;
import processing.app.Serial;
import processing.app.SerialException;
@ -249,18 +250,46 @@ public class BasicUploader extends Uploader {
}
public boolean burnBootloader() throws RunnerException {
String programmer = Preferences.get("programmer");
TargetPlatform targetPlatform = Base.getTargetPlatform();
// Find preferences for the selected programmer
PreferencesMap programmerPrefs;
String programmer = Preferences.get("programmer");
if (programmer.contains(":")) {
String[] split = programmer.split(":", 2);
targetPlatform = Base.getCurrentTargetPlatformFromPackage(split[0]);
TargetPlatform platform = Base
.getCurrentTargetPlatformFromPackage(split[0]);
programmer = split[1];
programmerPrefs = platform.getProgrammer(programmer);
} else {
programmerPrefs = targetPlatform.getProgrammer(programmer);
}
// Build configuration for the current programmer
PreferencesMap prefs = Preferences.getMap();
prefs.putAll(Base.getBoardPreferences());
prefs.putAll(targetPlatform.getProgrammer(programmer));
prefs.putAll(targetPlatform.getTool(prefs.get("bootloader.tool")));
prefs.putAll(programmerPrefs);
// Create configuration for bootloader tool
PreferencesMap toolPrefs = new PreferencesMap();
String tool = prefs.get("bootloader.tool");
if (tool.contains(":")) {
String[] split = tool.split(":", 2);
TargetPlatform platform = Base.getCurrentTargetPlatformFromPackage(split[0]);
tool = split[1];
toolPrefs.putAll(platform.getTool(tool));
if (toolPrefs.size() == 0)
throw new RunnerException(
I18n.format(_("Could not find tool {0} from package {1}"), tool,
split[0]));
}
toolPrefs.putAll(targetPlatform.getTool(tool));
if (toolPrefs.size() == 0)
throw new RunnerException(I18n.format(_("Could not find tool {0}"),
tool));
// Merge tool with global configuration
prefs.putAll(toolPrefs);
if (verbose) {
prefs.put("erase.verbose", prefs.get("erase.params.verbose"));
prefs.put("bootloader.verbose", prefs.get("bootloader.params.verbose"));
@ -270,12 +299,6 @@ public class BasicUploader extends Uploader {
}
try {
// if (prefs.get("program.disable_flushing") == null
// || prefs.get("program.disable_flushing").toLowerCase().equals("false"))
// {
// flushSerialBuffer();
// }
String pattern = prefs.get("erase.pattern");
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
if (!executeUploadCommand(cmd))

View File

@ -132,11 +132,29 @@ public class Compiler implements MessageConsumer {
throw re;
}
// Check if the board needs a platform from another package
TargetPlatform targetPlatform = Base.getTargetPlatform();
TargetPlatform corePlatform = null;
PreferencesMap boardPreferences = Base.getBoardPreferences();
String core = boardPreferences.get("build.core");
if (core.contains(":")) {
String[] split = core.split(":");
core = split[1];
corePlatform = Base.getTargetPlatform(split[0], targetPlatform.getId());
if (corePlatform == null) {
RunnerException re = new RunnerException(I18n
.format(_("Selected board depends on '{0}' core (not installed)."),
split[0]));
re.hideStackTrace();
throw re;
}
}
// Merge all the global preference configuration in order of priority
PreferencesMap p = new PreferencesMap();
p.putAll(Preferences.getMap());
if (corePlatform != null)
p.putAll(corePlatform.getPreferences());
p.putAll(targetPlatform.getPreferences());
p.putAll(Base.getBoardPreferences());
for (String k : p.keySet()) {
@ -146,28 +164,23 @@ public class Compiler implements MessageConsumer {
p.put("build.path", _buildPath);
p.put("build.project_name", _primaryClassName);
targetArch = targetPlatform.getName();
targetArch = targetPlatform.getId();
p.put("build.arch", targetArch.toUpperCase());
if (!p.containsKey("compiler.path"))
p.put("compiler.path", Base.getAvrBasePath());
// Core folder
String core = p.get("build.core");
TargetPlatform tp;
if (!core.contains(":")) {
TargetPlatform tp = corePlatform;
if (tp == null)
tp = targetPlatform;
} else {
String[] split = core.split(":", 2);
tp = Base.getTargetPlatform(split[0], Preferences.get("target_platform"));
core = split[1];
}
File coreFolder = new File(tp.getFolder(), "cores");
coreFolder = new File(coreFolder, core);
p.put("build.core", core);
p.put("build.core.path", coreFolder.getAbsolutePath());
// System Folder
File systemFolder = targetPlatform.getFolder();
File systemFolder = tp.getFolder();
systemFolder = new File(systemFolder, "system");
p.put("build.system.path", systemFolder.getAbsolutePath());
@ -179,8 +192,7 @@ public class Compiler implements MessageConsumer {
t = targetPlatform;
} else {
String[] split = variant.split(":", 2);
t = Base
.getTargetPlatform(split[0], Preferences.get("target_platform"));
t = Base.getTargetPlatform(split[0], targetPlatform.getId());
variant = split[1];
}
File variantFolder = new File(t.getFolder(), "variants");

View File

@ -0,0 +1,132 @@
package processing.app.debug;
import static processing.app.I18n._;
import static processing.app.I18n.format;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import processing.app.helpers.PreferencesMap;
public class TargetBoard {
private String id;
private PreferencesMap prefs;
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<String, PreferencesMap>();
private TargetPlatform containerPlatform;
/**
* Create a TargetBoard based on preferences passed as argument.
*
* @param _prefs
* @return
*/
public TargetBoard(String _id, PreferencesMap _prefs, TargetPlatform parent) {
containerPlatform = parent;
id = _id;
prefs = new PreferencesMap(_prefs);
// Setup sub-menus
PreferencesMap menus = prefs.firstLevelMap().get("menu");
if (menus != null)
menuOptions = menus.firstLevelMap();
// Auto generate build.board if not set
if (!prefs.containsKey("build.board")) {
String board = containerPlatform.getId() + "_" + id;
board = board.toUpperCase();
prefs.put("build.board", board);
System.out
.println(format(
_("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
containerPlatform.getContainerPackage().getId(),
containerPlatform.getId(), id, board));
}
}
/**
* Get the name of the board.
*
* @return
*/
public String getName() {
return prefs.get("name");
}
/**
* Get the identifier of the board
*
* @return
*/
public String getId() {
return id;
}
/**
* Get the full preferences map of the board with a given identifier
*
* @return
*/
public PreferencesMap getPreferences() {
return prefs;
}
/**
* Check if the board has a sub menu.
*
* @param menuId
* The menu ID to check
* @return
*/
public boolean hasMenu(String menuId) {
return menuOptions.containsKey(menuId);
}
/**
* Returns the options available on a specific menu
*
* @param menuId
* The menu ID
* @return
*/
public PreferencesMap getMenuLabels(String menuId) {
return menuOptions.get(menuId).topLevelMap();
}
/**
* Returns the label of the specified option in the specified menu
*
* @param menuId
* The menu ID
* @param selectionId
* The option ID
* @return
*/
public String getMenuLabel(String menuId, String selectionId) {
return getMenuLabels(menuId).get(selectionId);
}
public Set<String> getMenuIds() {
return menuOptions.keySet();
}
/**
* Returns the configuration parameters to override (as a PreferenceMap) when
* the specified option in the specified menu is selected
*
* @param menuId
* The menu ID
* @param selectionId
* The option ID
* @return
*/
public PreferencesMap getMenuPreferences(String menuId, String selectionId) {
return menuOptions.get(menuId).subTree(selectionId);
}
public TargetPlatform getContainerPlatform() {
return containerPlatform;
}
}

View File

@ -25,29 +25,30 @@ package processing.app.debug;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import processing.app.helpers.filefilters.OnlyDirs;
public class TargetPackage {
private final String name;
private String id;
Map<String, TargetPlatform> platforms = new HashMap<String, TargetPlatform>();
Map<String, TargetPlatform> platforms = new LinkedHashMap<String, TargetPlatform>();
public TargetPackage(String name, File folder) {
this.name = name;
public TargetPackage(String _id, File _folder) throws TargetPlatformException {
id = _id;
String[] platformsList = folder.list(new OnlyDirs());
if (platformsList != null) {
for (String platformName : platformsList) {
File platformFolder = new File(folder, platformName);
if (platformFolder.exists() && platformFolder.canRead()) {
TargetPlatform platform = new TargetPlatform(platformName, platformFolder);
platforms.put(platformName, platform);
}
}
File[] folders = _folder.listFiles(new OnlyDirs());
if (folders == null)
return;
for (File subFolder : folders) {
if (!subFolder.exists() || !subFolder.canRead())
continue;
String arch = subFolder.getName();
TargetPlatform platform = new TargetPlatform(arch, subFolder, this);
platforms.put(arch, platform);
}
}
@ -63,7 +64,7 @@ public class TargetPackage {
return platforms.get(platform);
}
public String getName() {
return name;
public String getId() {
return id;
}
}

View File

@ -24,81 +24,121 @@
package processing.app.debug;
import static processing.app.I18n._;
import static processing.app.I18n.format;
import java.io.File;
import java.util.HashMap;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import processing.app.helpers.PreferencesMap;
import processing.app.tools.MapWithSubkeys;
public class TargetPlatform {
private String name;
private String id;
private File folder;
private Map<String, PreferencesMap> boards;
private Map<String, PreferencesMap> programmers;
private PreferencesMap preferences;
private MapWithSubkeys customMenus;
private TargetPackage containerPackage;
public TargetPlatform(String _name, File _folder) {
name = _name;
/**
* Contains preferences for every defined board
*/
private Map<String, TargetBoard> boards = new LinkedHashMap<String, TargetBoard>();
/**
* Contains preferences for every defined programmer
*/
private Map<String, PreferencesMap> programmers = new LinkedHashMap<String, PreferencesMap>();
/**
* Contains preferences for platform
*/
private PreferencesMap preferences = new PreferencesMap();
/**
* Contains labels for top level menus
*/
private PreferencesMap customMenus = new PreferencesMap();
public TargetPlatform(String _name, File _folder, TargetPackage parent)
throws TargetPlatformException {
id = _name;
folder = _folder;
boards = new HashMap<String, PreferencesMap>();
programmers = new HashMap<String, PreferencesMap>();
preferences = new PreferencesMap();
containerPackage = parent;
// If there is no boards.txt, this is not a valid 1.5 hardware folder
File boardsFile = new File(folder, "boards.txt");
if (!boardsFile.exists() || !boardsFile.canRead())
throw new TargetPlatformException(
format(_("Could not find boards.txt in {0}. Is it pre-1.5?"),
boardsFile.getAbsolutePath()));
// Load boards
try {
File boardsFile = new File(_folder, "boards.txt");
if (boardsFile.exists() && boardsFile.canRead()) {
PreferencesMap boardPreferences = new PreferencesMap();
boardPreferences.load(boardsFile);
boards = boardPreferences.createFirstLevelMap();
customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
boards.remove("menu");
Map<String, PreferencesMap> boardsPreferences = new PreferencesMap(
boardsFile).firstLevelMap();
// Create custom menus for this platform
PreferencesMap menus = boardsPreferences.get("menu");
if (menus != null)
customMenus = menus.topLevelMap();
boardsPreferences.remove("menu");
// Create boards
for (String id : boardsPreferences.keySet()) {
PreferencesMap preferences = boardsPreferences.get(id);
TargetBoard board = new TargetBoard(id, preferences, this);
boards.put(id, board);
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error loading boards from boards.txt: " + e);
} catch (IOException e) {
throw new TargetPlatformException(format(_("Error loading {0}"),
boardsFile.getAbsolutePath()), e);
}
File platformsFile = new File(folder, "platform.txt");
try {
File platformsFile = new File(_folder, "platform.txt");
if (platformsFile.exists() && platformsFile.canRead()) {
preferences.load(platformsFile);
}
} catch (Exception e) {
System.err.println("Error loading platforms from platform.txt: " + e);
} catch (IOException e) {
throw new TargetPlatformException(
format(_("Error loading {0}"), platformsFile.getAbsolutePath()), e);
}
File progFile = new File(folder, "programmers.txt");
try {
File programmersFile = new File(_folder, "programmers.txt");
if (programmersFile.exists() && programmersFile.canRead()) {
if (progFile.exists() && progFile.canRead()) {
PreferencesMap prefs = new PreferencesMap();
prefs.load(programmersFile);
programmers = prefs.createFirstLevelMap();
prefs.load(progFile);
programmers = prefs.firstLevelMap();
}
} catch (Exception e) {
System.err
.println("Error loading programmers from programmers.txt: " + e);
} catch (IOException e) {
throw new TargetPlatformException(format(_("Error loading {0}"), progFile
.getAbsolutePath()), e);
}
}
public String getName() {
return name;
public String getId() {
return id;
}
public File getFolder() {
return folder;
}
public Map<String, PreferencesMap> getBoards() {
public Map<String, TargetBoard> getBoards() {
return boards;
}
public MapWithSubkeys getCustomMenus() {
public PreferencesMap getCustomMenus() {
return customMenus;
}
public Set<String> getCustomMenuIds() {
return customMenus.keySet();
}
public Map<String, PreferencesMap> getProgrammers() {
return programmers;
}
@ -106,12 +146,28 @@ public class TargetPlatform {
public PreferencesMap getProgrammer(String programmer) {
return getProgrammers().get(programmer);
}
public PreferencesMap getTool(String tool) {
return getPreferences().createSubTree("tools").createSubTree(tool);
return getPreferences().subTree("tools").subTree(tool);
}
public PreferencesMap getPreferences() {
return preferences;
}
public TargetBoard getBoard(String boardId) {
return boards.get(boardId);
}
public TargetPackage getContainerPackage() {
return containerPackage;
}
@Override
public String toString() {
String res = "TargetPlatform: name=" + id + " boards={\n";
for (String boardId : boards.keySet())
res += " " + boardId + " = " + boards.get(boardId) + "\n";
return res + "}";
}
}

View File

@ -0,0 +1,22 @@
package processing.app.debug;
@SuppressWarnings("serial")
public class TargetPlatformException extends Exception {
public TargetPlatformException() {
super();
}
public TargetPlatformException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
public TargetPlatformException(String arg0) {
super(arg0);
}
public TargetPlatformException(Throwable arg0) {
super(arg0);
}
}

View File

@ -1,15 +0,0 @@
package processing.app.helpers;
import java.util.Map;
import java.util.Map.Entry;
public class Maps {
public static <K, V> Map<K, V> merge(Map<K, V> input, Map<K, V> target) {
for (Entry<K, V> entry : input.entrySet()) {
target.put(entry.getKey(), entry.getValue());
}
return target;
}
}

View File

@ -28,17 +28,42 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import processing.app.Base;
import processing.core.PApplet;
@SuppressWarnings("serial")
public class PreferencesMap extends LinkedHashMap<String, String> {
public PreferencesMap(Map<String, String> table) {
super(table);
}
/**
* Create a PreferencesMap and load the content of the file passed as
* argument.
*
* Is equivalent to:
*
* <pre>
* PreferencesMap map = new PreferencesMap();
* map.load(file);
* </pre>
*
* @param file
* @throws IOException
*/
public PreferencesMap(File file) throws IOException {
super();
load(file);
}
public PreferencesMap() {
super();
}
@ -75,7 +100,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
}
// This is needed to avoid ConcurrentAccessExceptions
Set<String> keys = new HashSet<String>(keySet());
Set<String> keys = new LinkedHashSet<String>(keySet());
// Override keys that have OS specific versions
for (String key : keys) {
@ -95,13 +120,51 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
}
/**
* Create a new Map<String, PreferenceMap> where the keys are the first level
* of the current mapping. E.g. the folowing mapping:<br />
* Create a new PreferenceMap that contains all the top level pairs of the
* current mapping. E.g. the folowing mapping:<br />
*
* <pre>
* Map (
* alpha = Alpha
* alpha.some.keys = v1
* alpha.other.keys = v2
* beta = Beta
* beta.some.keys = v3
* )
* </pre>
*
* will generate the following result:
*
* <pre>
* Map (
* alpha = Alpha
* beta = Beta
* )
* </pre>
*
* @return
*/
public PreferencesMap topLevelMap() {
PreferencesMap res = new PreferencesMap();
for (String key : keySet()) {
if (key.contains("."))
continue;
res.put(key, get(key));
}
return res;
}
/**
* Create a new Map<String, PreferenceMap> where keys are the first level of
* the current mapping. Top level pairs are discarded. E.g. the folowing
* mapping:<br />
*
* <pre>
* Map (
* alpha = Alpha
* alpha.some.keys = v1
* alpha.other.keys = v2
* beta = Beta
* beta.some.keys = v3
* )
* </pre>
@ -120,7 +183,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
*
* @return
*/
public Map<String, PreferencesMap> createFirstLevelMap() {
public Map<String, PreferencesMap> firstLevelMap() {
Map<String, PreferencesMap> res = new LinkedHashMap<String, PreferencesMap>();
for (String key : keySet()) {
int dot = key.indexOf('.');
@ -138,13 +201,15 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
}
/**
* Create a new PreferenceMap using a subtree of the current mapping. E.g.
* with the folowing mapping:<br />
* Create a new PreferenceMap using a subtree of the current mapping. Top
* level pairs are ignored. E.g. with the following mapping:<br />
*
* <pre>
* Map (
* alpha = Alpha
* alpha.some.keys = v1
* alpha.other.keys = v2
* beta = Beta
* beta.some.keys = v3
* )
* </pre>
@ -161,7 +226,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
* @param parent
* @return
*/
public PreferencesMap createSubTree(String parent) {
public PreferencesMap subTree(String parent) {
PreferencesMap res = new PreferencesMap();
parent += ".";
int parentLen = parent.length();
@ -172,5 +237,16 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
return res;
}
private static final long serialVersionUID = 2330591567444282843L;
public String toString(String indent) {
String res = indent + "{\n";
SortedSet<String> treeSet = new TreeSet<String>(keySet());
for (String k : treeSet)
res += indent + k + " = " + get(k) + "\n";
return res;
}
@Override
public String toString() {
return toString("");
}
}

View File

@ -96,7 +96,11 @@ public class ThinkDifferent implements ApplicationListener {
public void handleOpenFile(ApplicationEvent ae) {
// System.out.println("got open file event " + ae.getFilename());
String filename = ae.getFilename();
base.handleOpen(filename);
try {
base.handleOpen(filename);
} catch (Exception e) {
e.printStackTrace();
}
ae.setHandled(true);
}

View File

@ -1,66 +0,0 @@
package processing.app.tools;
import java.util.*;
import java.util.Map.Entry;
public class MapWithSubkeys {
public static MapWithSubkeys createFrom(Map<String, String> input) {
if (input == null) {
return null;
}
MapWithSubkeys target = new MapWithSubkeys();
for (Entry<String, String> entry : input.entrySet()) {
String[] entryParts = entry.getKey().split("\\.");
if (entryParts.length == 1) {
target.put(entryParts[0], entry.getValue());
} else if (entryParts.length == 3) {
target.get(entryParts[0]).get(entryParts[1]).put(entryParts[2], entry.getValue());
} else if (entryParts.length > 3) {
StringBuilder sb = new StringBuilder();
for (int i = 3; i < entryParts.length; i++) {
sb.append(entryParts[i]).append(".");
}
sb.deleteCharAt(sb.length() - 1);
String key = sb.toString();
target.get(entryParts[0]).get(entryParts[1]).get(entryParts[2]).put(key, entry.getValue());
}
}
return target;
}
private final Map<String, String> values;
private final Map<String, MapWithSubkeys> maps;
public MapWithSubkeys() {
this.values = new LinkedHashMap<String, String>();
this.maps = new LinkedHashMap<String, MapWithSubkeys>();
}
public Collection<String> getKeys() {
return values.keySet();
}
public Map<String, String> getValues() {
return values;
}
public String getValueOf(String key) {
return values.get(key);
}
public MapWithSubkeys get(String key) {
if (!maps.containsKey(key)) {
maps.put(key, new MapWithSubkeys());
}
if (!values.containsKey(key)) {
put(key, null);
}
return maps.get(key);
}
public void put(String key, String value) {
values.put(key, value);
}
}

View File

@ -1,59 +0,0 @@
package processing.app.tools;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
public class MapWithSubkeysTest {
private MapWithSubkeys map;
@Before
public void setup() throws Exception {
Map<String, String> input = new HashMap<String, String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(MapWithSubkeysTest.class.getResourceAsStream("test_partial_boards.txt")));
String line = null;
while ((line = reader.readLine()) != null) {
String[] lineParts = line.split("=");
input.put(lineParts[0], lineParts[1]);
}
map = MapWithSubkeys.createFrom(input);
}
@Test
public void shouldListCustomMenusIDs() {
Collection<String> menusIDs = map.getKeys();
assertEquals(2, menusIDs.size());
assertTrue(menusIDs.contains("cpu"));
assertTrue(menusIDs.contains("speed"));
assertEquals("Processor", map.getValueOf("cpu"));
MapWithSubkeys cpu = map.get("cpu");
Collection<String> boards = cpu.getKeys();
assertEquals(1, boards.size());
assertTrue(boards.contains("nano"));
Collection<String> cpuNanoProcessors = cpu.get("nano").getKeys();
assertEquals(2, cpuNanoProcessors.size());
assertTrue(cpuNanoProcessors.contains("atmega168"));
assertTrue(cpuNanoProcessors.contains("atmega328"));
assertEquals("ATmega168", cpu.get("nano").getValueOf("atmega168"));
assertEquals("ATmega328", cpu.get("nano").getValueOf("atmega328"));
MapWithSubkeys atmega168Properties = cpu.get("nano").get("atmega168");
assertEquals(9, atmega168Properties.getKeys().size());
assertTrue(atmega168Properties.getKeys().contains("bootloader.high_fuses"));
}
}

View File

@ -20,7 +20,7 @@ uno.bootloader.file=optiboot/optiboot_atmega328.hex
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.board=ARDUINO_UNO
uno.build.board=AVR_UNO
uno.build.core=arduino
uno.build.variant=standard
@ -37,33 +37,35 @@ atmega328diecimila.bootloader.unlock_bits=0x3F
atmega328diecimila.bootloader.lock_bits=0x0F
atmega328diecimila.build.f_cpu=16000000L
atmega328diecimila.build.board=ARDUINO_DUEMILANOVE
atmega328diecimila.build.board=AVR_DUEMILANOVE
atmega328diecimila.build.core=arduino
atmega328diecimila.build.variant=standard
## Arduino Duemilanove or Diecimila w/ ATmega328
menu.cpu.atmega328diecimila.atmega328=ATmega328
## ---------------------------------------------
atmega328diecimila.menu.cpu.atmega328=ATmega328
menu.cpu.atmega328diecimila.atmega328.upload.maximum_size=30720
menu.cpu.atmega328diecimila.atmega328.upload.speed=57600
atmega328diecimila.menu.cpu.atmega328.upload.maximum_size=30720
atmega328diecimila.menu.cpu.atmega328.upload.speed=57600
menu.cpu.atmega328diecimila.atmega328.bootloader.high_fuses=0xDA
menu.cpu.atmega328diecimila.atmega328.bootloader.extended_fuses=0x05
menu.cpu.atmega328diecimila.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
atmega328diecimila.menu.cpu.atmega328.bootloader.high_fuses=0xDA
atmega328diecimila.menu.cpu.atmega328.bootloader.extended_fuses=0x05
atmega328diecimila.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
menu.cpu.atmega328diecimila.atmega328.build.mcu=atmega328p
atmega328diecimila.menu.cpu.atmega328.build.mcu=atmega328p
## Arduino Duemilanove or Diecimila w/ ATmega168
menu.cpu.atmega328diecimila.atmega168=ATmega168
## ---------------------------------------------
atmega328diecimila.menu.cpu.atmega168=ATmega168
menu.cpu.atmega328diecimila.atmega168.upload.maximum_size=14336
menu.cpu.atmega328diecimila.atmega168.upload.speed=19200
atmega328diecimila.menu.cpu.atmega168.upload.maximum_size=14336
atmega328diecimila.menu.cpu.atmega168.upload.speed=19200
menu.cpu.atmega328diecimila.atmega168.bootloader.high_fuses=0xdd
menu.cpu.atmega328diecimila.atmega168.bootloader.extended_fuses=0x00
menu.cpu.atmega328diecimila.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
atmega328diecimila.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmega328diecimila.menu.cpu.atmega168.bootloader.extended_fuses=0x00
atmega328diecimila.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
menu.cpu.atmega328diecimila.atmega168.build.mcu=atmega168
atmega328diecimila.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
@ -77,35 +79,37 @@ nano.bootloader.unlock_bits=0x3F
nano.bootloader.lock_bits=0x0F
nano.build.f_cpu=16000000L
nano.build.board=ARDUINO_NANO
nano.build.board=AVR_NANO
nano.build.core=arduino
nano.build.variant=eightanaloginputs
## Arduino Nano w/ ATmega328
menu.cpu.nano.atmega328=ATmega328
## -------------------------
nano.menu.cpu.atmega328=ATmega328
menu.cpu.nano.atmega328.upload.maximum_size=30720
menu.cpu.nano.atmega328.upload.speed=57600
nano.menu.cpu.atmega328.upload.maximum_size=30720
nano.menu.cpu.atmega328.upload.speed=57600
menu.cpu.nano.atmega328.bootloader.low_fuses=0xFF
menu.cpu.nano.atmega328.bootloader.high_fuses=0xDA
menu.cpu.nano.atmega328.bootloader.extended_fuses=0x05
menu.cpu.nano.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF
nano.menu.cpu.atmega328.bootloader.high_fuses=0xDA
nano.menu.cpu.atmega328.bootloader.extended_fuses=0x05
nano.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
menu.cpu.nano.atmega328.build.mcu=atmega328p
## Arduino Nano w/ ATmega168
menu.cpu.nano.atmega168=ATmega168
## -------------------------
nano.menu.cpu.atmega168=ATmega168
menu.cpu.nano.atmega168.upload.maximum_size=14336
menu.cpu.nano.atmega168.upload.speed=19200
nano.menu.cpu.atmega168.upload.maximum_size=14336
nano.menu.cpu.atmega168.upload.speed=19200
menu.cpu.nano.atmega168.bootloader.low_fuses=0xff
menu.cpu.nano.atmega168.bootloader.high_fuses=0xdd
menu.cpu.nano.atmega168.bootloader.extended_fuses=0x00
menu.cpu.nano.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
nano.menu.cpu.atmega168.bootloader.low_fuses=0xff
nano.menu.cpu.atmega168.bootloader.high_fuses=0xdd
nano.menu.cpu.atmega168.bootloader.extended_fuses=0x00
nano.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
menu.cpu.nano.atmega168.build.mcu=atmega168
nano.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
@ -127,7 +131,7 @@ mega2560.bootloader.lock_bits=0x0F
mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L
mega2560.build.board=ARDUINO_MEGA2560
mega2560.build.board=AVR_MEGA2560
mega2560.build.core=arduino
mega2560.build.variant=mega
@ -151,7 +155,7 @@ mega.bootloader.lock_bits=0x0F
mega.build.mcu=atmega1280
mega.build.f_cpu=16000000L
mega.build.board=ARDUINO_MEGA
mega.build.board=AVR_MEGA
mega.build.core=arduino
mega.build.variant=mega
@ -178,7 +182,7 @@ leonardo.build.mcu=atmega32u4
leonardo.build.f_cpu=16000000L
leonardo.build.vid=0x2341
leonardo.build.pid=0x8036
leonardo.build.board=ARDUINO_LEONARDO
leonardo.build.board=AVR_LEONARDO
leonardo.build.core=arduino
leonardo.build.variant=leonardo
leonardo.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
@ -206,7 +210,7 @@ micro.build.mcu=atmega32u4
micro.build.f_cpu=16000000L
micro.build.vid=0x2341
micro.build.pid=0x8037
micro.build.board=ARDUINO_MICRO
micro.build.board=AVR_MICRO
micro.build.core=arduino
micro.build.variant=micro
micro.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
@ -234,7 +238,7 @@ esplora.build.mcu=atmega32u4
esplora.build.f_cpu=16000000L
esplora.build.vid=0x2341
esplora.build.pid=0x803c
esplora.build.board=ARDUINO_ESPLORA
esplora.build.board=AVR_ESPLORA
esplora.build.core=arduino
esplora.build.variant=leonardo
esplora.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
@ -252,33 +256,35 @@ mini.bootloader.unlock_bits=0x3F
mini.bootloader.lock_bits=0x0F
mini.build.f_cpu=16000000L
mini.build.board=ARDUINO_MINI
mini.build.board=AVR_MINI
mini.build.core=arduino
mini.build.variant=eightanaloginputs
## Arduino Mini w/ ATmega328
menu.cpu.mini.atmega328=ATmega328
## -------------------------
mini.menu.cpu.atmega328=ATmega328
menu.cpu.mini.atmega328.upload.maximum_size=28672
menu.cpu.mini.atmega328.upload.speed=115200
mini.menu.cpu.atmega328.upload.maximum_size=28672
mini.menu.cpu.atmega328.upload.speed=115200
menu.cpu.mini.atmega328.bootloader.high_fuses=0xd8
menu.cpu.mini.atmega328.bootloader.extended_fuses=0x05
menu.cpu.mini.atmega328.bootloader.file=optiboot/optiboot_atmega328-Mini.hex
mini.menu.cpu.atmega328.bootloader.high_fuses=0xd8
mini.menu.cpu.atmega328.bootloader.extended_fuses=0x05
mini.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328-Mini.hex
menu.cpu.mini.atmega328.build.mcu=atmega328p
mini.menu.cpu.atmega328.build.mcu=atmega328p
## Arduino Mini w/ ATmega168
menu.cpu.mini.atmega168=ATmega168
## -------------------------
mini.menu.cpu.atmega168=ATmega168
menu.cpu.mini.atmega168.upload.maximum_size=14336
menu.cpu.mini.atmega168.upload.speed=19200
mini.menu.cpu.atmega168.upload.maximum_size=14336
mini.menu.cpu.atmega168.upload.speed=19200
menu.cpu.mini.atmega168.bootloader.high_fuses=0xdd
menu.cpu.mini.atmega168.bootloader.extended_fuses=0x00
menu.cpu.mini.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
mini.menu.cpu.atmega168.bootloader.high_fuses=0xdd
mini.menu.cpu.atmega168.bootloader.extended_fuses=0x00
mini.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
menu.cpu.mini.atmega168.build.mcu=atmega168
mini.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
@ -300,7 +306,7 @@ ethernet.bootloader.lock_bits=0x0F
ethernet.build.variant=standard
ethernet.build.mcu=atmega328p
ethernet.build.f_cpu=16000000L
ethernet.build.board=ARDUINO_ETHERNET
ethernet.build.board=AVR_ETHERNET
ethernet.build.core=arduino
##############################################################
@ -322,7 +328,7 @@ fio.bootloader.lock_bits=0x0F
fio.build.mcu=atmega328p
fio.build.f_cpu=8000000L
fio.build.board=ARDUINO_FIO
fio.build.board=AVR_FIO
fio.build.core=arduino
fio.build.variant=eightanaloginputs
@ -341,29 +347,31 @@ bt.bootloader.unlock_bits=0x3F
bt.bootloader.lock_bits=0x0F
bt.build.f_cpu=16000000L
bt.build.board=ARDUINO_BT
bt.build.board=AVR_BT
bt.build.core=arduino
bt.build.variant=eightanaloginputs
## Arduino BT w/ ATmega328
menu.cpu.bt.atmega328=ATmega328
menu.cpu.bt.atmega328.upload.maximum_size=28672
## -----------------------
bt.menu.cpu.atmega328=ATmega328
bt.menu.cpu.atmega328.upload.maximum_size=28672
menu.cpu.bt.atmega328.bootloader.high_fuses=0xd8
menu.cpu.bt.atmega328.bootloader.extended_fuses=0x05
menu.cpu.bt.atmega328.bootloader.file=bt/ATmegaBOOT_168_atmega328_bt.hex
bt.menu.cpu.atmega328.bootloader.high_fuses=0xd8
bt.menu.cpu.atmega328.bootloader.extended_fuses=0x05
bt.menu.cpu.atmega328.bootloader.file=bt/ATmegaBOOT_168_atmega328_bt.hex
menu.cpu.bt.atmega328.build.mcu=atmega328p
bt.menu.cpu.atmega328.build.mcu=atmega328p
## Arduino BT w/ ATmega168
menu.cpu.bt.atmega168=ATmega168
menu.cpu.bt.atmega168.upload.maximum_size=14336
## -----------------------
bt.menu.cpu.atmega168=ATmega168
bt.menu.cpu.atmega168.upload.maximum_size=14336
menu.cpu.bt.atmega168.bootloader.high_fuses=0xdd
menu.cpu.bt.atmega168.bootloader.extended_fuses=0x00
menu.cpu.bt.atmega168.bootloader.file=bt/ATmegaBOOT_168.hex
bt.menu.cpu.atmega168.bootloader.high_fuses=0xdd
bt.menu.cpu.atmega168.bootloader.extended_fuses=0x00
bt.menu.cpu.atmega168.bootloader.file=bt/ATmegaBOOT_168.hex
menu.cpu.bt.atmega168.build.mcu=atmega168
bt.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
@ -389,7 +397,7 @@ LilyPadUSB.build.mcu=atmega32u4
LilyPadUSB.build.f_cpu=8000000L
LilyPadUSB.build.vid=0x1B4F
LilyPadUSB.build.pid=0x9208
LilyPadUSB.build.board=ARDUINO_LILYPAD_USB
LilyPadUSB.build.board=AVR_LILYPAD_USB
LilyPadUSB.build.core=arduino
LilyPadUSB.build.variant=leonardo
LilyPadUSB.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
@ -406,35 +414,37 @@ lilypad.bootloader.unlock_bits=0x3F
lilypad.bootloader.lock_bits=0x0F
lilypad.build.f_cpu=8000000L
lilypad.build.board=ARDUINO_LILYPAD
lilypad.build.board=AVR_LILYPAD
lilypad.build.core=arduino
lilypad.build.variant=standard
## LilyPad Arduino w/ ATmega328
menu.cpu.lilypad.atmega328=ATmega328
## ----------------------------
lilypad.menu.cpu.atmega328=ATmega328
menu.cpu.lilypad.atmega328.upload.maximum_size=30720
menu.cpu.lilypad.atmega328.upload.speed=57600
lilypad.menu.cpu.atmega328.upload.maximum_size=30720
lilypad.menu.cpu.atmega328.upload.speed=57600
menu.cpu.lilypad.atmega328.bootloader.low_fuses=0xFF
menu.cpu.lilypad.atmega328.bootloader.high_fuses=0xDA
menu.cpu.lilypad.atmega328.bootloader.extended_fuses=0x05
menu.cpu.lilypad.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
lilypad.menu.cpu.atmega328.bootloader.low_fuses=0xFF
lilypad.menu.cpu.atmega328.bootloader.high_fuses=0xDA
lilypad.menu.cpu.atmega328.bootloader.extended_fuses=0x05
lilypad.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
menu.cpu.lilypad.atmega328.build.mcu=atmega328p
lilypad.menu.cpu.atmega328.build.mcu=atmega328p
## LilyPad Arduino w/ ATmega168
menu.cpu.lilypad.atmega168=ATmega168
## ----------------------------
lilypad.menu.cpu.atmega168=ATmega168
menu.cpu.lilypad.atmega168.upload.maximum_size=14336
menu.cpu.lilypad.atmega168.upload.speed=19200
lilypad.menu.cpu.atmega168.upload.maximum_size=14336
lilypad.menu.cpu.atmega168.upload.speed=19200
menu.cpu.lilypad.atmega168.bootloader.low_fuses=0xe2
menu.cpu.lilypad.atmega168.bootloader.high_fuses=0xdd
menu.cpu.lilypad.atmega168.bootloader.extended_fuses=0x00
menu.cpu.lilypad.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex
lilypad.menu.cpu.atmega168.bootloader.low_fuses=0xe2
lilypad.menu.cpu.atmega168.bootloader.high_fuses=0xdd
lilypad.menu.cpu.atmega168.bootloader.extended_fuses=0x00
lilypad.menu.cpu.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex
menu.cpu.lilypad.atmega168.build.mcu=atmega168
lilypad.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
@ -447,65 +457,69 @@ pro.bootloader.tool=avrdude
pro.bootloader.unlock_bits=0x3F
pro.bootloader.lock_bits=0x0F
pro.build.board=ARDUINO_PRO
pro.build.board=AVR_PRO
pro.build.core=arduino
pro.build.variant=standard
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
menu.cpu.pro.16MHzatmega328=ATmega328 (5V, 16 MHz)
## -------------------------------------------------
pro.menu.cpu.16MHzatmega328=ATmega328 (5V, 16 MHz)
menu.cpu.pro.16MHzatmega328.upload.maximum_size=30720
menu.cpu.pro.16MHzatmega328.upload.speed=57600
pro.menu.cpu.16MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.16MHzatmega328.upload.speed=57600
menu.cpu.pro.16MHzatmega328.bootloader.low_fuses=0xFF
menu.cpu.pro.16MHzatmega328.bootloader.high_fuses=0xDA
menu.cpu.pro.16MHzatmega328.bootloader.extended_fuses=0x05
menu.cpu.pro.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x05
pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
menu.cpu.pro.16MHzatmega328.build.mcu=atmega328p
menu.cpu.pro.16MHzatmega328.build.f_cpu=16000000L
pro.menu.cpu.16MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
menu.cpu.pro.8MHzatmega328=ATmega328 (3.3V, 8 MHz)
## --------------------------------------------------
pro.menu.cpu.8MHzatmega328=ATmega328 (3.3V, 8 MHz)
menu.cpu.pro.8MHzatmega328.upload.maximum_size=30720
menu.cpu.pro.8MHzatmega328.upload.speed=57600
pro.menu.cpu.8MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.8MHzatmega328.upload.speed=57600
menu.cpu.pro.8MHzatmega328.bootloader.low_fuses=0xFF
menu.cpu.pro.8MHzatmega328.bootloader.high_fuses=0xDA
menu.cpu.pro.8MHzatmega328.bootloader.extended_fuses=0x05
menu.cpu.pro.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0x05
pro.menu.cpu.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
menu.cpu.pro.8MHzatmega328.build.mcu=atmega328p
menu.cpu.pro.8MHzatmega328.build.f_cpu=8000000L
pro.menu.cpu.8MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168
menu.cpu.pro.16MHzatmega168=ATmega168 (5V, 16 MHz)
## -------------------------------------------------
pro.menu.cpu.16MHzatmega168=ATmega168 (5V, 16 MHz)
menu.cpu.pro.16MHzatmega168.upload.maximum_size=14336
menu.cpu.pro.16MHzatmega168.upload.speed=19200
pro.menu.cpu.16MHzatmega168.upload.maximum_size=14336
pro.menu.cpu.16MHzatmega168.upload.speed=19200
menu.cpu.pro.16MHzatmega168.bootloader.low_fuses=0xff
menu.cpu.pro.16MHzatmega168.bootloader.high_fuses=0xdd
menu.cpu.pro.16MHzatmega168.bootloader.extended_fuses=0x00
menu.cpu.pro.16MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
pro.menu.cpu.16MHzatmega168.bootloader.low_fuses=0xff
pro.menu.cpu.16MHzatmega168.bootloader.high_fuses=0xdd
pro.menu.cpu.16MHzatmega168.bootloader.extended_fuses=0x00
pro.menu.cpu.16MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
menu.cpu.pro.16MHzatmega168.build.mcu=atmega168
menu.cpu.pro.16MHzatmega168.build.f_cpu=16000000L
pro.menu.cpu.16MHzatmega168.build.mcu=atmega168
pro.menu.cpu.16MHzatmega168.build.f_cpu=16000000L
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
menu.cpu.pro.8MHzatmega168=ATmega168 (3.3V, 8 MHz)
## --------------------------------------------------
pro.menu.cpu.8MHzatmega168=ATmega168 (3.3V, 8 MHz)
menu.cpu.pro.8MHzatmega168.upload.maximum_size=14336
menu.cpu.pro.8MHzatmega168.upload.speed=19200
pro.menu.cpu.8MHzatmega168.upload.maximum_size=14336
pro.menu.cpu.8MHzatmega168.upload.speed=19200
menu.cpu.pro.8MHzatmega168.bootloader.low_fuses=0xc6
menu.cpu.pro.8MHzatmega168.bootloader.high_fuses=0xdd
menu.cpu.pro.8MHzatmega168.bootloader.extended_fuses=0x00
menu.cpu.pro.8MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
pro.menu.cpu.8MHzatmega168.bootloader.low_fuses=0xc6
pro.menu.cpu.8MHzatmega168.bootloader.high_fuses=0xdd
pro.menu.cpu.8MHzatmega168.bootloader.extended_fuses=0x00
pro.menu.cpu.8MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
menu.cpu.pro.8MHzatmega168.build.mcu=atmega168
menu.cpu.pro.8MHzatmega168.build.f_cpu=8000000L
pro.menu.cpu.8MHzatmega168.build.mcu=atmega168
pro.menu.cpu.8MHzatmega168.build.f_cpu=8000000L
##############################################################
@ -521,29 +535,32 @@ atmegang.bootloader.lock_bits=0x0F
atmegang.build.mcu=atmegang
atmegang.build.f_cpu=16000000L
atmegang.build.board=ARDUINO_NG
atmegang.build.board=AVR_NG
atmegang.build.core=arduino
atmegang.build.variant=standard
## Arduino NG or older w/ ATmega168
menu.cpu.atmegang.atmega168=ATmega168
## --------------------------------
atmegang.menu.cpu.atmega168=ATmega168
menu.cpu.atmegang.atmega168.upload.maximum_size=14336
atmegang.menu.cpu.atmega168.upload.maximum_size=14336
menu.cpu.atmegang.atmega168.bootloader.low_fuses=0xff
menu.cpu.atmegang.atmega168.bootloader.high_fuses=0xdd
menu.cpu.atmegang.atmega168.bootloader.extended_fuses=0x00
menu.cpu.atmegang.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
atmegang.menu.cpu.atmega168.bootloader.low_fuses=0xff
atmegang.menu.cpu.atmega168.bootloader.high_fuses=0xdd
atmegang.menu.cpu.atmega168.bootloader.extended_fuses=0x00
atmegang.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
menu.cpu.atmegang.atmega168.build.mcu=atmega168
atmegang.menu.cpu.atmega168.build.mcu=atmega168
## Arduino NG or older w/ ATmega8
menu.cpu.atmegang.atmega8=ATmega8
## ------------------------------
atmegang.menu.cpu.atmega8=ATmega8
menu.cpu.atmegang.atmega8.upload.maximum_size=7168
atmegang.menu.cpu.atmega8.upload.maximum_size=7168
menu.cpu.atmegang.atmega8.bootloader.low_fuses=0xdf
menu.cpu.atmegang.atmega8.bootloader.high_fuses=0xca
menu.cpu.atmegang.atmega8.bootloader.file=atmega8/ATmegaBOOT-prod-firmware-2009-11-07.hex
atmegang.menu.cpu.atmega8.bootloader.low_fuses=0xdf
atmegang.menu.cpu.atmega8.bootloader.high_fuses=0xca
atmegang.menu.cpu.atmega8.bootloader.file=atmega8/ATmegaBOOT-prod-firmware-2009-11-07.hex
atmegang.menu.cpu.atmega8.build.mcu=atmega8
menu.cpu.atmegang.atmega8.build.mcu=atmega8

View File

@ -1,8 +1,16 @@
# Arduino AVR Core and platform.
# ------------------------------
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Arduino AVR Boards
version=1.5.3
# AVR compile variables
# ---------------------
name=Arduino AVR Boards
# Default "compiler.path" is correct, change only if you want to overidde the initial value
#compiler.path={ide.path}/tools/avr/bin/..
compiler.c.cmd=avr-gcc
@ -27,10 +35,10 @@ build.extra_flags=
# --------------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
@ -50,7 +58,7 @@ recipe.size.regex=Total\s+([0-9]+).*
# AVR Uploader/Programmers tools
# -------------------
# ------------------------------
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf

View File

@ -8,7 +8,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false
arduino_due_x_dbg.upload.native_usb=false
arduino_due_x_dbg.build.mcu=cortex-m3
arduino_due_x_dbg.build.f_cpu=84000000L
arduino_due_x_dbg.build.board=ARDUINO_DUE
arduino_due_x_dbg.build.board=SAM_DUE
arduino_due_x_dbg.build.core=arduino
arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
arduino_due_x_dbg.build.ldscript=linker_scripts/gcc/flash.ld
@ -26,7 +26,7 @@ arduino_due_x.upload.wait_for_upload_port=true
arduino_due_x.upload.native_usb=true
arduino_due_x.build.mcu=cortex-m3
arduino_due_x.build.f_cpu=84000000L
arduino_due_x.build.board=ARDUINO_DUE
arduino_due_x.build.board=SAM_DUE
arduino_due_x.build.core=arduino
arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld

View File

@ -1,8 +1,15 @@
# SAM3 compile variables
# ---------------------
# Arduino SAM Core and platform.
#
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Arduino ARM (32-bits) Boards
version=1.5.3
# SAM3 compile variables
# ----------------------
compiler.path={runtime.ide.path}/hardware/tools/g++_arm_none_eabi/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf
@ -30,10 +37,10 @@ compiler.libsam.c.flags="-I{build.system.path}/libsam" "-I{build.system.path}/CM
# ---------------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"