aboutsummaryrefslogtreecommitdiffstats
path: root/tools/eclipse
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-10 14:01:13 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-10 14:01:13 +0000
commit733166973d4dc88521555e14d4bb118f62989bbc (patch)
tree7397938649c7ec0a621a05d7526e59c4a29aab7c /tools/eclipse
parentd768fddeebe413f488a3c177cbc0145e08600a34 (diff)
downloadChibiOS-733166973d4dc88521555e14d4bb118f62989bbc.tar.gz
ChibiOS-733166973d4dc88521555e14d4bb118f62989bbc.tar.bz2
ChibiOS-733166973d4dc88521555e14d4bb118f62989bbc.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4551 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'tools/eclipse')
-rw-r--r--tools/eclipse/config_wizard/META-INF/MANIFEST.MF3
-rw-r--r--tools/eclipse/config_wizard/plugin.xml33
-rw-r--r--tools/eclipse/config_wizard/resources/app_templates/c/template.xml82
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java1
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java5
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java37
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java29
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java20
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java24
9 files changed, 216 insertions, 18 deletions
diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
index 09eb9fe72..c65afaa46 100644
--- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
+++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.ui.console;bundle-version="3.5.100",
org.eclipse.ui.ide,
org.eclipse.cdt.core;bundle-version="5.4.0",
- org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0"
+ org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0",
+ org.eclipse.cdt.ui;bundle-version="5.4.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: chibios.org
diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml
index 7098032c8..5e8e23e7d 100644
--- a/tools/eclipse/config_wizard/plugin.xml
+++ b/tools/eclipse/config_wizard/plugin.xml
@@ -25,7 +25,8 @@
</extension>
<!-- Registers the file extension .chcfg as an XML type. -->
- <extension point="org.eclipse.core.contenttype.contentTypes">
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
<file-association
content-type="org.eclipse.core.runtime.xml"
file-extensions="chcfg">
@@ -33,7 +34,8 @@
</extension>
<!-- XML catalog extensions. -->
- <extension point="org.eclipse.wst.xml.core.catalogContributions">
+ <extension
+ point="org.eclipse.wst.xml.core.catalogContributions">
<catalogContribution id="default">
<uri
name="http://www.chibios.org/xml/schema/boards/stm32f0xx_board.xsd"
@@ -184,4 +186,31 @@
</menuContribution>
</extension>
+ <!-- ChibiOS/RT application generator process type. -->
+ <extension
+ point="org.eclipse.cdt.core.templateProcessTypes">
+ <processType
+ name="ApplicationGeneratorProcessRunner"
+ processRunner="org.chibios.tools.eclipse.config.process.ApplicationGeneratorProcessRunner">
+ <simple
+ name="name"/>
+ <simple
+ name="chibiosLocation"/>
+ <simple
+ name="platform"/>
+ </processType>
+ </extension>
+
+ <!-- Application templates. -->
+ <extension
+ point="org.eclipse.cdt.core.templates">
+ <template
+ filterPattern=".*gcc"
+ id="config_wizard.resources.app_templates.c"
+ isCategory="false"
+ location="resources/app_templates/c/template.xml"
+ projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
+ </template>
+ </extension>
+
</plugin>
diff --git a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml
new file mode 100644
index 000000000..0bcf782ec
--- /dev/null
+++ b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template
+ type="ProjTempl"
+ version="1.0"
+ supplier="chibios.org"
+ revision="1.0"
+ author="Giovanni Di Sirio"
+ id="xxx"
+ label="ChibiOS/RT C Application"
+ description="Template of a ChibiOS/RT C application based on makefiles."
+ preview-icon="icons/chibios.gif">
+
+ <property-group
+ id="application-settings"
+ label="Application Settings"
+ description="Application Settings"
+ type="PAGES-ONLY"
+ branding-icon="icons/chibios.gif">
+ <property
+ id="chibiosLocation"
+ label="ChibiOS/RT location"
+ description="ChibiOS/RT installation path"
+ type="browsedir"
+ pattern=".*"
+ default=""
+ size=""
+ mandatory="true"
+ hidden="false"
+ persist="true" />
+ <property
+ id="platform"
+ label="Platform"
+ description="ChibiOS/RT installation path"
+ type="select"
+ pattern=".*"
+ default=""
+ size=""
+ mandatory="true"
+ hidden="false"
+ persist="true">
+ <item
+ value="STM32F0xx"
+ label="STMicroelectronics STM32F0xx" />
+ <item
+ value="STM32F4xx"
+ label="STMicroelectronics STM32F4xx" />
+ <item
+ value="STM32L1xx"
+ label="STMicroelectronics STM32L1xx" />
+ </property>
+ </property-group>
+
+ <process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
+ <simple
+ name="name"
+ value="$(projectName)" />
+ <simple
+ name="location"
+ value="$(location)" />
+ <simple
+ name="artifactExtension"
+ value="exe" />
+ <simple
+ name="isCProject"
+ value="true" />
+ </process>
+
+ <!-- Note, type is prefixed by the plugin_id (not the class package). -->
+ <process
+ type="org.chibios.tools.eclipse.config.ApplicationGeneratorProcessRunner">
+ <simple
+ name="name"
+ value="$(projectName)" />
+ <simple
+ name="chibiosLocation"
+ value="$(chibiosLocation)" />
+ <simple
+ name="platform"
+ value="$(platform)" />
+ </process>
+
+</template>
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java
index f9e8cd6bf..0d7e7e292 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java
@@ -33,6 +33,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
* @see org.eclipse.core.commands.AbstractHandler
*/
public class CheckDescription extends AbstractHandler {
+
/**
* The constructor.
*/
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
index b29237fb0..aad5adfce 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
@@ -31,7 +31,6 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -98,13 +97,10 @@ public class GenerateFiles extends AbstractHandler {
/* Calculating derived paths. */
IPath tpath = new Path(templates_path);
- IPath libpath = new Path("resources/gencfg/lib");
try {
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
tpath = new Path(FileLocator.toFileURL(
FileLocator.find(bundle, tpath, null)).getFile());
- libpath = new Path(FileLocator.toFileURL(
- FileLocator.find(bundle, libpath, null)).getFile());
} catch (IOException e) {
MessageDialog.openInformation(window.getShell(), "Path Error",
e.getMessage());
@@ -114,7 +110,6 @@ public class GenerateFiles extends AbstractHandler {
/* Templates execution. */
try {
TemplateEngine.process(cfgfilepath.toFile(),
- libpath.toFile(),
tpath.toFile(),
new File(output_path));
} catch (TemplateException e) {
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java
new file mode 100644
index 000000000..e85442d81
--- /dev/null
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java
@@ -0,0 +1,37 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011,2012 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.chibios.tools.eclipse.config.process;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
+import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ApplicationGeneratorProcessRunner extends ProcessRunner {
+
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+
+ }
+}
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
index 60a33f0e2..ce1e5325a 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
@@ -20,7 +20,6 @@
package org.chibios.tools.eclipse.config.utils;
-import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -28,6 +27,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
@@ -43,9 +46,12 @@ import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
+import org.osgi.framework.Bundle;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
+import config_wizard.Activator;
+
import fmpp.Engine;
import fmpp.ProcessingException;
import fmpp.ProgressListener;
@@ -77,8 +83,6 @@ public class TemplateEngine {
*
* @param xmldata
* absolute path to XML data file
- * @param libdir
- * absolute path to libraries directory
* @param sourcedir
* absolute path to templates directory
* @param outputdir
@@ -88,7 +92,6 @@ public class TemplateEngine {
* @throws ProcessingException
*/
public static void process(java.io.File xmldata,
- java.io.File libdir,
java.io.File sourcedir,
java.io.File outputdir) throws TemplateException {
@@ -106,6 +109,19 @@ public class TemplateEngine {
warn.setColor(DEFAULT_WARNING);
/*
+ * Calculates the path for FTL libraries.
+ */
+ IPath libpath = new Path("resources/gencfg/lib");
+ Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+ try {
+ libpath = new Path(FileLocator.toFileURL(FileLocator.find(bundle, libpath, null)).getFile());
+ }
+ catch (IOException e1) {
+ err.println(": FTL libraries path not found.");
+ return;
+ }
+
+ /*
* Instantiates the FMPP Settings engine and associates a listener for
* events to be logged.
*/
@@ -169,8 +185,7 @@ public class TemplateEngine {
Document dom1, dom_snippets;
try {
dom1 = db.parse(xmldata);
- java.io.File xmlsnippets = new File(libdir.toString() +
- "/code_snippets.xml");
+ java.io.File xmlsnippets = libpath.addTrailingSeparator().append("code_snippets.xml").toFile();
dom_snippets = db.parse(xmlsnippets);
} catch (SAXException e) {
throw new TemplateException(e.getMessage());
@@ -191,7 +206,7 @@ public class TemplateEngine {
/* Setting libraries path. */
HashMap<String, String> libs = new HashMap<String, String>();
- libs.put("lib", libdir.toString());
+ libs.put("lib", libpath.toString());
/* Other settings. */
try {
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java
index f2488b74b..b94df01cc 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java
@@ -1,3 +1,23 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011,2012 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package org.chibios.tools.eclipse.config.wizards;
import java.lang.reflect.InvocationTargetException;
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java
index 5513bc5bf..b2daabeac 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java
@@ -1,3 +1,23 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011,2012 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package org.chibios.tools.eclipse.config.wizards;
import java.io.File;
@@ -35,7 +55,6 @@ import config_wizard.Activator;
public class NewApplicationProjectWizardPage extends WizardPage {
- private ISelection selection;
private Composite container;
private Text projectParentPathText;
private Button btnBrowse;
@@ -55,7 +74,6 @@ public class NewApplicationProjectWizardPage extends WizardPage {
super("wizardPage");
setTitle("ChibiOS/RT New Application Project Wizard");
setDescription("This wizard creates a new ChibiOS/RT application project.");
- this.selection = selection;
}
/**
@@ -200,7 +218,7 @@ public class NewApplicationProjectWizardPage extends WizardPage {
/* Update checks on the fields.*/
projectPageUpdated();
-
+
/* Focus on the first editable field.*/
projectNameText.setFocus();
}