Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2015-05-20 02:45:45 +0000
committerDoug Schaefer2015-05-29 15:22:42 +0000
commit583cbf250341aaca921657543807a621d6879284 (patch)
treebc4891a256b82f03b5162361b6b558a36b6fce99 /toolchains
parent10e011fa339c78bc6ad4a365319a3a96ca471e0a (diff)
downloadorg.eclipse.cdt-583cbf250341aaca921657543807a621d6879284.tar.gz
org.eclipse.cdt-583cbf250341aaca921657543807a621d6879284.tar.xz
org.eclipse.cdt-583cbf250341aaca921657543807a621d6879284.zip
Start work to build against the Arduino IDE.
Diffstat (limited to 'toolchains')
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino-feature/rootfiles/arduino/arduino.mk2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoHome.java11
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/AvrLanguageSettingsProvider.java2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/EnvVarSupplier.java77
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoBoardManager.java2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoRemoteConnection.java3
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.properties1
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml8
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/ArduinoPreferencePage.java42
10 files changed, 102 insertions, 48 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino-feature/rootfiles/arduino/arduino.mk b/toolchains/arduino/org.eclipse.cdt.arduino-feature/rootfiles/arduino/arduino.mk
index 9efc895422..5b1484770d 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino-feature/rootfiles/arduino/arduino.mk
+++ b/toolchains/arduino/org.eclipse.cdt.arduino-feature/rootfiles/arduino/arduino.mk
@@ -69,7 +69,7 @@ LIB_SRCS = $(call rwildcard, $(LIB_ROOT)/, *.c *.cpp)
LIB_OBJS = $(patsubst $(LIB_ROOT)/%.c, $(OUTPUT_DIR)/arduino/%.o, $(filter %.c, $(LIB_SRCS))) \
$(patsubst $(LIB_ROOT)/%.cpp, $(OUTPUT_DIR)/arduino/%.o, $(filter %.cpp, $(LIB_SRCS)))
-LIBS_ROOTS = $(HOME)/Documents/Arduino/libraries $(ARDUINO_HOME)/hardware/arduino/$(ARCH)/libraries $(ARDUINO_HOME)/libraries
+LIBS_ROOTS = $(ARDUINO_LIBS) $(ARDUINO_HOME)/hardware/arduino/$(ARCH)/libraries $(ARDUINO_HOME)/libraries
LIBS_DIRS = $(foreach lib, $(LIBS), $(firstword $(realpath $(foreach lib_root, $(LIBS_ROOTS), $(lib_root)/$(lib)))))
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoHome.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoHome.java
index 5501eed06e..db675d6e3e 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoHome.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoHome.java
@@ -19,7 +19,7 @@ public class ArduinoHome {
private static File home;
- public static File get() {
+ public static File getRootfileDir() {
if (home == null) {
String arduinoPathStr = System.getProperty("org.eclipse.cdt.arduino.home"); //$NON-NLS-1$
if (arduinoPathStr != null) {
@@ -37,4 +37,13 @@ public class ArduinoHome {
return home;
}
+ public static File getArduinoDir() {
+ return new File("/Applications/Arduino.app/Contents/Java"); //$NON-NLS-1$
+ }
+
+ public static File getArduinoLibsDir() {
+ File home = new File(System.getProperty("user.home")); //$NON-NLS-1$
+ return new File(home, "/Documents/Arduino/libraries"); //$NON-NLS-1$
+ }
+
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/AvrLanguageSettingsProvider.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/AvrLanguageSettingsProvider.java
index 417405a28a..75017cbed9 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/AvrLanguageSettingsProvider.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/AvrLanguageSettingsProvider.java
@@ -50,7 +50,7 @@ public class AvrLanguageSettingsProvider extends GCCBuiltinSpecsDetector {
protected List<String> parseOptions(String line) {
if (Platform.getOS().equals(Platform.OS_WIN32)) {
if (line.startsWith(" /arduino/")) { //$NON-NLS-1$
- File full = new File(ArduinoHome.get().getParentFile(), line.trim());
+ File full = new File(ArduinoHome.getArduinoDir().getParentFile(), line.trim());
return parseOptions(" " + full.getAbsolutePath()); //$NON-NLS-1$
}
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/EnvVarSupplier.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/EnvVarSupplier.java
index a3642b218c..bd10c2b424 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/EnvVarSupplier.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/EnvVarSupplier.java
@@ -21,16 +21,16 @@ import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier {
+ private EnvVar arduinoRoot;
private EnvVar arduinoHome;
+ private EnvVar arduinoLibs;
private EnvVar path;
-
+
private static final String OUTPUT_DIR = "OUTPUT_DIR"; //$NON-NLS-1$
private static final String BOARD = "BOARD"; //$NON-NLS-1$
- private static final String CYGWIN = "CYGWIN"; //$NON-NLS-1$
private static final class EnvVar implements IBuildEnvironmentVariable {
String name;
@@ -57,26 +57,26 @@ public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier
}
public EnvVarSupplier() {
- File arduinoPath = ArduinoHome.get();
-
- if (arduinoPath.isDirectory()) {
- arduinoHome = new EnvVar();
- arduinoHome.name = "ARDUINO_HOME"; //$NON-NLS-1$
- arduinoHome.value = arduinoPath.getAbsolutePath();
-
- File avrPath = new File(arduinoPath, "hardware/tools/avr/bin"); //$NON-NLS-1$
- String pathStr = avrPath.getAbsolutePath();
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- // Windows needs the arduino path too to pick up the cygwin dlls
- pathStr += File.pathSeparator + arduinoPath.getAbsolutePath();
- }
-
- path = new EnvVar();
- path.name = "PATH"; //$NON-NLS-1$
- path.value = pathStr;
- path.operation = IBuildEnvironmentVariable.ENVVAR_PREPEND;
- path.delimiter = File.pathSeparator;
- }
+ arduinoRoot = new EnvVar();
+ arduinoRoot.name = "ARDUINO_ROOT"; //$NON-NLS-1$
+ arduinoRoot.value = ArduinoHome.getRootfileDir().getAbsolutePath();
+
+ arduinoHome = new EnvVar();
+ arduinoHome.name = "ARDUINO_HOME"; //$NON-NLS-1$
+ arduinoHome.value = ArduinoHome.getArduinoDir().getAbsolutePath();
+
+ arduinoLibs = new EnvVar();
+ arduinoLibs.name = "ARDUINO_LIBS"; //$NON-NLS-1$
+ arduinoLibs.value = ArduinoHome.getArduinoLibsDir().getAbsolutePath();
+
+ File avrPath = new File(ArduinoHome.getArduinoDir(), "hardware/tools/avr/bin"); //$NON-NLS-1$
+ String pathStr = avrPath.getAbsolutePath();
+
+ path = new EnvVar();
+ path.name = "PATH"; //$NON-NLS-1$
+ path.value = pathStr;
+ path.operation = IBuildEnvironmentVariable.ENVVAR_PREPEND;
+ path.delimiter = File.pathSeparator;
}
private IBuildEnvironmentVariable getOutputDir(IConfiguration configuration) {
@@ -91,7 +91,7 @@ public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier
Board board = ArduinoProjectGenerator.getBoard(configuration);
if (board == null)
return null;
-
+
EnvVar boardVar = new EnvVar();
boardVar.name = BOARD;
boardVar.value = board.getId();
@@ -102,26 +102,21 @@ public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier
}
}
- private IBuildEnvironmentVariable getCygwin() {
- EnvVar var = new EnvVar();
- var.name = CYGWIN;
- var.value = "nodosfilewarning"; //$NON-NLS-1$
- return var;
- }
-
@Override
public IBuildEnvironmentVariable getVariable(String variableName,
IConfiguration configuration, IEnvironmentVariableProvider provider) {
- if (path != null && variableName.equals(path.name)) {
+ if (variableName.equals(path.name)) {
return path;
- } else if (arduinoHome != null && variableName.equals(arduinoHome.name)) {
+ } else if (variableName.equals(arduinoRoot.name)) {
+ return arduinoRoot;
+ } else if (variableName.equals(arduinoHome.name)) {
return arduinoHome;
+ } else if (variableName.equals(arduinoLibs.name)) {
+ return arduinoLibs;
} else if (variableName.equals(OUTPUT_DIR)) {
return getOutputDir(configuration);
} else if (variableName.equals(BOARD)) {
return getBoard(configuration);
- } else if (variableName.equals(CYGWIN)) {
- return getCygwin();
}
return null;
}
@@ -131,11 +126,10 @@ public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier
IConfiguration configuration, IEnvironmentVariableProvider provider) {
List<IBuildEnvironmentVariable> vars = new ArrayList<>();
- if (path != null)
- vars.add(path);
-
- if (arduinoHome != null)
- vars.add(arduinoHome);
+ vars.add(path);
+ vars.add(arduinoRoot);
+ vars.add(arduinoHome);
+ vars.add(arduinoLibs);
if (configuration != null) {
vars.add(getOutputDir(configuration));
@@ -145,9 +139,6 @@ public class EnvVarSupplier implements IConfigurationEnvironmentVariableSupplier
vars.add(boardVar);
}
- if (Platform.getOS().equals(Platform.OS_WIN32))
- vars.add(getCygwin());
-
return vars.toArray(new IBuildEnvironmentVariable[vars.size()]);
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoBoardManager.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoBoardManager.java
index e1cd81afaf..26ff95cff7 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoBoardManager.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoBoardManager.java
@@ -54,7 +54,7 @@ public class ArduinoBoardManager implements IArduinoBoardManager {
if (boards != null)
return;
boards = new HashMap<>();
- File home = ArduinoHome.get();
+ File home = ArduinoHome.getArduinoDir();
if (!home.isDirectory())
return;
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoRemoteConnection.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoRemoteConnection.java
index 9653284664..aeb3cfd441 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoRemoteConnection.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/remote/ArduinoRemoteConnection.java
@@ -67,6 +67,9 @@ public class ArduinoRemoteConnection implements IRemoteConnectionPropertyService
@Override
public Board getBoard() {
String boardId = remoteConnection.getAttribute(BOARD_ID);
+ if (boardId == null) {
+ boardId = "uno"; //$NON-NLS-1$
+ }
return boardManager.getBoard(boardId);
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile b/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
index 7383bed636..97939bb91f 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
@@ -1,3 +1,3 @@
EXE = ${projectName}
-include $(ARDUINO_HOME)/arduino.mk
+include $(ARDUINO_ROOT)/arduino.mk
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.properties b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.properties
index f5b109db8e..fef438ce8c 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.properties
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.properties
@@ -10,3 +10,4 @@
###############################################################################
pluginName=Arduino C++ UI
providerName=Eclipse CDT
+preferencePage.name=Arduino C++
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml
index 3879b04320..2b7f4bf37c 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/plugin.xml
@@ -65,4 +65,12 @@
service="org.eclipse.remote.ui.IRemoteUIConnectionService">
</connectionTypeService>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.cdt.arduino.ui.internal.ArduinoPreferencePage"
+ id="org.eclipse.cdt.arduino.ui.page1"
+ name="%preferencePage.name">
+ </page>
+ </extension>
</plugin>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/ArduinoPreferencePage.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/ArduinoPreferencePage.java
new file mode 100644
index 0000000000..92dd2738f1
--- /dev/null
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/ArduinoPreferencePage.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.arduino.ui.internal;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class ArduinoPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ public ArduinoPreferencePage() {
+ super(GRID);
+ setDescription("Arduino C++ Preferences");
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected void createFieldEditors() {
+
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+ super.dispose();
+ }
+
+}

Back to the top