mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Updated libaries and core handling.
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification Merge branch 'lib-1.5-cores' into ide-1.5.x
This commit is contained in:
commit
443d0e1f26
@ -30,16 +30,17 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import processing.app.debug.TargetBoard;
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
|
import processing.app.debug.TargetPlatformException;
|
||||||
import processing.app.helpers.FileUtils;
|
import processing.app.helpers.FileUtils;
|
||||||
import processing.app.helpers.Maps;
|
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
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.packages.LibraryList;
|
||||||
import processing.app.tools.MapWithSubkeys;
|
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
@ -116,7 +117,6 @@ public class Base {
|
|||||||
static File portableFolder = null;
|
static File portableFolder = null;
|
||||||
static final String portableSketchbookFolder = "sketchbook";
|
static final String portableSketchbookFolder = "sketchbook";
|
||||||
|
|
||||||
|
|
||||||
static public void main(String args[]) throws Exception {
|
static public void main(String args[]) throws Exception {
|
||||||
initPlatform();
|
initPlatform();
|
||||||
|
|
||||||
@ -290,6 +290,11 @@ public class Base {
|
|||||||
packages = new HashMap<String, TargetPackage>();
|
packages = new HashMap<String, TargetPackage>();
|
||||||
loadHardware(getHardwareFolder());
|
loadHardware(getHardwareFolder());
|
||||||
loadHardware(getSketchbookHardwareFolder());
|
loadHardware(getSketchbookHardwareFolder());
|
||||||
|
if (packages.size() == 0) {
|
||||||
|
System.out.println(_("No valid configured cores found! Exiting..."));
|
||||||
|
System.exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
// Setup board-dependent variables.
|
// Setup board-dependent variables.
|
||||||
onBoardOrPortChange();
|
onBoardOrPortChange();
|
||||||
|
|
||||||
@ -403,8 +408,9 @@ public class Base {
|
|||||||
* sketch that was used (if any), and restores other Editor settings.
|
* sketch that was used (if any), and restores other Editor settings.
|
||||||
* The complement to "storePreferences", this is called when the
|
* The complement to "storePreferences", this is called when the
|
||||||
* application is first launched.
|
* application is first launched.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected boolean restoreSketches() {
|
protected boolean restoreSketches() throws Exception {
|
||||||
// figure out window placement
|
// figure out window placement
|
||||||
|
|
||||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
@ -664,8 +670,9 @@ public class Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new untitled document in a new sketch window.
|
* Create a new untitled document in a new sketch window.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void handleNew() {
|
public void handleNew() throws Exception {
|
||||||
try {
|
try {
|
||||||
String path = createNewUntitled();
|
String path = createNewUntitled();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
@ -733,8 +740,9 @@ public class Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt for a sketch to open, and open it in a new window.
|
* 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
|
// get the frontmost window frame for placing file dialog
|
||||||
FileDialog fd = new FileDialog(activeEditor,
|
FileDialog fd = new FileDialog(activeEditor,
|
||||||
_("Open an Arduino sketch..."),
|
_("Open an Arduino sketch..."),
|
||||||
@ -769,13 +777,14 @@ public class Base {
|
|||||||
* @param path Path to the pde file for the sketch in question
|
* @param path Path to the pde file for the sketch in question
|
||||||
* @return the Editor object, so that properties (like 'untitled')
|
* @return the Editor object, so that properties (like 'untitled')
|
||||||
* can be set by the caller
|
* can be set by the caller
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public Editor handleOpen(String path) {
|
public Editor handleOpen(String path) throws Exception {
|
||||||
return handleOpen(path, nextEditorLocation());
|
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);
|
// System.err.println("entering handleOpen " + path);
|
||||||
|
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
@ -1007,7 +1016,11 @@ public class Base {
|
|||||||
item = Editor.newJMenuItem(_("Open..."), 'O');
|
item = Editor.newJMenuItem(_("Open..."), 'O');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
try {
|
||||||
handleOpenPrompt();
|
handleOpenPrompt();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
@ -1073,6 +1086,7 @@ public class Base {
|
|||||||
|
|
||||||
// Split between user supplied libraries and IDE libraries
|
// Split between user supplied libraries and IDE libraries
|
||||||
TargetPlatform targetPlatform = getTargetPlatform();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
|
|
||||||
if (targetPlatform != null) {
|
if (targetPlatform != null) {
|
||||||
LibraryList ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
LibraryList userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
@ -1080,11 +1094,14 @@ public class Base {
|
|||||||
// Find the current target. Get the platform, and then select the
|
// Find the current target. Get the platform, and then select the
|
||||||
// correct name and core path.
|
// correct name and core path.
|
||||||
PreferencesMap prefs = targetPlatform.getPreferences();
|
PreferencesMap prefs = targetPlatform.getPreferences();
|
||||||
String targetname = prefs.get("name");
|
if (prefs != null) {
|
||||||
|
String platformName = prefs.get("name");
|
||||||
JMenuItem platformItem = new JMenuItem(_(targetname));
|
if (platformName != null) {
|
||||||
|
JMenuItem platformItem = new JMenuItem(_(platformName));
|
||||||
platformItem.setEnabled(false);
|
platformItem.setEnabled(false);
|
||||||
importMenu.add(platformItem);
|
importMenu.add(platformItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ideLibs.size() > 0) {
|
if (ideLibs.size() > 0) {
|
||||||
importMenu.addSeparator();
|
importMenu.addSeparator();
|
||||||
addLibraries(importMenu, ideLibs);
|
addLibraries(importMenu, ideLibs);
|
||||||
@ -1180,9 +1197,9 @@ public class Base {
|
|||||||
try {
|
try {
|
||||||
libraries = scanLibraries(librariesFolders);
|
libraries = scanLibraries(librariesFolders);
|
||||||
} catch (IOException e) {
|
} 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);
|
libraries = libraries.filterByArchitecture(currentArch);
|
||||||
|
|
||||||
// Populate importToLibraryTable
|
// Populate importToLibraryTable
|
||||||
@ -1204,12 +1221,8 @@ public class Base {
|
|||||||
editor.onBoardOrPortChange();
|
editor.onBoardOrPortChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildBoardsMenu(JMenu toolsMenu, final Editor editor) {
|
public void rebuildBoardsMenu(JMenu toolsMenu, Editor editor) throws Exception {
|
||||||
JMenu boardsMenu = makeOrGetBoardMenu(toolsMenu, _("Board"));
|
JMenu boardsMenu = getBoardCustomMenu();
|
||||||
|
|
||||||
String selPackage = Preferences.get("target_package");
|
|
||||||
String selPlatform = Preferences.get("target_platform");
|
|
||||||
String selBoard = Preferences.get("board");
|
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
|
|
||||||
@ -1218,97 +1231,42 @@ public class Base {
|
|||||||
ButtonGroup boardsButtonGroup = new ButtonGroup();
|
ButtonGroup boardsButtonGroup = new ButtonGroup();
|
||||||
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<String, 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
|
// Cycle through all packages
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : packages.values()) {
|
||||||
String packageName = targetPackage.getName();
|
|
||||||
// For every package cycle through all platform
|
// For every package cycle through all platform
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
String platformName = targetPlatform.getName();
|
|
||||||
Map<String, PreferencesMap> boards = targetPlatform.getBoards();
|
|
||||||
|
|
||||||
if (targetPlatform.getPreferences().get("name") == null || targetPlatform.getBoards().isEmpty()) {
|
// Add a separator from the previous platform
|
||||||
continue;
|
if (!first)
|
||||||
}
|
|
||||||
|
|
||||||
// Add a title for each group of boards
|
|
||||||
if (!first) {
|
|
||||||
boardsMenu.add(new JSeparator());
|
boardsMenu.add(new JSeparator());
|
||||||
}
|
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
JMenuItem separator = new JMenuItem(_(targetPlatform.getPreferences().get("name")));
|
// Add a title for each platform
|
||||||
separator.setEnabled(false);
|
String platformLabel = targetPlatform.getPreferences().get("name");
|
||||||
boardsMenu.add(separator);
|
if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
|
||||||
|
JMenuItem menuLabel = new JMenuItem(_(platformLabel));
|
||||||
// For every platform cycle through all boards
|
menuLabel.setEnabled(false);
|
||||||
for (final String boardID : targetPlatform.getBoards().keySet()) {
|
boardsMenu.add(menuLabel);
|
||||||
// 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);
|
boardsMenu.add(item);
|
||||||
boardsButtonGroup.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) {
|
private static void filterVisibilityOfSubsequentBoardMenus(String boardID, int fromIndex) {
|
||||||
for (int i = fromIndex; i < Editor.boardsMenus.size(); i++) {
|
for (int i = fromIndex; i < Editor.boardsMenus.size(); i++) {
|
||||||
JMenu menu = Editor.boardsMenus.get(i);
|
JMenu menu = Editor.boardsMenus.get(i);
|
||||||
@ -1330,9 +1369,9 @@ public class Base {
|
|||||||
JMenuItem menuItem = menu.getItem(m);
|
JMenuItem menuItem = menu.getItem(m);
|
||||||
menuItem.setVisible(menuItem.getAction().getValue("board").equals(boardID));
|
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);
|
JMenuItem visibleSelectedOrFirstMenuItem = selectVisibleSelectedOrFirstMenuItem(menu);
|
||||||
if (!visibleSelectedOrFirstMenuItem.isSelected()) {
|
if (!visibleSelectedOrFirstMenuItem.isSelected()) {
|
||||||
visibleSelectedOrFirstMenuItem.setSelected(true);
|
visibleSelectedOrFirstMenuItem.setSelected(true);
|
||||||
@ -1351,18 +1390,24 @@ public class Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JMenu makeOrGetBoardMenu(JMenu toolsMenu, String label) {
|
private JMenu makeBoardCustomMenu(JMenu toolsMenu, String label) {
|
||||||
for (JMenu menu : Editor.boardsMenus) {
|
|
||||||
if (label.equals(menu.getText())) {
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JMenu menu = new JMenu(label);
|
JMenu menu = new JMenu(label);
|
||||||
Editor.boardsMenus.add(menu);
|
Editor.boardsMenus.add(menu);
|
||||||
toolsMenu.add(menu);
|
toolsMenu.add(menu);
|
||||||
return 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) {
|
private static JMenuItem selectVisibleSelectedOrFirstMenuItem(JMenu menu) {
|
||||||
JMenuItem firstVisible = null;
|
JMenuItem firstVisible = null;
|
||||||
for (int i = 0; i < menu.getItemCount(); i++) {
|
for (int i = 0; i < menu.getItemCount(); i++) {
|
||||||
@ -1416,7 +1461,7 @@ public class Base {
|
|||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : packages.values()) {
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
||||||
String id = targetPackage.getName() + ":" + programmer;
|
String id = targetPackage.getId() + ":" + programmer;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
AbstractAction action = new AbstractAction(targetPlatform
|
AbstractAction action = new AbstractAction(targetPlatform
|
||||||
@ -1494,7 +1539,11 @@ public class Base {
|
|||||||
if (replace) {
|
if (replace) {
|
||||||
handleOpenReplace(path);
|
handleOpenReplace(path);
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
handleOpen(path);
|
handleOpen(path);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showWarning(_("Sketch Does Not Exist"),
|
showWarning(_("Sketch Does Not Exist"),
|
||||||
@ -1604,7 +1653,13 @@ public class Base {
|
|||||||
if (target.equals("tools"))
|
if (target.equals("tools"))
|
||||||
continue;
|
continue;
|
||||||
File subfolder = new File(folder, target);
|
File subfolder = new File(folder, target);
|
||||||
|
|
||||||
|
try {
|
||||||
packages.put(target, new TargetPackage(target, subfolder));
|
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"));
|
return getTargetPlatform(pack, Preferences.get("target_platform"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static public Map<String, String> getBoardPreferences() {
|
static public PreferencesMap getBoardPreferences() {
|
||||||
TargetPlatform target = getTargetPlatform();
|
TargetBoard board = getTargetBoard();
|
||||||
String board = Preferences.get("board");
|
|
||||||
Map<String, String> boardPreferences = Maps.merge(target.getBoards().get(board), new LinkedHashMap<String, String>());
|
PreferencesMap prefs = new PreferencesMap(board.getPreferences());
|
||||||
if (target.getCustomMenus() != null) {
|
for (String menuId : board.getMenuIds()) {
|
||||||
for (String customMenuID : target.getCustomMenus().getKeys()) {
|
String entry = Preferences.get("custom_" + menuId);
|
||||||
MapWithSubkeys boardCustomMenu = target.getCustomMenus().get(customMenuID).get(board);
|
if (board.hasMenu(menuId) && entry != null &&
|
||||||
String selectedCustomMenuEntry = Preferences.get("custom_" + customMenuID);
|
entry.startsWith(board.getId())) {
|
||||||
if (boardCustomMenu != null && selectedCustomMenuEntry != null && selectedCustomMenuEntry.startsWith(board)) {
|
String selectionId = entry.substring(entry.indexOf("_") + 1);
|
||||||
String menuEntryId = selectedCustomMenuEntry.substring(selectedCustomMenuEntry.indexOf("_") + 1);
|
prefs.putAll(board.getMenuPreferences(menuId, selectionId));
|
||||||
Maps.merge(boardCustomMenu.get(menuEntryId).getValues(), boardPreferences);
|
prefs.put("name", prefs.get("name") + ", " +
|
||||||
boardPreferences.put("name", boardPreferences.get("name") + ", " + boardCustomMenu.getValueOf(menuEntryId));
|
board.getMenuLabel(menuId, selectionId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return prefs;
|
||||||
}
|
}
|
||||||
return boardPreferences;
|
|
||||||
|
public static TargetBoard getTargetBoard() {
|
||||||
|
String boardId = Preferences.get("board");
|
||||||
|
return getTargetPlatform().getBoard(boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public File getPortableFolder() {
|
static public File getPortableFolder() {
|
||||||
|
@ -150,7 +150,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
Runnable exportAppHandler;
|
Runnable exportAppHandler;
|
||||||
|
|
||||||
|
|
||||||
public Editor(Base ibase, String path, int[] location) {
|
public Editor(Base ibase, String path, int[] location) throws Exception {
|
||||||
super("Arduino");
|
super("Arduino");
|
||||||
this.base = ibase;
|
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();
|
JMenuBar menubar = new JMenuBar();
|
||||||
menubar.add(buildFileMenu());
|
menubar.add(buildFileMenu());
|
||||||
menubar.add(buildEditMenu());
|
menubar.add(buildEditMenu());
|
||||||
@ -494,7 +494,11 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
item = newJMenuItem(_("New"), 'N');
|
item = newJMenuItem(_("New"), 'N');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
try {
|
||||||
base.handleNew();
|
base.handleNew();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fileMenu.add(item);
|
fileMenu.add(item);
|
||||||
@ -502,7 +506,11 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
item = Editor.newJMenuItem(_("Open..."), 'O');
|
item = Editor.newJMenuItem(_("Open..."), 'O');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
try {
|
||||||
base.handleOpenPrompt();
|
base.handleOpenPrompt();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fileMenu.add(item);
|
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"));
|
toolsMenu = new JMenu(_("Tools"));
|
||||||
JMenu menu = toolsMenu;
|
JMenu menu = toolsMenu;
|
||||||
JMenuItem item;
|
JMenuItem item;
|
||||||
@ -690,6 +698,11 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
if (boardsMenus == null) {
|
if (boardsMenus == null) {
|
||||||
boardsMenus = new LinkedList<JMenu>();
|
boardsMenus = new LinkedList<JMenu>();
|
||||||
|
|
||||||
|
JMenu boardsMenu = new JMenu(_("Board"));
|
||||||
|
Editor.boardsMenus.add(boardsMenu);
|
||||||
|
toolsMenu.add(boardsMenu);
|
||||||
|
|
||||||
base.rebuildBoardsMenu(toolsMenu, this);
|
base.rebuildBoardsMenu(toolsMenu, this);
|
||||||
//Debug: rebuild imports
|
//Debug: rebuild imports
|
||||||
importMenu.removeAll();
|
importMenu.removeAll();
|
||||||
|
@ -335,7 +335,11 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
|
|||||||
|
|
||||||
case NEW:
|
case NEW:
|
||||||
if (shiftPressed) {
|
if (shiftPressed) {
|
||||||
|
try {
|
||||||
editor.base.handleNew();
|
editor.base.handleNew();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
editor.base.handleNewReplace();
|
editor.base.handleNewReplace();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import processing.app.Base;
|
import processing.app.Base;
|
||||||
|
import processing.app.I18n;
|
||||||
import processing.app.Preferences;
|
import processing.app.Preferences;
|
||||||
import processing.app.Serial;
|
import processing.app.Serial;
|
||||||
import processing.app.SerialException;
|
import processing.app.SerialException;
|
||||||
@ -249,18 +250,46 @@ public class BasicUploader extends Uploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean burnBootloader() throws RunnerException {
|
public boolean burnBootloader() throws RunnerException {
|
||||||
String programmer = Preferences.get("programmer");
|
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
|
|
||||||
|
// Find preferences for the selected programmer
|
||||||
|
PreferencesMap programmerPrefs;
|
||||||
|
String programmer = Preferences.get("programmer");
|
||||||
if (programmer.contains(":")) {
|
if (programmer.contains(":")) {
|
||||||
String[] split = programmer.split(":", 2);
|
String[] split = programmer.split(":", 2);
|
||||||
targetPlatform = Base.getCurrentTargetPlatformFromPackage(split[0]);
|
TargetPlatform platform = Base
|
||||||
|
.getCurrentTargetPlatformFromPackage(split[0]);
|
||||||
programmer = split[1];
|
programmer = split[1];
|
||||||
|
programmerPrefs = platform.getProgrammer(programmer);
|
||||||
|
} else {
|
||||||
|
programmerPrefs = targetPlatform.getProgrammer(programmer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build configuration for the current programmer
|
||||||
PreferencesMap prefs = Preferences.getMap();
|
PreferencesMap prefs = Preferences.getMap();
|
||||||
prefs.putAll(Base.getBoardPreferences());
|
prefs.putAll(Base.getBoardPreferences());
|
||||||
prefs.putAll(targetPlatform.getProgrammer(programmer));
|
prefs.putAll(programmerPrefs);
|
||||||
prefs.putAll(targetPlatform.getTool(prefs.get("bootloader.tool")));
|
|
||||||
|
// 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) {
|
if (verbose) {
|
||||||
prefs.put("erase.verbose", prefs.get("erase.params.verbose"));
|
prefs.put("erase.verbose", prefs.get("erase.params.verbose"));
|
||||||
prefs.put("bootloader.verbose", prefs.get("bootloader.params.verbose"));
|
prefs.put("bootloader.verbose", prefs.get("bootloader.params.verbose"));
|
||||||
@ -270,12 +299,6 @@ public class BasicUploader extends Uploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// if (prefs.get("program.disable_flushing") == null
|
|
||||||
// || prefs.get("program.disable_flushing").toLowerCase().equals("false"))
|
|
||||||
// {
|
|
||||||
// flushSerialBuffer();
|
|
||||||
// }
|
|
||||||
|
|
||||||
String pattern = prefs.get("erase.pattern");
|
String pattern = prefs.get("erase.pattern");
|
||||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||||
if (!executeUploadCommand(cmd))
|
if (!executeUploadCommand(cmd))
|
||||||
|
@ -132,11 +132,29 @@ public class Compiler implements MessageConsumer {
|
|||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the board needs a platform from another package
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
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
|
// Merge all the global preference configuration in order of priority
|
||||||
PreferencesMap p = new PreferencesMap();
|
PreferencesMap p = new PreferencesMap();
|
||||||
p.putAll(Preferences.getMap());
|
p.putAll(Preferences.getMap());
|
||||||
|
if (corePlatform != null)
|
||||||
|
p.putAll(corePlatform.getPreferences());
|
||||||
p.putAll(targetPlatform.getPreferences());
|
p.putAll(targetPlatform.getPreferences());
|
||||||
p.putAll(Base.getBoardPreferences());
|
p.putAll(Base.getBoardPreferences());
|
||||||
for (String k : p.keySet()) {
|
for (String k : p.keySet()) {
|
||||||
@ -146,28 +164,23 @@ public class Compiler implements MessageConsumer {
|
|||||||
|
|
||||||
p.put("build.path", _buildPath);
|
p.put("build.path", _buildPath);
|
||||||
p.put("build.project_name", _primaryClassName);
|
p.put("build.project_name", _primaryClassName);
|
||||||
targetArch = targetPlatform.getName();
|
targetArch = targetPlatform.getId();
|
||||||
p.put("build.arch", targetArch.toUpperCase());
|
p.put("build.arch", targetArch.toUpperCase());
|
||||||
|
|
||||||
if (!p.containsKey("compiler.path"))
|
if (!p.containsKey("compiler.path"))
|
||||||
p.put("compiler.path", Base.getAvrBasePath());
|
p.put("compiler.path", Base.getAvrBasePath());
|
||||||
|
|
||||||
// Core folder
|
// Core folder
|
||||||
String core = p.get("build.core");
|
TargetPlatform tp = corePlatform;
|
||||||
TargetPlatform tp;
|
if (tp == null)
|
||||||
if (!core.contains(":")) {
|
|
||||||
tp = targetPlatform;
|
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");
|
File coreFolder = new File(tp.getFolder(), "cores");
|
||||||
coreFolder = new File(coreFolder, core);
|
coreFolder = new File(coreFolder, core);
|
||||||
|
p.put("build.core", core);
|
||||||
p.put("build.core.path", coreFolder.getAbsolutePath());
|
p.put("build.core.path", coreFolder.getAbsolutePath());
|
||||||
|
|
||||||
// System Folder
|
// System Folder
|
||||||
File systemFolder = targetPlatform.getFolder();
|
File systemFolder = tp.getFolder();
|
||||||
systemFolder = new File(systemFolder, "system");
|
systemFolder = new File(systemFolder, "system");
|
||||||
p.put("build.system.path", systemFolder.getAbsolutePath());
|
p.put("build.system.path", systemFolder.getAbsolutePath());
|
||||||
|
|
||||||
@ -179,8 +192,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
t = targetPlatform;
|
t = targetPlatform;
|
||||||
} else {
|
} else {
|
||||||
String[] split = variant.split(":", 2);
|
String[] split = variant.split(":", 2);
|
||||||
t = Base
|
t = Base.getTargetPlatform(split[0], targetPlatform.getId());
|
||||||
.getTargetPlatform(split[0], Preferences.get("target_platform"));
|
|
||||||
variant = split[1];
|
variant = split[1];
|
||||||
}
|
}
|
||||||
File variantFolder = new File(t.getFolder(), "variants");
|
File variantFolder = new File(t.getFolder(), "variants");
|
||||||
|
132
app/src/processing/app/debug/TargetBoard.java
Normal file
132
app/src/processing/app/debug/TargetBoard.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,29 +25,30 @@ package processing.app.debug;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
|
|
||||||
public class TargetPackage {
|
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) {
|
public TargetPackage(String _id, File _folder) throws TargetPlatformException {
|
||||||
this.name = name;
|
id = _id;
|
||||||
|
|
||||||
String[] platformsList = folder.list(new OnlyDirs());
|
File[] folders = _folder.listFiles(new OnlyDirs());
|
||||||
if (platformsList != null) {
|
if (folders == null)
|
||||||
for (String platformName : platformsList) {
|
return;
|
||||||
File platformFolder = new File(folder, platformName);
|
|
||||||
if (platformFolder.exists() && platformFolder.canRead()) {
|
for (File subFolder : folders) {
|
||||||
TargetPlatform platform = new TargetPlatform(platformName, platformFolder);
|
if (!subFolder.exists() || !subFolder.canRead())
|
||||||
platforms.put(platformName, platform);
|
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);
|
return platforms.get(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getId() {
|
||||||
return name;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,81 +24,121 @@
|
|||||||
package processing.app.debug;
|
package processing.app.debug;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
import static processing.app.I18n.format;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.tools.MapWithSubkeys;
|
|
||||||
|
|
||||||
public class TargetPlatform {
|
public class TargetPlatform {
|
||||||
private String name;
|
|
||||||
|
private String id;
|
||||||
private File folder;
|
private File folder;
|
||||||
private Map<String, PreferencesMap> boards;
|
private TargetPackage containerPackage;
|
||||||
private Map<String, PreferencesMap> programmers;
|
|
||||||
private PreferencesMap preferences;
|
|
||||||
private MapWithSubkeys customMenus;
|
|
||||||
|
|
||||||
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;
|
folder = _folder;
|
||||||
boards = new HashMap<String, PreferencesMap>();
|
containerPackage = parent;
|
||||||
programmers = new HashMap<String, PreferencesMap>();
|
|
||||||
preferences = new PreferencesMap();
|
|
||||||
|
|
||||||
|
// 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 {
|
try {
|
||||||
File boardsFile = new File(_folder, "boards.txt");
|
Map<String, PreferencesMap> boardsPreferences = new PreferencesMap(
|
||||||
if (boardsFile.exists() && boardsFile.canRead()) {
|
boardsFile).firstLevelMap();
|
||||||
PreferencesMap boardPreferences = new PreferencesMap();
|
|
||||||
boardPreferences.load(boardsFile);
|
// Create custom menus for this platform
|
||||||
boards = boardPreferences.createFirstLevelMap();
|
PreferencesMap menus = boardsPreferences.get("menu");
|
||||||
customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
|
if (menus != null)
|
||||||
boards.remove("menu");
|
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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
throw new TargetPlatformException(format(_("Error loading {0}"),
|
||||||
System.err.println("Error loading boards from boards.txt: " + e);
|
boardsFile.getAbsolutePath()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File platformsFile = new File(folder, "platform.txt");
|
||||||
try {
|
try {
|
||||||
File platformsFile = new File(_folder, "platform.txt");
|
|
||||||
if (platformsFile.exists() && platformsFile.canRead()) {
|
if (platformsFile.exists() && platformsFile.canRead()) {
|
||||||
preferences.load(platformsFile);
|
preferences.load(platformsFile);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Error loading platforms from platform.txt: " + e);
|
throw new TargetPlatformException(
|
||||||
|
format(_("Error loading {0}"), platformsFile.getAbsolutePath()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File progFile = new File(folder, "programmers.txt");
|
||||||
try {
|
try {
|
||||||
File programmersFile = new File(_folder, "programmers.txt");
|
if (progFile.exists() && progFile.canRead()) {
|
||||||
if (programmersFile.exists() && programmersFile.canRead()) {
|
|
||||||
PreferencesMap prefs = new PreferencesMap();
|
PreferencesMap prefs = new PreferencesMap();
|
||||||
prefs.load(programmersFile);
|
prefs.load(progFile);
|
||||||
programmers = prefs.createFirstLevelMap();
|
programmers = prefs.firstLevelMap();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
System.err
|
throw new TargetPlatformException(format(_("Error loading {0}"), progFile
|
||||||
.println("Error loading programmers from programmers.txt: " + e);
|
.getAbsolutePath()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getId() {
|
||||||
return name;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFolder() {
|
public File getFolder() {
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, PreferencesMap> getBoards() {
|
public Map<String, TargetBoard> getBoards() {
|
||||||
return boards;
|
return boards;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapWithSubkeys getCustomMenus() {
|
public PreferencesMap getCustomMenus() {
|
||||||
return customMenus;
|
return customMenus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<String> getCustomMenuIds() {
|
||||||
|
return customMenus.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, PreferencesMap> getProgrammers() {
|
public Map<String, PreferencesMap> getProgrammers() {
|
||||||
return programmers;
|
return programmers;
|
||||||
}
|
}
|
||||||
@ -108,10 +148,26 @@ public class TargetPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PreferencesMap getTool(String tool) {
|
public PreferencesMap getTool(String tool) {
|
||||||
return getPreferences().createSubTree("tools").createSubTree(tool);
|
return getPreferences().subTree("tools").subTree(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreferencesMap getPreferences() {
|
public PreferencesMap getPreferences() {
|
||||||
return preferences;
|
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 + "}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
22
app/src/processing/app/debug/TargetPlatformException.java
Normal file
22
app/src/processing/app/debug/TargetPlatformException.java
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -28,17 +28,42 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
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.app.Base;
|
||||||
import processing.core.PApplet;
|
import processing.core.PApplet;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class PreferencesMap extends LinkedHashMap<String, String> {
|
public class PreferencesMap extends LinkedHashMap<String, String> {
|
||||||
|
|
||||||
public PreferencesMap(Map<String, String> table) {
|
public PreferencesMap(Map<String, String> table) {
|
||||||
super(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() {
|
public PreferencesMap() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -75,7 +100,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is needed to avoid ConcurrentAccessExceptions
|
// 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
|
// Override keys that have OS specific versions
|
||||||
for (String key : keys) {
|
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
|
* Create a new PreferenceMap that contains all the top level pairs of the
|
||||||
* of the current mapping. E.g. the folowing mapping:<br />
|
* current mapping. E.g. the folowing mapping:<br />
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Map (
|
* Map (
|
||||||
|
* alpha = Alpha
|
||||||
* alpha.some.keys = v1
|
* alpha.some.keys = v1
|
||||||
* alpha.other.keys = v2
|
* 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
|
* beta.some.keys = v3
|
||||||
* )
|
* )
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -120,7 +183,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String, PreferencesMap> createFirstLevelMap() {
|
public Map<String, PreferencesMap> firstLevelMap() {
|
||||||
Map<String, PreferencesMap> res = new LinkedHashMap<String, PreferencesMap>();
|
Map<String, PreferencesMap> res = new LinkedHashMap<String, PreferencesMap>();
|
||||||
for (String key : keySet()) {
|
for (String key : keySet()) {
|
||||||
int dot = key.indexOf('.');
|
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.
|
* Create a new PreferenceMap using a subtree of the current mapping. Top
|
||||||
* with the folowing mapping:<br />
|
* level pairs are ignored. E.g. with the following mapping:<br />
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Map (
|
* Map (
|
||||||
|
* alpha = Alpha
|
||||||
* alpha.some.keys = v1
|
* alpha.some.keys = v1
|
||||||
* alpha.other.keys = v2
|
* alpha.other.keys = v2
|
||||||
|
* beta = Beta
|
||||||
* beta.some.keys = v3
|
* beta.some.keys = v3
|
||||||
* )
|
* )
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -161,7 +226,7 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
|||||||
* @param parent
|
* @param parent
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PreferencesMap createSubTree(String parent) {
|
public PreferencesMap subTree(String parent) {
|
||||||
PreferencesMap res = new PreferencesMap();
|
PreferencesMap res = new PreferencesMap();
|
||||||
parent += ".";
|
parent += ".";
|
||||||
int parentLen = parent.length();
|
int parentLen = parent.length();
|
||||||
@ -172,5 +237,16 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
|||||||
return res;
|
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("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,11 @@ public class ThinkDifferent implements ApplicationListener {
|
|||||||
public void handleOpenFile(ApplicationEvent ae) {
|
public void handleOpenFile(ApplicationEvent ae) {
|
||||||
// System.out.println("got open file event " + ae.getFilename());
|
// System.out.println("got open file event " + ae.getFilename());
|
||||||
String filename = ae.getFilename();
|
String filename = ae.getFilename();
|
||||||
|
try {
|
||||||
base.handleOpen(filename);
|
base.handleOpen(filename);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
ae.setHandled(true);
|
ae.setHandled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ uno.bootloader.file=optiboot/optiboot_atmega328.hex
|
|||||||
|
|
||||||
uno.build.mcu=atmega328p
|
uno.build.mcu=atmega328p
|
||||||
uno.build.f_cpu=16000000L
|
uno.build.f_cpu=16000000L
|
||||||
uno.build.board=ARDUINO_UNO
|
uno.build.board=AVR_UNO
|
||||||
uno.build.core=arduino
|
uno.build.core=arduino
|
||||||
uno.build.variant=standard
|
uno.build.variant=standard
|
||||||
|
|
||||||
@ -37,33 +37,35 @@ atmega328diecimila.bootloader.unlock_bits=0x3F
|
|||||||
atmega328diecimila.bootloader.lock_bits=0x0F
|
atmega328diecimila.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
atmega328diecimila.build.f_cpu=16000000L
|
atmega328diecimila.build.f_cpu=16000000L
|
||||||
atmega328diecimila.build.board=ARDUINO_DUEMILANOVE
|
atmega328diecimila.build.board=AVR_DUEMILANOVE
|
||||||
atmega328diecimila.build.core=arduino
|
atmega328diecimila.build.core=arduino
|
||||||
atmega328diecimila.build.variant=standard
|
atmega328diecimila.build.variant=standard
|
||||||
|
|
||||||
## Arduino Duemilanove or Diecimila w/ ATmega328
|
## Arduino Duemilanove or Diecimila w/ ATmega328
|
||||||
menu.cpu.atmega328diecimila.atmega328=ATmega328
|
## ---------------------------------------------
|
||||||
|
atmega328diecimila.menu.cpu.atmega328=ATmega328
|
||||||
|
|
||||||
menu.cpu.atmega328diecimila.atmega328.upload.maximum_size=30720
|
atmega328diecimila.menu.cpu.atmega328.upload.maximum_size=30720
|
||||||
menu.cpu.atmega328diecimila.atmega328.upload.speed=57600
|
atmega328diecimila.menu.cpu.atmega328.upload.speed=57600
|
||||||
|
|
||||||
menu.cpu.atmega328diecimila.atmega328.bootloader.high_fuses=0xDA
|
atmega328diecimila.menu.cpu.atmega328.bootloader.high_fuses=0xDA
|
||||||
menu.cpu.atmega328diecimila.atmega328.bootloader.extended_fuses=0x05
|
atmega328diecimila.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.atmega328diecimila.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
|
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
|
## Arduino Duemilanove or Diecimila w/ ATmega168
|
||||||
menu.cpu.atmega328diecimila.atmega168=ATmega168
|
## ---------------------------------------------
|
||||||
|
atmega328diecimila.menu.cpu.atmega168=ATmega168
|
||||||
|
|
||||||
menu.cpu.atmega328diecimila.atmega168.upload.maximum_size=14336
|
atmega328diecimila.menu.cpu.atmega168.upload.maximum_size=14336
|
||||||
menu.cpu.atmega328diecimila.atmega168.upload.speed=19200
|
atmega328diecimila.menu.cpu.atmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.atmega328diecimila.atmega168.bootloader.high_fuses=0xdd
|
atmega328diecimila.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.atmega328diecimila.atmega168.bootloader.extended_fuses=0x00
|
atmega328diecimila.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.atmega328diecimila.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
|
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.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
nano.build.f_cpu=16000000L
|
nano.build.f_cpu=16000000L
|
||||||
nano.build.board=ARDUINO_NANO
|
nano.build.board=AVR_NANO
|
||||||
nano.build.core=arduino
|
nano.build.core=arduino
|
||||||
nano.build.variant=eightanaloginputs
|
nano.build.variant=eightanaloginputs
|
||||||
|
|
||||||
## Arduino Nano w/ ATmega328
|
## Arduino Nano w/ ATmega328
|
||||||
menu.cpu.nano.atmega328=ATmega328
|
## -------------------------
|
||||||
|
nano.menu.cpu.atmega328=ATmega328
|
||||||
|
|
||||||
menu.cpu.nano.atmega328.upload.maximum_size=30720
|
nano.menu.cpu.atmega328.upload.maximum_size=30720
|
||||||
menu.cpu.nano.atmega328.upload.speed=57600
|
nano.menu.cpu.atmega328.upload.speed=57600
|
||||||
|
|
||||||
menu.cpu.nano.atmega328.bootloader.low_fuses=0xFF
|
nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF
|
||||||
menu.cpu.nano.atmega328.bootloader.high_fuses=0xDA
|
nano.menu.cpu.atmega328.bootloader.high_fuses=0xDA
|
||||||
menu.cpu.nano.atmega328.bootloader.extended_fuses=0x05
|
nano.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.nano.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
|
nano.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
|
||||||
|
|
||||||
menu.cpu.nano.atmega328.build.mcu=atmega328p
|
menu.cpu.nano.atmega328.build.mcu=atmega328p
|
||||||
|
|
||||||
## Arduino Nano w/ ATmega168
|
## Arduino Nano w/ ATmega168
|
||||||
menu.cpu.nano.atmega168=ATmega168
|
## -------------------------
|
||||||
|
nano.menu.cpu.atmega168=ATmega168
|
||||||
|
|
||||||
menu.cpu.nano.atmega168.upload.maximum_size=14336
|
nano.menu.cpu.atmega168.upload.maximum_size=14336
|
||||||
menu.cpu.nano.atmega168.upload.speed=19200
|
nano.menu.cpu.atmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.nano.atmega168.bootloader.low_fuses=0xff
|
nano.menu.cpu.atmega168.bootloader.low_fuses=0xff
|
||||||
menu.cpu.nano.atmega168.bootloader.high_fuses=0xdd
|
nano.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.nano.atmega168.bootloader.extended_fuses=0x00
|
nano.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.nano.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
|
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.mcu=atmega2560
|
||||||
mega2560.build.f_cpu=16000000L
|
mega2560.build.f_cpu=16000000L
|
||||||
mega2560.build.board=ARDUINO_MEGA2560
|
mega2560.build.board=AVR_MEGA2560
|
||||||
mega2560.build.core=arduino
|
mega2560.build.core=arduino
|
||||||
mega2560.build.variant=mega
|
mega2560.build.variant=mega
|
||||||
|
|
||||||
@ -151,7 +155,7 @@ mega.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
mega.build.mcu=atmega1280
|
mega.build.mcu=atmega1280
|
||||||
mega.build.f_cpu=16000000L
|
mega.build.f_cpu=16000000L
|
||||||
mega.build.board=ARDUINO_MEGA
|
mega.build.board=AVR_MEGA
|
||||||
mega.build.core=arduino
|
mega.build.core=arduino
|
||||||
mega.build.variant=mega
|
mega.build.variant=mega
|
||||||
|
|
||||||
@ -178,7 +182,7 @@ leonardo.build.mcu=atmega32u4
|
|||||||
leonardo.build.f_cpu=16000000L
|
leonardo.build.f_cpu=16000000L
|
||||||
leonardo.build.vid=0x2341
|
leonardo.build.vid=0x2341
|
||||||
leonardo.build.pid=0x8036
|
leonardo.build.pid=0x8036
|
||||||
leonardo.build.board=ARDUINO_LEONARDO
|
leonardo.build.board=AVR_LEONARDO
|
||||||
leonardo.build.core=arduino
|
leonardo.build.core=arduino
|
||||||
leonardo.build.variant=leonardo
|
leonardo.build.variant=leonardo
|
||||||
leonardo.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
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.f_cpu=16000000L
|
||||||
micro.build.vid=0x2341
|
micro.build.vid=0x2341
|
||||||
micro.build.pid=0x8037
|
micro.build.pid=0x8037
|
||||||
micro.build.board=ARDUINO_MICRO
|
micro.build.board=AVR_MICRO
|
||||||
micro.build.core=arduino
|
micro.build.core=arduino
|
||||||
micro.build.variant=micro
|
micro.build.variant=micro
|
||||||
micro.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
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.f_cpu=16000000L
|
||||||
esplora.build.vid=0x2341
|
esplora.build.vid=0x2341
|
||||||
esplora.build.pid=0x803c
|
esplora.build.pid=0x803c
|
||||||
esplora.build.board=ARDUINO_ESPLORA
|
esplora.build.board=AVR_ESPLORA
|
||||||
esplora.build.core=arduino
|
esplora.build.core=arduino
|
||||||
esplora.build.variant=leonardo
|
esplora.build.variant=leonardo
|
||||||
esplora.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
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.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
mini.build.f_cpu=16000000L
|
mini.build.f_cpu=16000000L
|
||||||
mini.build.board=ARDUINO_MINI
|
mini.build.board=AVR_MINI
|
||||||
mini.build.core=arduino
|
mini.build.core=arduino
|
||||||
mini.build.variant=eightanaloginputs
|
mini.build.variant=eightanaloginputs
|
||||||
|
|
||||||
## Arduino Mini w/ ATmega328
|
## Arduino Mini w/ ATmega328
|
||||||
menu.cpu.mini.atmega328=ATmega328
|
## -------------------------
|
||||||
|
mini.menu.cpu.atmega328=ATmega328
|
||||||
|
|
||||||
menu.cpu.mini.atmega328.upload.maximum_size=28672
|
mini.menu.cpu.atmega328.upload.maximum_size=28672
|
||||||
menu.cpu.mini.atmega328.upload.speed=115200
|
mini.menu.cpu.atmega328.upload.speed=115200
|
||||||
|
|
||||||
menu.cpu.mini.atmega328.bootloader.high_fuses=0xd8
|
mini.menu.cpu.atmega328.bootloader.high_fuses=0xd8
|
||||||
menu.cpu.mini.atmega328.bootloader.extended_fuses=0x05
|
mini.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.mini.atmega328.bootloader.file=optiboot/optiboot_atmega328-Mini.hex
|
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
|
## Arduino Mini w/ ATmega168
|
||||||
menu.cpu.mini.atmega168=ATmega168
|
## -------------------------
|
||||||
|
mini.menu.cpu.atmega168=ATmega168
|
||||||
|
|
||||||
menu.cpu.mini.atmega168.upload.maximum_size=14336
|
mini.menu.cpu.atmega168.upload.maximum_size=14336
|
||||||
menu.cpu.mini.atmega168.upload.speed=19200
|
mini.menu.cpu.atmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.mini.atmega168.bootloader.high_fuses=0xdd
|
mini.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.mini.atmega168.bootloader.extended_fuses=0x00
|
mini.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.mini.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
|
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.variant=standard
|
||||||
ethernet.build.mcu=atmega328p
|
ethernet.build.mcu=atmega328p
|
||||||
ethernet.build.f_cpu=16000000L
|
ethernet.build.f_cpu=16000000L
|
||||||
ethernet.build.board=ARDUINO_ETHERNET
|
ethernet.build.board=AVR_ETHERNET
|
||||||
ethernet.build.core=arduino
|
ethernet.build.core=arduino
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
@ -322,7 +328,7 @@ fio.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
fio.build.mcu=atmega328p
|
fio.build.mcu=atmega328p
|
||||||
fio.build.f_cpu=8000000L
|
fio.build.f_cpu=8000000L
|
||||||
fio.build.board=ARDUINO_FIO
|
fio.build.board=AVR_FIO
|
||||||
fio.build.core=arduino
|
fio.build.core=arduino
|
||||||
fio.build.variant=eightanaloginputs
|
fio.build.variant=eightanaloginputs
|
||||||
|
|
||||||
@ -341,29 +347,31 @@ bt.bootloader.unlock_bits=0x3F
|
|||||||
bt.bootloader.lock_bits=0x0F
|
bt.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
bt.build.f_cpu=16000000L
|
bt.build.f_cpu=16000000L
|
||||||
bt.build.board=ARDUINO_BT
|
bt.build.board=AVR_BT
|
||||||
bt.build.core=arduino
|
bt.build.core=arduino
|
||||||
bt.build.variant=eightanaloginputs
|
bt.build.variant=eightanaloginputs
|
||||||
|
|
||||||
## Arduino BT w/ ATmega328
|
## 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
|
bt.menu.cpu.atmega328.bootloader.high_fuses=0xd8
|
||||||
menu.cpu.bt.atmega328.bootloader.extended_fuses=0x05
|
bt.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.bt.atmega328.bootloader.file=bt/ATmegaBOOT_168_atmega328_bt.hex
|
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
|
## 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
|
bt.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.bt.atmega168.bootloader.extended_fuses=0x00
|
bt.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.bt.atmega168.bootloader.file=bt/ATmegaBOOT_168.hex
|
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.f_cpu=8000000L
|
||||||
LilyPadUSB.build.vid=0x1B4F
|
LilyPadUSB.build.vid=0x1B4F
|
||||||
LilyPadUSB.build.pid=0x9208
|
LilyPadUSB.build.pid=0x9208
|
||||||
LilyPadUSB.build.board=ARDUINO_LILYPAD_USB
|
LilyPadUSB.build.board=AVR_LILYPAD_USB
|
||||||
LilyPadUSB.build.core=arduino
|
LilyPadUSB.build.core=arduino
|
||||||
LilyPadUSB.build.variant=leonardo
|
LilyPadUSB.build.variant=leonardo
|
||||||
LilyPadUSB.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
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.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
lilypad.build.f_cpu=8000000L
|
lilypad.build.f_cpu=8000000L
|
||||||
lilypad.build.board=ARDUINO_LILYPAD
|
lilypad.build.board=AVR_LILYPAD
|
||||||
lilypad.build.core=arduino
|
lilypad.build.core=arduino
|
||||||
lilypad.build.variant=standard
|
lilypad.build.variant=standard
|
||||||
|
|
||||||
## LilyPad Arduino w/ ATmega328
|
## LilyPad Arduino w/ ATmega328
|
||||||
menu.cpu.lilypad.atmega328=ATmega328
|
## ----------------------------
|
||||||
|
lilypad.menu.cpu.atmega328=ATmega328
|
||||||
|
|
||||||
menu.cpu.lilypad.atmega328.upload.maximum_size=30720
|
lilypad.menu.cpu.atmega328.upload.maximum_size=30720
|
||||||
menu.cpu.lilypad.atmega328.upload.speed=57600
|
lilypad.menu.cpu.atmega328.upload.speed=57600
|
||||||
|
|
||||||
menu.cpu.lilypad.atmega328.bootloader.low_fuses=0xFF
|
lilypad.menu.cpu.atmega328.bootloader.low_fuses=0xFF
|
||||||
menu.cpu.lilypad.atmega328.bootloader.high_fuses=0xDA
|
lilypad.menu.cpu.atmega328.bootloader.high_fuses=0xDA
|
||||||
menu.cpu.lilypad.atmega328.bootloader.extended_fuses=0x05
|
lilypad.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.lilypad.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
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
|
## LilyPad Arduino w/ ATmega168
|
||||||
menu.cpu.lilypad.atmega168=ATmega168
|
## ----------------------------
|
||||||
|
lilypad.menu.cpu.atmega168=ATmega168
|
||||||
|
|
||||||
menu.cpu.lilypad.atmega168.upload.maximum_size=14336
|
lilypad.menu.cpu.atmega168.upload.maximum_size=14336
|
||||||
menu.cpu.lilypad.atmega168.upload.speed=19200
|
lilypad.menu.cpu.atmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.lilypad.atmega168.bootloader.low_fuses=0xe2
|
lilypad.menu.cpu.atmega168.bootloader.low_fuses=0xe2
|
||||||
menu.cpu.lilypad.atmega168.bootloader.high_fuses=0xdd
|
lilypad.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.lilypad.atmega168.bootloader.extended_fuses=0x00
|
lilypad.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.lilypad.atmega168.bootloader.file=lilypad/LilyPadBOOT_168.hex
|
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.unlock_bits=0x3F
|
||||||
pro.bootloader.lock_bits=0x0F
|
pro.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
pro.build.board=ARDUINO_PRO
|
pro.build.board=AVR_PRO
|
||||||
pro.build.core=arduino
|
pro.build.core=arduino
|
||||||
pro.build.variant=standard
|
pro.build.variant=standard
|
||||||
|
|
||||||
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
|
## 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
|
pro.menu.cpu.16MHzatmega328.upload.maximum_size=30720
|
||||||
menu.cpu.pro.16MHzatmega328.upload.speed=57600
|
pro.menu.cpu.16MHzatmega328.upload.speed=57600
|
||||||
|
|
||||||
menu.cpu.pro.16MHzatmega328.bootloader.low_fuses=0xFF
|
pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
|
||||||
menu.cpu.pro.16MHzatmega328.bootloader.high_fuses=0xDA
|
pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
|
||||||
menu.cpu.pro.16MHzatmega328.bootloader.extended_fuses=0x05
|
pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.pro.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
|
pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
|
||||||
|
|
||||||
menu.cpu.pro.16MHzatmega328.build.mcu=atmega328p
|
pro.menu.cpu.16MHzatmega328.build.mcu=atmega328p
|
||||||
menu.cpu.pro.16MHzatmega328.build.f_cpu=16000000L
|
pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
|
||||||
|
|
||||||
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
|
## 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
|
pro.menu.cpu.8MHzatmega328.upload.maximum_size=30720
|
||||||
menu.cpu.pro.8MHzatmega328.upload.speed=57600
|
pro.menu.cpu.8MHzatmega328.upload.speed=57600
|
||||||
|
|
||||||
menu.cpu.pro.8MHzatmega328.bootloader.low_fuses=0xFF
|
pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF
|
||||||
menu.cpu.pro.8MHzatmega328.bootloader.high_fuses=0xDA
|
pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA
|
||||||
menu.cpu.pro.8MHzatmega328.bootloader.extended_fuses=0x05
|
pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0x05
|
||||||
menu.cpu.pro.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
pro.menu.cpu.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
|
||||||
|
|
||||||
menu.cpu.pro.8MHzatmega328.build.mcu=atmega328p
|
pro.menu.cpu.8MHzatmega328.build.mcu=atmega328p
|
||||||
menu.cpu.pro.8MHzatmega328.build.f_cpu=8000000L
|
pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L
|
||||||
|
|
||||||
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168
|
## 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
|
pro.menu.cpu.16MHzatmega168.upload.maximum_size=14336
|
||||||
menu.cpu.pro.16MHzatmega168.upload.speed=19200
|
pro.menu.cpu.16MHzatmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.pro.16MHzatmega168.bootloader.low_fuses=0xff
|
pro.menu.cpu.16MHzatmega168.bootloader.low_fuses=0xff
|
||||||
menu.cpu.pro.16MHzatmega168.bootloader.high_fuses=0xdd
|
pro.menu.cpu.16MHzatmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.pro.16MHzatmega168.bootloader.extended_fuses=0x00
|
pro.menu.cpu.16MHzatmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.pro.16MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
|
pro.menu.cpu.16MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
|
||||||
|
|
||||||
menu.cpu.pro.16MHzatmega168.build.mcu=atmega168
|
pro.menu.cpu.16MHzatmega168.build.mcu=atmega168
|
||||||
menu.cpu.pro.16MHzatmega168.build.f_cpu=16000000L
|
pro.menu.cpu.16MHzatmega168.build.f_cpu=16000000L
|
||||||
|
|
||||||
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
|
## 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
|
pro.menu.cpu.8MHzatmega168.upload.maximum_size=14336
|
||||||
menu.cpu.pro.8MHzatmega168.upload.speed=19200
|
pro.menu.cpu.8MHzatmega168.upload.speed=19200
|
||||||
|
|
||||||
menu.cpu.pro.8MHzatmega168.bootloader.low_fuses=0xc6
|
pro.menu.cpu.8MHzatmega168.bootloader.low_fuses=0xc6
|
||||||
menu.cpu.pro.8MHzatmega168.bootloader.high_fuses=0xdd
|
pro.menu.cpu.8MHzatmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.pro.8MHzatmega168.bootloader.extended_fuses=0x00
|
pro.menu.cpu.8MHzatmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.pro.8MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
|
pro.menu.cpu.8MHzatmega168.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
|
||||||
|
|
||||||
menu.cpu.pro.8MHzatmega168.build.mcu=atmega168
|
pro.menu.cpu.8MHzatmega168.build.mcu=atmega168
|
||||||
menu.cpu.pro.8MHzatmega168.build.f_cpu=8000000L
|
pro.menu.cpu.8MHzatmega168.build.f_cpu=8000000L
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
@ -521,29 +535,32 @@ atmegang.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
atmegang.build.mcu=atmegang
|
atmegang.build.mcu=atmegang
|
||||||
atmegang.build.f_cpu=16000000L
|
atmegang.build.f_cpu=16000000L
|
||||||
atmegang.build.board=ARDUINO_NG
|
atmegang.build.board=AVR_NG
|
||||||
atmegang.build.core=arduino
|
atmegang.build.core=arduino
|
||||||
atmegang.build.variant=standard
|
atmegang.build.variant=standard
|
||||||
|
|
||||||
## Arduino NG or older w/ ATmega168
|
## 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
|
atmegang.menu.cpu.atmega168.bootloader.low_fuses=0xff
|
||||||
menu.cpu.atmegang.atmega168.bootloader.high_fuses=0xdd
|
atmegang.menu.cpu.atmega168.bootloader.high_fuses=0xdd
|
||||||
menu.cpu.atmegang.atmega168.bootloader.extended_fuses=0x00
|
atmegang.menu.cpu.atmega168.bootloader.extended_fuses=0x00
|
||||||
menu.cpu.atmegang.atmega168.bootloader.file=atmega/ATmegaBOOT_168_ng.hex
|
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
|
## 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
|
atmegang.menu.cpu.atmega8.bootloader.low_fuses=0xdf
|
||||||
menu.cpu.atmegang.atmega8.bootloader.high_fuses=0xca
|
atmegang.menu.cpu.atmega8.bootloader.high_fuses=0xca
|
||||||
menu.cpu.atmegang.atmega8.bootloader.file=atmega8/ATmegaBOOT-prod-firmware-2009-11-07.hex
|
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
|
|
||||||
|
@ -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
|
# AVR compile variables
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
name=Arduino AVR Boards
|
|
||||||
# Default "compiler.path" is correct, change only if you want to overidde the initial value
|
# Default "compiler.path" is correct, change only if you want to overidde the initial value
|
||||||
#compiler.path={ide.path}/tools/avr/bin/..
|
#compiler.path={ide.path}/tools/avr/bin/..
|
||||||
compiler.c.cmd=avr-gcc
|
compiler.c.cmd=avr-gcc
|
||||||
@ -27,10 +35,10 @@ build.extra_flags=
|
|||||||
# --------------------
|
# --------------------
|
||||||
|
|
||||||
## Compile c files
|
## 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
|
## 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
|
## Create archives
|
||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
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
|
# AVR Uploader/Programmers tools
|
||||||
# -------------------
|
# ------------------------------
|
||||||
|
|
||||||
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
|
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
|
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
|
||||||
|
@ -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.upload.native_usb=false
|
||||||
arduino_due_x_dbg.build.mcu=cortex-m3
|
arduino_due_x_dbg.build.mcu=cortex-m3
|
||||||
arduino_due_x_dbg.build.f_cpu=84000000L
|
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.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.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
|
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.upload.native_usb=true
|
||||||
arduino_due_x.build.mcu=cortex-m3
|
arduino_due_x.build.mcu=cortex-m3
|
||||||
arduino_due_x.build.f_cpu=84000000L
|
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.core=arduino
|
||||||
arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
|
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
|
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld
|
||||||
|
@ -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
|
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.path={runtime.ide.path}/hardware/tools/g++_arm_none_eabi/bin/
|
||||||
compiler.c.cmd=arm-none-eabi-gcc
|
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
|
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
|
## 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
|
## 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
|
## Create archives
|
||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user