From 777fa5d5684ef62c7241e43a457acfb69965e4a3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 17 Feb 2013 11:46:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5219 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/.classpath | 13 - tools/eclipse/config_wizard/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 24 - tools/eclipse/config_wizard/build.properties | 8 - tools/eclipse/config_wizard/icons/check.gif | Bin 591 -> 0 bytes tools/eclipse/config_wizard/icons/chibios.gif | Bin 581 -> 0 bytes tools/eclipse/config_wizard/icons/generate.gif | Bin 378 -> 0 bytes tools/eclipse/config_wizard/icons/sample.gif | Bin 983 -> 0 bytes tools/eclipse/config_wizard/lib/bsh.jar | Bin 281694 -> 0 bytes tools/eclipse/config_wizard/lib/fmpp.jar | Bin 314020 -> 0 bytes tools/eclipse/config_wizard/lib/freemarker.jar | Bin 931168 -> 0 bytes tools/eclipse/config_wizard/lib/jdom-2.0.2.jar | Bin 295355 -> 0 bytes tools/eclipse/config_wizard/lib/oro.jar | Bin 65261 -> 0 bytes tools/eclipse/config_wizard/lib/resolver.jar | Bin 60047 -> 0 bytes tools/eclipse/config_wizard/plugin.xml | 219 ---- .../resources/app_templates/c/template.xml | 82 -- .../resources/gencfg/lib/code_snippets.xml | 50 - .../config_wizard/resources/gencfg/lib/libcode.ftl | 316 ------ .../resources/gencfg/lib/liblicense.ftl | 58 - .../resources/gencfg/lib/libsnippets.ftl | 33 - .../resources/gencfg/lib/libstm32f4xx.ftl | 144 --- .../resources/gencfg/lib/libutils.ftl | 109 -- .../boards/stm32f0xx/templates/board.c.ftl | 101 -- .../boards/stm32f0xx/templates/board.h.ftl | 326 ------ .../boards/stm32f0xx/templates/board.mk.ftl | 28 - .../boards/stm32f3xx/templates/board.c.ftl | 133 --- .../boards/stm32f3xx/templates/board.h.ftl | 327 ------ .../boards/stm32f3xx/templates/board.mk.ftl | 28 - .../boards/stm32f4xx/templates/board.c.ftl | 139 --- .../boards/stm32f4xx/templates/board.h.ftl | 327 ------ .../boards/stm32f4xx/templates/board.mk.ftl | 28 - .../boards/stm32l1xx/templates/board.c.ftl | 133 --- .../boards/stm32l1xx/templates/board.h.ftl | 321 ------ .../boards/stm32l1xx/templates/board.mk.ftl | 28 - .../resources/gencfg/processors/processors.xml | 26 - .../gencfg/schema/boards/abstract_board.xsd | 81 -- .../gencfg/schema/boards/stm32f0xx_board.xsd | 94 -- .../gencfg/schema/boards/stm32f3xx_board.xsd | 100 -- .../gencfg/schema/boards/stm32f4xx_board.xsd | 108 -- .../gencfg/schema/boards/stm32l1xx_board.xsd | 81 -- .../gencfg/schema/common/code_snippets.xsd | 59 - .../gencfg/schema/common/config_settings.xsd | 36 - .../resources/gencfg/schema/common/doc.xsd | 108 -- .../schema/common/stm32/stm32_gpiov2_port.xsd | 214 ---- .../resources/gencfg/xml/stm32f0board.xml | 669 ----------- .../resources/gencfg/xml/stm32f3board.xml | 797 ------------- .../resources/gencfg/xml/stm32f4board.xml | 1194 -------------------- .../resources/gencfg/xml/stm32l1board.xml | 799 ------------- .../config_wizard/src/config_wizard/Activator.java | 88 -- .../eclipse/config/handlers/CheckDescription.java | 55 - .../eclipse/config/handlers/GenerateFiles.java | 131 --- .../process/ApplicationGeneratorProcessRunner.java | 37 - .../tools/eclipse/config/utils/TemplateEngine.java | 260 ----- .../eclipse/config/utils/TemplateException.java | 30 - .../config/wizards/ConfigurationNewWizard.java | 185 --- .../config/wizards/ConfigurationNewWizardPage.java | 264 ----- .../wizards/NewApplicationProjectWizard.java | 158 --- .../wizards/NewApplicationProjectWizardPage.java | 312 ----- tools/eclipse/debug_support/.classpath | 7 - tools/eclipse/debug_support/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - tools/eclipse/debug_support/META-INF/MANIFEST.MF | 14 - tools/eclipse/debug_support/build.properties | 7 - tools/eclipse/debug_support/contexts.xml | 12 - tools/eclipse/debug_support/icons/sample.gif | Bin 983 -> 0 bytes tools/eclipse/debug_support/plugin.xml | 38 - .../tools/eclipse/debug/activator/Activator.java | 88 -- .../tools/eclipse/debug/utils/DebugProxy.java | 582 ---------- .../eclipse/debug/utils/DebugProxyException.java | 34 - .../tools/eclipse/debug/utils/HexUtils.java | 114 -- .../tools/eclipse/debug/views/ChibiView.java | 585 ---------- .../src/org/eclipse/wb/swt/ResourceManager.java | 415 ------- .../src/org/eclipse/wb/swt/SWTResourceManager.java | 447 -------- .../org.chibios.tools.eclipse.config_1.2.1.jar | Bin 1875433 -> 0 bytes .../org.chibios.tools.eclipse.debug_1.0.8.jar | Bin 34953 -> 0 bytes tools/eclipse/readme.txt | 16 - 77 files changed, 11292 deletions(-) delete mode 100644 tools/eclipse/config_wizard/.classpath delete mode 100644 tools/eclipse/config_wizard/.project delete mode 100644 tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tools/eclipse/config_wizard/META-INF/MANIFEST.MF delete mode 100644 tools/eclipse/config_wizard/build.properties delete mode 100644 tools/eclipse/config_wizard/icons/check.gif delete mode 100644 tools/eclipse/config_wizard/icons/chibios.gif delete mode 100644 tools/eclipse/config_wizard/icons/generate.gif delete mode 100644 tools/eclipse/config_wizard/icons/sample.gif delete mode 100644 tools/eclipse/config_wizard/lib/bsh.jar delete mode 100644 tools/eclipse/config_wizard/lib/fmpp.jar delete mode 100644 tools/eclipse/config_wizard/lib/freemarker.jar delete mode 100644 tools/eclipse/config_wizard/lib/jdom-2.0.2.jar delete mode 100644 tools/eclipse/config_wizard/lib/oro.jar delete mode 100644 tools/eclipse/config_wizard/lib/resolver.jar delete mode 100644 tools/eclipse/config_wizard/plugin.xml delete mode 100644 tools/eclipse/config_wizard/resources/app_templates/c/template.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml delete mode 100644 tools/eclipse/config_wizard/src/config_wizard/Activator.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java delete mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java delete mode 100644 tools/eclipse/debug_support/.classpath delete mode 100644 tools/eclipse/debug_support/.project delete mode 100644 tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tools/eclipse/debug_support/META-INF/MANIFEST.MF delete mode 100644 tools/eclipse/debug_support/build.properties delete mode 100644 tools/eclipse/debug_support/contexts.xml delete mode 100644 tools/eclipse/debug_support/icons/sample.gif delete mode 100644 tools/eclipse/debug_support/plugin.xml delete mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java delete mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java delete mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java delete mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java delete mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java delete mode 100644 tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java delete mode 100644 tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar delete mode 100644 tools/eclipse/readme.txt (limited to 'tools/eclipse') diff --git a/tools/eclipse/config_wizard/.classpath b/tools/eclipse/config_wizard/.classpath deleted file mode 100644 index 724303fa9..000000000 --- a/tools/eclipse/config_wizard/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/.project b/tools/eclipse/config_wizard/.project deleted file mode 100644 index 6611705c5..000000000 --- a/tools/eclipse/config_wizard/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - Tool Config Wizard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs b/tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index da0e3846d..000000000 --- a/tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Jul 30 11:37:30 CEST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF deleted file mode 100644 index 37f4f5b08..000000000 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ /dev/null @@ -1,24 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: ChibiOS-RT_Configuration_Support -Bundle-SymbolicName: org.chibios.tools.eclipse.config;singleton:=true -Bundle-Version: 1.2.1 -Bundle-Activator: config_wizard.Activator -Require-Bundle: org.eclipse.core.resources;bundle-version="3.7.101", - org.eclipse.core.runtime;bundle-version="3.7.0", - org.eclipse.ui;bundle-version="3.7.0", - org.eclipse.ui.console;bundle-version="3.5.100", - org.eclipse.ui.ide;bundle-version="3.7.0", - org.eclipse.cdt.core;bundle-version="5.3.2", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.0.2", - org.eclipse.cdt.ui;bundle-version="5.3.2" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: chibios.org -Bundle-ClassPath: ., - lib/jdom-2.0.2.jar, - lib/freemarker.jar, - lib/fmpp.jar, - lib/bsh.jar, - lib/oro.jar, - lib/resolver.jar diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties deleted file mode 100644 index 008ba6d91..000000000 --- a/tools/eclipse/config_wizard/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - lib/,\ - resources/ diff --git a/tools/eclipse/config_wizard/icons/check.gif b/tools/eclipse/config_wizard/icons/check.gif deleted file mode 100644 index 18ffabe77..000000000 Binary files a/tools/eclipse/config_wizard/icons/check.gif and /dev/null differ diff --git a/tools/eclipse/config_wizard/icons/chibios.gif b/tools/eclipse/config_wizard/icons/chibios.gif deleted file mode 100644 index ddbf1e1d1..000000000 Binary files a/tools/eclipse/config_wizard/icons/chibios.gif and /dev/null differ diff --git a/tools/eclipse/config_wizard/icons/generate.gif b/tools/eclipse/config_wizard/icons/generate.gif deleted file mode 100644 index 55e2d04ad..000000000 Binary files a/tools/eclipse/config_wizard/icons/generate.gif and /dev/null differ diff --git a/tools/eclipse/config_wizard/icons/sample.gif b/tools/eclipse/config_wizard/icons/sample.gif deleted file mode 100644 index 34fb3c9d8..000000000 Binary files a/tools/eclipse/config_wizard/icons/sample.gif and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/bsh.jar b/tools/eclipse/config_wizard/lib/bsh.jar deleted file mode 100644 index 36fe03d71..000000000 Binary files a/tools/eclipse/config_wizard/lib/bsh.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/fmpp.jar b/tools/eclipse/config_wizard/lib/fmpp.jar deleted file mode 100644 index 8cb8e6262..000000000 Binary files a/tools/eclipse/config_wizard/lib/fmpp.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/freemarker.jar b/tools/eclipse/config_wizard/lib/freemarker.jar deleted file mode 100644 index b13671dac..000000000 Binary files a/tools/eclipse/config_wizard/lib/freemarker.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/jdom-2.0.2.jar b/tools/eclipse/config_wizard/lib/jdom-2.0.2.jar deleted file mode 100644 index d540bad66..000000000 Binary files a/tools/eclipse/config_wizard/lib/jdom-2.0.2.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/oro.jar b/tools/eclipse/config_wizard/lib/oro.jar deleted file mode 100644 index 23488d260..000000000 Binary files a/tools/eclipse/config_wizard/lib/oro.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/lib/resolver.jar b/tools/eclipse/config_wizard/lib/resolver.jar deleted file mode 100644 index 073d78967..000000000 Binary files a/tools/eclipse/config_wizard/lib/resolver.jar and /dev/null differ diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml deleted file mode 100644 index d8c660eea..000000000 --- a/tools/eclipse/config_wizard/plugin.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml deleted file mode 100644 index 9b2b51fdd..000000000 --- a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml +++ /dev/null @@ -1,82 +0,0 @@ - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml b/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml deleted file mode 100644 index 2d0e5959a..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - thread_body - Empty - - - - - thread_body - Checks for Termination - - - - - thread_body - Message Server - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl deleted file mode 100644 index 45b94a320..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl +++ /dev/null @@ -1,316 +0,0 @@ -[#ftl] -[#-- - 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 . - --] - -<#-- - -- Coding style global settings. - --> -[#assign indentation = " " /] -[#assign fields_align = 24 /] -[#assign define_value_align = 36 /] -[#assign comments_align = 48 /] -[#assign boundary = 80 /] - -[#-- - -- This macro generates a brief description in DoxyGen format. - --] -[#macro EmitDoxygenBrief object=[]] - [#if object.brief[0]??] -[@utils.FormatStringAsText " * @brief " - " * " - utils.WithDot(object.brief[0]?cap_first) - boundary /] - [/#if] -[/#macro] - -[#-- - -- This macro generates a detailed description in DoxyGen format. - --] -[#macro EmitDoxygenDetails object=[]] - [#if object.details[0]??] -[@utils.FormatStringAsText " * @details " - " * " - utils.WithDot(object.details[0]?cap_first) - boundary /] - [/#if] -[/#macro] - -[#-- - -- This macro generates a notes list in DoxyGen format. - --] -[#macro EmitDoxygenNotes object=[]] - [#list object.* as note] - [#if note?node_name == "note"] - [@utils.FormatStringAsText " * @note " - " * " - utils.WithDot(note[0]?cap_first) - boundary /] - [/#if] - [/#list] -[/#macro] - -[#-- - -- This macro generates a pre-requisites list in DoxyGen format. - --] -[#macro EmitDoxygenPrerequisites object=[]] - [#list object.* as pre] - [#if pre?node_name == "pre"] - [@utils.FormatStringAsText " * @pre " - " * " - utils.WithDot(pre[0]?cap_first) - boundary /] - [/#if] - [/#list] -[/#macro] - -[#-- - -- This macro generates a post-requisites list in DoxyGen format. - --] -[#macro EmitDoxygenPostrequisites object=[]] - [#list object.* as post] - [#if post?node_name == "post"] - [@utils.FormatStringAsText " * @post " - " * " - utils.WithDot(post[0]?cap_first) - boundary /] - [/#if] - [/#list] -[/#macro] - -[#-- - -- This macro generates a complete Doxygen documentation comment. - --] -[#macro EmitDoxygenDocumentationComment object=[]] -/** - [@code.EmitDoxygenBrief object /] - [@code.EmitDoxygenDetails object /] - [@code.EmitDoxygenPrerequisites object /] - [@code.EmitDoxygenPostrequisites object /] - [@code.EmitDoxygenNotes object /] - */ -[/#macro] - -[#-- - -- This macro generates the parameters description in DoxyGen format. - --] -[#macro EmitDoxygenParams params=[]] - [#list params as param] - [#local name = (param.@name[0]!"no-name")?trim /] - [#local brief = (param.@brief[0]!"")?trim /] - [#local dir = (param.@dir[0]!"boh")?trim?lower_case /] - [#if dir == "in"] -[@utils.FormatStringAsText " * @param[in] " - " * " - utils.IntelligentDot(name + " " + brief?uncap_first) - boundary /] - [#elseif dir == "out"] -[@utils.FormatStringAsText " * @param[out] " - " * " - utils.IntelligentDot(name + " " + brief?uncap_first) - boundary /] - [#elseif dir == "both"] -[@utils.FormatStringAsText " * @param[in,out] " - " * " - utils.IntelligentDot(name + " " + brief?uncap_first) - boundary /] - [#elseif dir == "boh"] -[@utils.FormatStringAsText " * @param " - " * " - utils.IntelligentDot(name + " " + brief?uncap_first) - boundary /] - [/#if] - [/#list] -[/#macro] - -[#-- - -- This macro generates a return description followed by a retval list - -- in DoxyGen format. - --] -[#macro EmitDoxygenReturn return=[]] - [#if return[0]?? && ((return[0].@type[0]!"void")?trim != "void")] - [#local brief = (return[0].@brief[0]!"")?trim /] - [#if brief != ""] -[@utils.FormatStringAsText " * @return " - " * " - utils.WithDot(brief?cap_first) - boundary /] - [/#if] - [#list return[0].value as value] - [#local label = (value.@name[0]!"no-val")?trim /] - [#local brief = (value.@brief[0]!"")?trim /] -[@utils.FormatStringAsText " * @retval " - " * " - utils.WithDot(label + " " + brief?uncap_first) - boundary /] - [/#list] - [/#if] -[/#macro] - -[#-- - -- This macro generates the inner function code (if present). - --] -[#macro EmitCode code=[]] - [#if function.code[0]?? && (function.code[0]?trim != "")] -${indentation}${function.code[0]?trim} - [/#if] -[/#macro] - -[#-- - -- Returns true if the module exports some functions. - --] -[#function HasPublicFunctions module=[]] - [#local flag = false /] - [#list module.function as function] - [#if (function.@visibility[0]!"private") == "public"] - [#local flag = true /] - [/#if] - [/#list] - [#return flag /] -[/#function] - -[#-- - -- Returns true if the module has static functions. - --] -[#function HasPrivateFunctions module=[]] - [#local flag = false /] - [#list module.function as function] - [#if (function.@visibility[0]!"private") == "private"] - [#local flag = true /] - [/#if] - [/#list] - [#return flag /] -[/#function] - -[#-- - -- This macro generates a function prototype from an XML "function" - -- node passed as parameter. - -- @note Does not generate the final EOL. - --] -[#macro GeneratePrototype function={}] - [#if function.return?? && function.return[0]??] - [#local rettype = (function.return[0].@type[0]!"void")?trim /] - [#else] - [#local rettype = "void" /] - [/#if] - [#local name = (function.@name[0]!"no-name")?trim /] - [#local visibility = (function.@visibility[0]!"private")?trim /] - [#if function.param?? && function.param[0]??] - [#-- If the function has parameters then generates the parameters list --] - [#local l1 = rettype + " " + name + "(" /] - [#if visibility == "private"] - [#local l1 = "static " + l1 /] - [/#if] - [#local ln = ""?right_pad(l1?length) /] - [#list function.param as param] - [#local type = (param.@type[0]!"no-type")?trim /] - [#if type?contains("$")] - [#local pstring = type?replace("$", (param.@name[0]!"no-name")?trim) /] - [#else] - [#local pstring = type + " " + (param.@name[0]!"no-name")?trim /] - [/#if] - [#local dir = (param.@dir[0]!"boh")?trim?lower_case /] - [#if dir == "in"] - [#local pstring = "const " + pstring /] - [/#if] - [#if param_index == 0] - [#local line = l1 + pstring /] - [#else] - [#if (line + ", " + pstring + " ")?length > boundary] -${line + ","} - [#local line = ln + pstring /] - [#else] - [#local line = line + ", " + pstring /] - [/#if] - [/#if] - [/#list] -${line + ")"}[#rt] - [#else] -${rettype + " " + name}(void)[#rt] - [/#if] -[/#macro] - -[#-- - -- This macro generates a function (and its Doxygen documentation) - -- from an XML "function" node passed as parameter. - --] -[#macro GenerateFunction function={}] -/** -[@EmitDoxygenBrief function.@brief /] -[@EmitDoxygenDetails function.details /] -[@EmitDoxygenParams function.param /] -[@EmitDoxygenReturn function.return /] - * - * @note --Implementer notes here (or remove the tag)-- - * @bug --Known problems please here (or remove the tag)-- - * @todo --Implement this function (then remove the tag)-- - */ -[@GeneratePrototype function /] { - [#if function.code[0]??] - [#-- Makes sure to undef the do_code macro --] - [#assign inline = "[#ftl][#macro do_code function][/#macro]"?interpret /] -[@inline /] - [#-- Interprets the code within the code element --] - [#assign inline = function.code[0]?interpret /] -[@inline /] -[@do_code function /] - [#else] - -${indentation}/* ${function.@name[0]!"no-name"}() Implementation here! */ - [/#if] -} -[/#macro] - -[#-- - -- Generates the implementations for the private functions in the specified - -- module. - --] -[#macro GeneratePrivateFunctionsImplementations module] - [#list module.function as function] - [#if (function.@visibility[0]!"private") == "private"] -[@code.GenerateFunction function /] - - [/#if] - [/#list] -[/#macro] - -[#-- - -- Generates the prototypes of the public functions in the specified - -- module. - --] -[#macro GeneratePublicFunctionsPrototypes indentation module] - [#list module.function as function] - [#if (function.@visibility[0]!"private")?trim == "public"] -${indentation}[@code.GeneratePrototype function /]; - [/#if] - [/#list] -[/#macro] - -[#-- - -- Generates the implementations for the public functions in the specified - -- module. - --] -[#macro GeneratePublicFunctionsImplementations module] - [#list module.function as function] - [#if (function.@visibility[0]!"private") == "public"] -[@code.GenerateFunction function /] - - [/#if] - [/#list] -[/#macro] diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl deleted file mode 100644 index 18581ee29..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl +++ /dev/null @@ -1,58 +0,0 @@ -[#ftl] -[#-- - 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 . - --] - -[#-- - -- Emits the ChibiOS/RT standard license exception text. - -- The license exception text is indented by 4 spaces. - --] -[#macro EmitLicenseExceptionAsText] - - --- - - A special exception to the GPL can be applied should you wish to distribute - a combined work that includes ChibiOS/RT, without being obliged to provide - the source code for any proprietary components. See the file exception.txt - for full details of how and when the exception can be applied. -[/#macro] - -[#-- - -- Emits the ChibiOS/RT standard license text. - -- The license text is indented by 4 spaces. - --] -[#macro EmitLicenseAsText] - 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 . -[/#macro] diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl deleted file mode 100644 index a0680af04..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl +++ /dev/null @@ -1,33 +0,0 @@ -[#ftl] -[#-- - 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 . - --] - -[#-- - -- Find and return a code template from the templates archive. - --] -[#function GetThreadCode name] - [#list doc_snippets.code.snippets.snippet as snippet] - [#if (snippet.type[0] == "thread_body") && - ((snippet.name[0]!"")?trim?lower_case == name?trim?lower_case)] - [#return snippet.text[0]!"" /] - [/#if] - [/#list] - [#return "/* Thread style not found: " + name + " */" /] -[/#function] diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl deleted file mode 100644 index 81b8f987c..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl +++ /dev/null @@ -1,144 +0,0 @@ -[#ftl] -[#-- - 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 . - --] - -[#-- - -- Emits the STM32F4xx ADC driver constant configuration structures. - --] -[#macro EmitADCConfig config] - [#local cfg_name = config.name[0]?string /] - [@code.EmitDoxygenDocumentationComment config /] -const ADCConfig ${cfg_name} = {0}; - - [#list config.groups.group as group] - [#local grpcfg_name = group.name[0]?string /] - [@code.EmitDoxygenDocumentationComment group /] -const ADCGroupConfig ${grpcfg_name} = { - /* Circular conversion flag.*/ - ${group.circular[0]?string?upper_case}, - /* Number of channels sampled in the conversion group.*/ - ${group.channels_sequence.channel?size}, - /* End of conversion callback or NULL.*/ - [#if group.conv_callback[0]?string?trim == ""] - NULL, - [#else] - ${group.conv_callback[0]?string?trim}, - [/#if] - /* Error callback or NULL.*/ - [#if group.error_callback[0]?string?trim == ""] - NULL, - [#else] - ${group.error_callback[0]?string?trim}, - [/#if] - /* CR1 register initialization value.*/ - [#local resolution = group.resolution[0]?word_list[0]?number /] - [#local cr1 = "ADC_CR1_RESOLUTION_N(" + resolution?string + ")" /] - [#local disc = group.discontinuous[0]?word_list[0]?number /] - [#if disc > 0] - [#local cr1 = cr1 + " | ADC_CR1_DISCEN" /] - [#local cr1 = cr1 + " | ADC_CR1_DISCNUM_N(" + (disc - 1)?string + ")" /] - [/#if] - ${cr1}, - /* CR2 register initialization value.*/ - [#local exten = group.trigger_mode[0]?word_list[0]?number /] - [#local cr2 = "ADC_CR1_EXTEN_N(" + exten?string + ")" /] - [#local extsel = group.trigger_source[0]?word_list[0]?number /] - [#local cr2 = cr2 + " | ADC_CR1_EXSEL_N(" + extsel?string + ")" /] - [#if group.alignment[0]?word_list[0]?number != 0] - [#local cr2 = cr2 + " | ADC_CR2_ALIGN" /] - [/#if] - ${cr2}, - /* Channels sample time settings.*/ - [#local smpr1 = "" /] - [#local smpr2 = "" /] - [#list group.sample_time.* as input] - [#local sinput = input?node_name] - [#if input_index < 9] - [#local smpr2 = smpr2 + "ADC_SMPR2_SMP_" + input?node_name + - "(" + input?string + ") | " /] - [#elseif input_index == 9] - [#local smpr2 = smpr2 + "ADC_SMPR2_SMP_" + input?node_name + - "(" + input?string + ")," /] - [#elseif input_index < 18] - [#local smpr1 = smpr1 + "ADC_SMPR1_SMP_" + input?node_name + - "(" + input?string + ") | " /] - [#else] - [#local smpr1 = smpr1 + "ADC_SMPR1_SMP_" + input?node_name + - "(" + input?string + ")," /] - [/#if] - [/#list] - [@utils.FormatStringAsText " " " " smpr1 80 /] - [@utils.FormatStringAsText " " " " smpr2 80 /] - /* Channels sequence.*/ - [#local sqr1 = "ADC_SQR1_NUM_CH(" + group.channels_sequence?size + ")" /] - [#local sqr2 = "" /] - [#local sqr3 = "" /] - [#list group.channels_sequence.channel as channel] - [#if channel_index <= 5] - [#local sqr3 = sqr3 + "ADC_SQR3_SQ" + (channel_index + 1) + - "_N(" + channel + ")" /] - [#if channel_has_next && channel_index < 5] - [#local sqr3 = sqr3 + " | " /] - [/#if] - [#elseif channel_index <= 11] - [#local sqr2 = sqr2 + "ADC_SQR2_SQ" + (channel_index + 1) + - "_N(" + channel + ")" /] - [#if channel_has_next && channel_index < 11] - [#local sqr2 = sqr2 + " | " /] - [/#if] - [#else] - [#local sqr1 = sqr1 + " | ADC_SQR2_SQ" + (channel_index + 1) + - "_N(" + channel + ")" /] - [/#if] - [/#list] - [#-- SQR2 could be empty.--] - [#if sqr2 == ""] - [#local sqr2 = "0" /] - [/#if] - [#local sqr1 = sqr1 + "," /] - [#local sqr2 = sqr2 + "," /] - [@utils.FormatStringAsText " " " " sqr1 80 /] - [@utils.FormatStringAsText " " " " sqr2 80 /] - [@utils.FormatStringAsText " " " " sqr3 80 /] -}; - [/#list] -[/#macro] - -[#-- - -- Emits the STM32F4xx ADC driver configuration external declarations. - --] -[#macro EmitADCConfigExtern config] - [#local cfg_name = config.name[0]?string /] - [#list config.groups.group as group] - [#local grpcfg_name = group.name[0]?string /] - [#-- Only emits the comment if there is at least a callback defined.--] - /* ADC configuration "${cfg_name}".*/ - extern const ADCConfig ${cfg_name}; - /* ADC conversion group "${grpcfg_name}".*/ - extern const ADCGroupConfig ${grpcfg_name}; - [#if group.conv_callback[0]?string?trim != ""] - void ${group.conv_callback[0]?string?trim}(ADCDriver *, adcsample_t *, size_t); - [/#if] - [#if group.error_callback[0]?string?trim != ""] - void ${group.error_callback[0]?string?trim}(ADCDriver *, adcerror_t); - [/#if] - - [/#list] -[/#macro] diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl deleted file mode 100644 index 03b0622a3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl +++ /dev/null @@ -1,109 +0,0 @@ -[#ftl] -[#-- - 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 . - --] - -[#-- - -- Returns the trimmed text "s" making sure it is terminated by a dot. - -- The empty string is always returned as an empty string, the dot is not - -- added. - --] -[#function WithDot s] - [#local s = s?trim /] - [#if s == ""] - [#return s /] - [/#if] - [#if s?ends_with(".")] - [#return s /] - [/#if] - [#return s + "." /] -[/#function] - -[#-- - -- Returns the trimmed text "s" making sure it is not terminated by a dot. - --] -[#function WithoutDot s] - [#local s = s?trim /] - [#if s?ends_with(".")] - [#return s?substring(0, s?length - 2) /] - [/#if] - [#return s /] -[/#function] - -[#-- - -- Returns the trimmed text "s" making sure it is terminated by a dot if the - -- text is composed of multiple phrases, if the text is composed of a single - -- phrase then makes sure it is *not* terminated by a dot. - -- A phrase is recognized by the pattern ". " into the text. - -- The empty string is always returned as an empty string, the dot is never - -- added. - --] -[#function IntelligentDot s] - [#local s = s?trim /] - [#if s?contains(". ")] - [#return WithDot(s) /] - [/#if] - [#return WithoutDot(s) /] -[/#function] - -[#-- - -- Formats a text string in a sequence of strings no longer than "len" (first - -- line) or "lenn" (subsequent lines). - -- White spaces are normalized between words, sequences of white spaces become - -- a single space. - --] -[#function StringToText len1 lenn s] - [#local words=s?word_list /] - [#local line="" /] - [#local lines=[] /] - [#list words as word] - [#if lines?size == 0] - [#local len = len1 /] - [#else] - [#local len = lenn /] - [/#if] - [#if (line?length + word?length + 1 > len)] - [#local lines = lines + [line?trim] /] - [#local line = word + " " /] - [#else] - [#local line = line + word + " " /] - [/#if] - [/#list] - [#if line != ""] - [#local lines = lines + [line?trim] /] - [/#if] - [#return lines /] -[/#function] - -[#-- - -- Emits a string "s" as a formatted text, the first line is prefixed by the - -- "p1" parameter, subsequent lines are prefixed by the "pn" paramenter. - -- Emitted lines are no longer than the "len" parameter. - -- White spaces are normalized between words. - --] -[#macro FormatStringAsText p1 pn s len] - [#local lines = StringToText(len - p1?length, len - pn?length, s) /] - [#list lines as line] - [#if line_index == 0] -${p1}${line} - [#else] -${pn}${line} - [/#if] - [/#list] -[/#macro] diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl deleted file mode 100644 index 22510cb2b..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl +++ /dev/null @@ -1,101 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.c" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#include "ch.h" -#include "hal.h" - -#if HAL_USE_PAL || defined(__DOXYGEN__) -/** - * @brief PAL setup. - * @details Digital I/O ports static configuration as defined in @p board.h. - * This variable is used by the HAL when initializing the PAL driver. - */ -const PALConfig pal_default_config = -{ - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, - {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, - VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH} -}; -#endif - -/** - * @brief Early initialization code. - * @details This initialization must be performed just after stack setup - * and before any other initialization. - */ -void __early_init(void) { - - stm32_clock_init(); -[#if doc1.board.board_functions.__early_init[0]??] - ${doc1.board.board_functions.__early_init[0]} -[/#if] -} - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.mmc_lld_is_card_inserted[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_write_protected[0]??] -${doc1.board.board_functions.mmc_lld_is_write_protected[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { -} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl deleted file mode 100644 index 6eb360b6c..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl +++ /dev/null @@ -1,326 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.h" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -/* - * Setup for ${doc1.board.board_name[0]} board. - */ - -/* - * Board identifier. - */ -#define BOARD_${doc1.board.board_id[0]} -#define BOARD_NAME "${doc1.board.board_name[0]}" - -[#if doc1.board.ethernet_phy[0]??] -/* - * Ethernet PHY type. - */ -#define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} -[#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] -#define BOARD_PHY_RMII -[/#if] - -[/#if] -/* - * Board oscillators-related settings. -[#if doc1.board.clocks.@LSEFrequency[0]?number == 0] - * NOTE: LSE not fitted. -[/#if] -[#if doc1.board.clocks.@HSEFrequency[0]?number == 0] - * NOTE: HSE not fitted. -[/#if] - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.clocks.@LSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@LSEBypass[0]?string == "true"] -#define STM32_LSE_BYPASS - -[/#if] -#define STM32_LSEDRV (${doc1.board.clocks.@LSEDrive[0]?word_list[0]?number} << 3) - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.clocks.@HSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@HSEBypass[0]?string == "true"] -#define STM32_HSE_BYPASS - -[/#if] -/* - * MCU type as defined in the ST header file stm32f0xx.h. - */ -#define STM32F0XX - -/* - * IO pins assignments. - */ -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] -#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pin_index?string} - [/#list] - -[/#list] -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_2M(n) (0U << ((n) * 2)) -#define PIN_OSPEED_10M(n) (1U << ((n) * 2)) -#define PIN_OSPEED_40M(n) (3U << ((n) * 2)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) -#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) - -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] -/* - * ${port_name} setup: - * - [#-- Generating pin descriptions inside the comment.--] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#assign type = pin.@Type[0] /] - [#assign resistor = pin.@Resistor[0] /] - [#assign speed = pin.@Speed[0] /] - [#assign alternate = pin.@Alternate[0] /] - [#if mode == "Input"] - [#assign desc = mode + " " + resistor /] - [#elseif mode == "Output"] - [#assign desc = mode + " " + type + " " + speed /] - [#elseif mode == "Alternate"] - [#assign desc = mode + " " + alternate /] - [#else] - [#assign desc = "Analog" /] - [/#if] - * P${(port?node_name[4..] + pin_index?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). - [/#list] - */ - [#-- - -- Generating MODER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#if mode == "Input"] - [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Output"] - [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Alternate"] - [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating OTYPER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign type = pin.@Type[0] /] - [#if type == "PushPull"] - [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating SPEEDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign speed = pin.@Speed[0] /] - [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] - [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] - [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_10M(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OSPEED_40M(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating PUPDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign resistor = pin.@Resistor[0] /] - [#if resistor == "Floating"] - [#assign out = "PIN_PUPDR_FLOATING(" + port_name + "_" + name + ")" /] - [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUPDR_PULLUP(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating ODR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign level = pin.@Level[0] /] - [#if level == "Low"] - [#assign out = "PIN_ODR_LOW(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating AFRx registers values. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign alternate = pin.@Alternate[0]?trim /] - [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] - [#elseif pin_index == 8] - [#assign line = "#define VAL_" + port_name + "_AFRH (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if (pin_index == 7) || (pin_index == 15)] -${line + ")"} - [#else] -${(line + " |")?right_pad(76, " ") + "\\"} - [/#if] - [/#list] - -[/#list] - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif /* _FROM_ASM_ */ - -#endif /* _BOARD_H_ */ diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl deleted file mode 100644 index c88471ac3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl +++ /dev/null @@ -1,28 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[@pp.changeOutputFile name="board.mk" /] -# List of all the board related files. -BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]}/board.c - -# Required include directories -BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl deleted file mode 100644 index 03a4df8c3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl +++ /dev/null @@ -1,133 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.c" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#include "ch.h" -#include "hal.h" - -#if HAL_USE_PAL || defined(__DOXYGEN__) -/** - * @brief PAL setup. - * @details Digital I/O ports static configuration as defined in @p board.h. - * This variable is used by the HAL when initializing the PAL driver. - */ -const PALConfig pal_default_config = -{ - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, - {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, - VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, - {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, - VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH} -}; -#endif - -/** - * @brief Early initialization code. - * @details This initialization must be performed just after stack setup - * and before any other initialization. - */ -void __early_init(void) { - - stm32_clock_init(); -[#if doc1.board.board_functions.__early_init[0]??] - ${doc1.board.board_functions.__early_init[0]} -[/#if] -} - -#if HAL_USE_SDC || defined(__DOXYGEN__) -/** - * @brief SDC card detection. - */ -bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.sdc_lld_is_card_inserted[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief SDC card write protection detection. - */ -bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_write_protected[0]??] -${doc1.board.board_functions.sdc_lld_is_write_protected[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif /* HAL_USE_SDC */ - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.mmc_lld_is_card_inserted[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_write_protected[0]??] -${doc1.board.board_functions.mmc_lld_is_write_protected[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { -} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl deleted file mode 100644 index da8169026..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl +++ /dev/null @@ -1,327 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.h" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -/* - * Setup for ${doc1.board.board_name[0]} board. - */ - -/* - * Board identifier. - */ -#define BOARD_${doc1.board.board_id[0]} -#define BOARD_NAME "${doc1.board.board_name[0]}" - -[#if doc1.board.ethernet_phy[0]??] -/* - * Ethernet PHY type. - */ -#define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} -[#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] -#define BOARD_PHY_RMII -[/#if] - -[/#if] -/* - * Board oscillators-related settings. -[#if doc1.board.clocks.@LSEFrequency[0]?number == 0] - * NOTE: LSE not fitted. -[/#if] -[#if doc1.board.clocks.@HSEFrequency[0]?number == 0] - * NOTE: HSE not fitted. -[/#if] - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.clocks.@LSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@LSEBypass[0]?string == "true"] -#define STM32_LSE_BYPASS - -[/#if] -#define STM32_LSEDRV (${doc1.board.clocks.@LSEDrive[0]?word_list[0]?number} << 3) - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.clocks.@HSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@HSEBypass[0]?string == "true"] -#define STM32_HSE_BYPASS - -[/#if] -/* - * MCU type as defined in the ST header file stm32f30x.h. - */ -#define STM32F30X - -/* - * IO pins assignments. - */ -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] -#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pin_index?string} - [/#list] - -[/#list] -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_2M(n) (0U << ((n) * 2)) -#define PIN_OSPEED_25M(n) (1U << ((n) * 2)) -#define PIN_OSPEED_50M(n) (2U << ((n) * 2)) -#define PIN_OSPEED_100M(n) (3U << ((n) * 2)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) -#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) - -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] -/* - * ${port_name} setup: - * - [#-- Generating pin descriptions inside the comment.--] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#assign type = pin.@Type[0] /] - [#assign resistor = pin.@Resistor[0] /] - [#assign speed = pin.@Speed[0] /] - [#assign alternate = pin.@Alternate[0] /] - [#if mode == "Input"] - [#assign desc = mode + " " + resistor /] - [#elseif mode == "Output"] - [#assign desc = mode + " " + type + " " + speed /] - [#elseif mode == "Alternate"] - [#assign desc = mode + " " + alternate /] - [#else] - [#assign desc = "Analog" /] - [/#if] - * P${(port?node_name[4..] + pin_index?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). - [/#list] - */ - [#-- - -- Generating MODER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#if mode == "Input"] - [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Output"] - [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Alternate"] - [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating OTYPER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign type = pin.@Type[0] /] - [#if type == "PushPull"] - [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating SPEEDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign speed = pin.@Speed[0] /] - [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] - [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_25M(" + port_name + "_" + name + ")" /] - [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_50M(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating PUPDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign resistor = pin.@Resistor[0] /] - [#if resistor == "Floating"] - [#assign out = "PIN_PUPDR_FLOATING(" + port_name + "_" + name + ")" /] - [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUPDR_PULLUP(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating ODR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign level = pin.@Level[0] /] - [#if level == "Low"] - [#assign out = "PIN_ODR_LOW(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating AFRx registers values. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign alternate = pin.@Alternate[0]?trim /] - [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] - [#elseif pin_index == 8] - [#assign line = "#define VAL_" + port_name + "_AFRH (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if (pin_index == 7) || (pin_index == 15)] -${line + ")"} - [#else] -${(line + " |")?right_pad(76, " ") + "\\"} - [/#if] - [/#list] - -[/#list] - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif /* _FROM_ASM_ */ - -#endif /* _BOARD_H_ */ diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl deleted file mode 100644 index c88471ac3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl +++ /dev/null @@ -1,28 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[@pp.changeOutputFile name="board.mk" /] -# List of all the board related files. -BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]}/board.c - -# Required include directories -BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl deleted file mode 100644 index f38fd106a..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl +++ /dev/null @@ -1,139 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.c" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#include "ch.h" -#include "hal.h" - -#if HAL_USE_PAL || defined(__DOXYGEN__) -/** - * @brief PAL setup. - * @details Digital I/O ports static configuration as defined in @p board.h. - * This variable is used by the HAL when initializing the PAL driver. - */ -const PALConfig pal_default_config = -{ - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, - {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, - VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, - {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, - VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, - {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, - VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, - {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, - VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, - {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, - VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} -}; -#endif - -/** - * @brief Early initialization code. - * @details This initialization must be performed just after stack setup - * and before any other initialization. - */ -void __early_init(void) { - - stm32_clock_init(); -[#if doc1.board.board_functions.__early_init[0]??] - ${doc1.board.board_functions.__early_init[0]} -[/#if] -} - -#if HAL_USE_SDC || defined(__DOXYGEN__) -/** - * @brief SDC card detection. - */ -bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.sdc_lld_is_card_inserted[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief SDC card write protection detection. - */ -bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_write_protected[0]??] -${doc1.board.board_functions.sdc_lld_is_write_protected[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif /* HAL_USE_SDC */ - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.mmc_lld_is_card_inserted[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_write_protected[0]??] -${doc1.board.board_functions.mmc_lld_is_write_protected[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { -} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl deleted file mode 100644 index c24c0a355..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ /dev/null @@ -1,327 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.h" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -/* - * Setup for ${doc1.board.board_name[0]} board. - */ - -/* - * Board identifier. - */ -#define BOARD_${doc1.board.board_id[0]} -#define BOARD_NAME "${doc1.board.board_name[0]}" - -[#if doc1.board.ethernet_phy[0]??] -/* - * Ethernet PHY type. - */ -#define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} -[#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] -#define BOARD_PHY_RMII -[/#if] -[/#if] - -/* - * Board oscillators-related settings. -[#if doc1.board.clocks.@LSEFrequency[0]?number == 0] - * NOTE: LSE not fitted. -[/#if] -[#if doc1.board.clocks.@HSEFrequency[0]?number == 0] - * NOTE: HSE not fitted. -[/#if] - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.clocks.@LSEFrequency[0]} -#endif - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.clocks.@HSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@HSEBypass[0]?string == "true"] -#define STM32_HSE_BYPASS -[/#if] - -/* - * Board voltages. - * Required for performance limits calculation. - */ -#define STM32_VDD ${doc1.board.clocks.@VDD[0]} - -/* - * MCU type as defined in the ST header file stm32f4xx.h. - */ -#define STM32F4XX - -/* - * IO pins assignments. - */ -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] -#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pin_index?string} - [/#list] - -[/#list] -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_2M(n) (0U << ((n) * 2)) -#define PIN_OSPEED_25M(n) (1U << ((n) * 2)) -#define PIN_OSPEED_50M(n) (2U << ((n) * 2)) -#define PIN_OSPEED_100M(n) (3U << ((n) * 2)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) -#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) - -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] -/* - * ${port_name} setup: - * - [#-- Generating pin descriptions inside the comment.--] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#assign type = pin.@Type[0] /] - [#assign resistor = pin.@Resistor[0] /] - [#assign speed = pin.@Speed[0] /] - [#assign alternate = pin.@Alternate[0] /] - [#if mode == "Input"] - [#assign desc = mode + " " + resistor /] - [#elseif mode == "Output"] - [#assign desc = mode + " " + type + " " + speed /] - [#elseif mode == "Alternate"] - [#assign desc = mode + " " + alternate /] - [#else] - [#assign desc = "Analog" /] - [/#if] - * P${(port?node_name[4..] + pin_index?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). - [/#list] - */ - [#-- - -- Generating MODER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#if mode == "Input"] - [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Output"] - [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Alternate"] - [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating OTYPER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign type = pin.@Type[0] /] - [#if type == "PushPull"] - [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating SPEEDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign speed = pin.@Speed[0] /] - [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] - [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_25M(" + port_name + "_" + name + ")" /] - [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_50M(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating PUPDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign resistor = pin.@Resistor[0] /] - [#if resistor == "Floating"] - [#assign out = "PIN_PUPDR_FLOATING(" + port_name + "_" + name + ")" /] - [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUPDR_PULLUP(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating ODR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign level = pin.@Level[0] /] - [#if level == "Low"] - [#assign out = "PIN_ODR_LOW(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating AFRx registers values. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign alternate = pin.@Alternate[0]?trim /] - [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] - [#elseif pin_index == 8] - [#assign line = "#define VAL_" + port_name + "_AFRH (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if (pin_index == 7) || (pin_index == 15)] -${line + ")"} - [#else] -${(line + " |")?right_pad(76, " ") + "\\"} - [/#if] - [/#list] - -[/#list] - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif /* _FROM_ASM_ */ - -#endif /* _BOARD_H_ */ diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl deleted file mode 100644 index c88471ac3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl +++ /dev/null @@ -1,28 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[@pp.changeOutputFile name="board.mk" /] -# List of all the board related files. -BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]}/board.c - -# Required include directories -BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl deleted file mode 100644 index b46be86a2..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl +++ /dev/null @@ -1,133 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.c" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#include "ch.h" -#include "hal.h" - -#if HAL_USE_PAL || defined(__DOXYGEN__) -/** - * @brief PAL setup. - * @details Digital I/O ports static configuration as defined in @p board.h. - * This variable is used by the HAL when initializing the PAL driver. - */ -const PALConfig pal_default_config = -{ - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, - {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, - VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, - {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, - VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH} -}; -#endif - -/** - * @brief Early initialization code. - * @details This initialization must be performed just after stack setup - * and before any other initialization. - */ -void __early_init(void) { - - stm32_clock_init(); -[#if doc1.board.board_functions.__early_init[0]??] - ${doc1.board.board_functions.__early_init[0]} -[/#if] -} - -#if HAL_USE_SDC || defined(__DOXYGEN__) -/** - * @brief SDC card detection. - */ -bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.sdc_lld_is_card_inserted[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief SDC card write protection detection. - */ -bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) { -[#if doc1.board.board_functions.sdc_lld_is_write_protected[0]??] -${doc1.board.board_functions.sdc_lld_is_write_protected[0]} -[#else] - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif /* HAL_USE_SDC */ - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_card_inserted[0]??] -${doc1.board.board_functions.mmc_lld_is_card_inserted[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return TRUE; -[/#if] -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { -[#if doc1.board.board_functions.mmc_lld_is_write_protected[0]??] -${doc1.board.board_functions.mmc_lld_is_write_protected[0]} -[#else] - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return FALSE; -[/#if] -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { -} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl deleted file mode 100644 index 76db7eb27..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl +++ /dev/null @@ -1,321 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name="board.h" /] -/* -[@license.EmitLicenseAsText /] -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -/* - * Setup for ${doc1.board.board_name[0]} board. - */ - -/* - * Board identifier. - */ -#define BOARD_${doc1.board.board_id[0]} -#define BOARD_NAME "${doc1.board.board_name[0]}" - -[#if doc1.board.ethernet_phy[0]??] -/* - * Ethernet PHY type. - */ -#define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} -[#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] -#define BOARD_PHY_RMII -[/#if] -[/#if] - -/* - * Board oscillators-related settings. -[#if doc1.board.clocks.@LSEFrequency[0]?number == 0] - * NOTE: LSE not fitted. -[/#if] -[#if doc1.board.clocks.@HSEFrequency[0]?number == 0] - * NOTE: HSE not fitted. -[/#if] - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.clocks.@LSEFrequency[0]} -#endif - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.clocks.@HSEFrequency[0]} -#endif - -[#if doc1.board.clocks.@HSEBypass[0]?string == "true"] -#define STM32_HSE_BYPASS -[/#if] - -/* - * MCU type as defined in the ST header file stm32l1xx.h. - */ -#define STM32L1XX_MD - -/* - * IO pins assignments. - */ -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] -#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pin_index?string} - [/#list] - -[/#list] -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_400K(n) (0U << ((n) * 2)) -#define PIN_OSPEED_2M(n) (1U << ((n) * 2)) -#define PIN_OSPEED_10M(n) (2U << ((n) * 2)) -#define PIN_OSPEED_40M(n) (3U << ((n) * 2)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) -#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) - -[#list doc1.board.ports.* as port] - [#assign port_name = port?node_name?upper_case /] -/* - * ${port_name} setup: - * - [#-- Generating pin descriptions inside the comment.--] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#assign type = pin.@Type[0] /] - [#assign resistor = pin.@Resistor[0] /] - [#assign speed = pin.@Speed[0] /] - [#assign alternate = pin.@Alternate[0] /] - [#if mode == "Input"] - [#assign desc = mode + " " + resistor /] - [#elseif mode == "Output"] - [#assign desc = mode + " " + type + " " + speed /] - [#elseif mode == "Alternate"] - [#assign desc = mode + " " + alternate /] - [#else] - [#assign desc = "Analog" /] - [/#if] - * P${(port?node_name[4..] + pin_index?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). - [/#list] - */ - [#-- - -- Generating MODER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign mode = pin.@Mode[0] /] - [#if mode == "Input"] - [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Output"] - [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + name + ")" /] - [#elseif mode == "Alternate"] - [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating OTYPER register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign type = pin.@Type[0] /] - [#if type == "PushPull"] - [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating SPEEDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign speed = pin.@Speed[0] /] - [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_400K(" + port_name + "_" + name + ")" /] - [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] - [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_10M(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_OSPEED_40M(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating PUPDR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign resistor = pin.@Resistor[0] /] - [#if resistor == "Floating"] - [#assign out = "PIN_PUPDR_FLOATING(" + port_name + "_" + name + ")" /] - [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUPDR_PULLUP(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating ODR register value. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign level = pin.@Level[0] /] - [#if level == "Low"] - [#assign out = "PIN_ODR_LOW(" + port_name + "_" + name + ")" /] - [#else] - [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] - [/#if] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if pin_index < 15] -${(line + " |")?right_pad(76, " ") + "\\"} - [#else] -${line + ")"} - [/#if] - [/#list] - [#-- - -- Generating AFRx registers values. - --] - [#list port.* as pin] - [#assign pin_name = pin?node_name?upper_case /] - [#assign name = pin.@ID[0]?string?trim /] - [#if name?length == 0] - [#assign name = pin_name /] - [/#if] - [#assign alternate = pin.@Alternate[0]?trim /] - [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] - [#if pin_index == 0] - [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] - [#elseif pin_index == 8] - [#assign line = "#define VAL_" + port_name + "_AFRH (" + out /] - [#else] - [#assign line = " " + out /] - [/#if] - [#if (pin_index == 7) || (pin_index == 15)] -${line + ")"} - [#else] -${(line + " |")?right_pad(76, " ") + "\\"} - [/#if] - [/#list] - -[/#list] - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif /* _FROM_ASM_ */ - -#endif /* _BOARD_H_ */ diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl deleted file mode 100644 index c88471ac3..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl +++ /dev/null @@ -1,28 +0,0 @@ -[#ftl] -[#-- - 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 . - --] -[@pp.dropOutputFile /] -[#import "/@lib/libutils.ftl" as utils /] -[@pp.changeOutputFile name="board.mk" /] -# List of all the board related files. -BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]}/board.c - -# Required include directories -BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]} diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml deleted file mode 100644 index b4998fd9a..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - STM32F0xx Board Configuration - resources/gencfg/processors/boards/stm32f0xx/templates - resources/gencfg/xml/stm32f0board.xml - board - - - STM32F3xx Board Configuration - resources/gencfg/processors/boards/stm32f3xx/templates - resources/gencfg/xml/stm32f3board.xml - board - - - STM32F4xx Board Configuration - resources/gencfg/processors/boards/stm32f4xx/templates - resources/gencfg/xml/stm32f4board.xml - board - - - STM32L1xx Board Configuration - resources/gencfg/processors/boards/stm32l1xx/templates - resources/gencfg/xml/stm32l1board.xml - board - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd deleted file mode 100644 index a1c696339..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd deleted file mode 100644 index fb41cf6ea..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd deleted file mode 100644 index 74ad4d7ba..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd deleted file mode 100644 index f0d5a0a87..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd deleted file mode 100644 index 01350cc7c..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd deleted file mode 100644 index ad0bad11a..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd deleted file mode 100644 index 45d228142..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - Templates resources associated to the configuration. - - - - - - - - - - - - Output directory relative to the configuration file. - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd deleted file mode 100644 index e5be361d5..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - >Generic item with optional name and brief - description - - - - - - Name of the object. - - - - - - - - - - - - - - - - >Something that can have a detailed description - attached - - - - - - - - - Brief description of the object. - - - - - - - - - - - - - - Object documentation as text, does not preserve - formatting. - - - - - - - - - - - - Object pre-requisites as text, does not preserve - formatting. - - - - - - - - - - - - Object post-requisites as text, does not preserve - formatting. - - - - - - - - - - - - Object note as text, does not preserve formatting. - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd deleted file mode 100644 index c3ac59487..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Object representing an STM32 pin for the GPIOv2 - peripheral. - - - - - Pin identifier, used to generate a #define with the - pin name. - - - - - - - - - - - - - - - - Pin mode, as defined for MODER register. - - - - - - - - - - - - - - Logic level for the ODR register. - - - - - - - - - - - - Pin speed as defined in SPEEDR register. - - - - - - - - - - - - - - - Pin type as defined in TYPER register. - - - - - - - - - - - - - Pin pull-up/down resistor as defined in PUDR register. - - - - - - - - - - - - - - Pin alternate function number, only valid if - "Alternate" is selected - in the Mode attribute. - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml deleted file mode 100644 index 843dfe925..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ /dev/null @@ -1,669 +0,0 @@ - - - - - resources/gencfg/processors/boards/stm32f0xx/templates - . - - -----human readable board name----- - BOARD_IDENTIFIER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml deleted file mode 100644 index a552903be..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml +++ /dev/null @@ -1,797 +0,0 @@ - - - - - resources/gencfg/processors/boards/stm32f3xx/templates - . - - -----human readable board name----- - BOARD_IDENTIFIER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml deleted file mode 100644 index 66a09d0d6..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml +++ /dev/null @@ -1,1194 +0,0 @@ - - - - - resources/gencfg/processors/boards/stm32f4xx/templates - . - - -----human readable board name----- - BOARD_IDENTIFIER - - - MII_KS8721_ID - RMII - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml deleted file mode 100644 index 00e5b5319..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml +++ /dev/null @@ -1,799 +0,0 @@ - - - - - resources/gencfg/processors/boards/stm32l1xx/templates - . - - -----human readable board name----- - BOARD_IDENTIFIER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/config_wizard/src/config_wizard/Activator.java b/tools/eclipse/config_wizard/src/config_wizard/Activator.java deleted file mode 100644 index 1f62c4f62..000000000 --- a/tools/eclipse/config_wizard/src/config_wizard/Activator.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - 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 . - */ - -package config_wizard; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.chibios.tools.eclipse.config"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} 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 deleted file mode 100644 index 0d7e7e292..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 . -*/ - -package org.chibios.tools.eclipse.config.handlers; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.handlers.HandlerUtil; -import org.eclipse.jface.dialogs.MessageDialog; - -/** - * Our sample handler extends AbstractHandler, an IHandler base class. - * @see org.eclipse.core.commands.IHandler - * @see org.eclipse.core.commands.AbstractHandler - */ -public class CheckDescription extends AbstractHandler { - - /** - * The constructor. - */ - public CheckDescription() { - } - - /** - * the command has been executed, so extract extract the needed information - * from the application context. - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); - MessageDialog.openInformation( - window.getShell(), - "ChibiOS-RT_Configuration_Support", - "Hello, Eclipse world"); - return null; - } -} 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 deleted file mode 100644 index aad5adfce..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.handlers; - -import java.io.File; -import java.io.IOException; - -import org.chibios.tools.eclipse.config.utils.TemplateEngine; -import org.chibios.tools.eclipse.config.utils.TemplateException; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -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.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -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.ui.IWorkbenchWindow; -import org.eclipse.ui.handlers.HandlerUtil; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.jdom2.Document; -import org.jdom2.Element; -import org.jdom2.JDOMException; -import org.jdom2.input.SAXBuilder; -import org.osgi.framework.Bundle; - -import config_wizard.Activator; - -/** - * Our sample handler extends AbstractHandler, an IHandler base class. - * - * @see org.eclipse.core.commands.IHandler - * @see org.eclipse.core.commands.AbstractHandler - */ -public class GenerateFiles extends AbstractHandler { - - /** - * The constructor. - */ - public GenerateFiles() { - } - - /** - * the command has been executed, so extract extract the needed information - * from the application context. - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - - IWorkbenchWindow window = HandlerUtil - .getActiveWorkbenchWindowChecked(event); - ISelection selection = window.getSelectionService().getSelection(); - if (selection instanceof IStructuredSelection) { - - /* Retrieves the full path of the configuration file. */ - IPath cfgfilepath = ((IFile)((IStructuredSelection)selection) - .getFirstElement()).getLocation(); - - /* DOM tree creation. */ - SAXBuilder builder = new SAXBuilder(); - Document document; - try { - document = builder.build(cfgfilepath.toFile()); - } catch (JDOMException e) { - return null; - } catch (IOException e) { - return null; - } - - /* Retrieving configuration settings info.*/ - Element settings = document.getRootElement().getChild("configuration_settings"); - String templates_path = settings.getChildText("templates_path"); - String output_path = settings.getChildText("output_path"); - - /* Calculating derived paths. */ - IPath tpath = new Path(templates_path); - try { - Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - tpath = new Path(FileLocator.toFileURL( - FileLocator.find(bundle, tpath, null)).getFile()); - } catch (IOException e) { - MessageDialog.openInformation(window.getShell(), "Path Error", - e.getMessage()); - return null; - } - - /* Templates execution. */ - try { - TemplateEngine.process(cfgfilepath.toFile(), - tpath.toFile(), - new File(output_path)); - } catch (TemplateException e) { - MessageDialog.openInformation(window.getShell(), "Processing Error", - e.getMessage()); - return null; - } - - /* Destination directory refresh.*/ - IContainer container = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(cfgfilepath).getParent(); - try { - container.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (CoreException e) { - e.printStackTrace(); - } - } - return null; - } -} 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 deleted file mode 100644 index e85442d81..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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 . - */ - -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 deleted file mode 100644 index ce1e5325a..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.utils; - -import java.io.IOException; -import java.util.HashMap; - -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; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.console.ConsolePlugin; -import org.eclipse.ui.console.IConsole; -import org.eclipse.ui.console.IConsoleConstants; -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; -import fmpp.setting.SettingException; -import fmpp.setting.Settings; -import freemarker.ext.dom.NodeModel; -import freemarker.template.TemplateNodeModel; - -/** - * FMPP wrapper class. - */ -public class TemplateEngine { - - private final static String CONSOLE_NAME = "ChibiOS/RT Configuration Tool"; - - private final static Color DEFAULT_MESSAGE = new Color(Display.getDefault(), new RGB(0, 0, 255)); - private final static Color DEFAULT_OUTPUT = new Color(Display.getDefault(), new RGB(0, 0, 0)); - private final static Color DEFAULT_WARNING = new Color(Display.getDefault(), new RGB(255, 255, 0)); - private final static Color DEFAULT_ERROR = new Color(Display.getDefault(), new RGB(255, 0, 0)); - - private static Settings settings; - private static MessageConsoleStream msg; - private static MessageConsoleStream out; - private static MessageConsoleStream err; - private static MessageConsoleStream warn; - - /** - * Runs the templates engine. - * - * @param xmldata - * absolute path to XML data file - * @param sourcedir - * absolute path to templates directory - * @param outputdir - * output directory relative to xmldata - * - * @throws SettingException - * @throws ProcessingException - */ - public static void process(java.io.File xmldata, - java.io.File sourcedir, - java.io.File outputdir) throws TemplateException { - - /* Finds or creates a named console. */ - MessageConsole console = findConsole(CONSOLE_NAME); - activateConsole(console); - console.clearConsole(); - msg = console.newMessageStream(); - msg.setColor(DEFAULT_MESSAGE); - out = console.newMessageStream(); - out.setColor(DEFAULT_OUTPUT); - err = console.newMessageStream(); - err.setColor(DEFAULT_ERROR); - warn = console.newMessageStream(); - 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. - */ - try { - settings = new Settings(xmldata.getParentFile()); - } catch (SettingException e) { - e.printStackTrace(); - return; - } - settings.addProgressListener(new ProgressListener() { - public void notifyProgressEvent(Engine engine, int event, - java.io.File src, int pMode, - java.lang.Throwable error, - java.lang.Object param) { - - if (error != null) { - err.println(": " + error.getMessage()); - return; - } - - if (pMode == Engine.PMODE_IGNORE) - return; - - switch (event) { - case EVENT_BEGIN_PROCESSING_SESSION: - msg.println("Starting session"); - msg.println(); - break; - case EVENT_END_PROCESSING_SESSION: - msg.println(); - msg.println("Finished"); - break; - case EVENT_BEGIN_FILE_PROCESSING: - out.println("> Processing " + src.getName()); - break; - case EVENT_END_FILE_PROCESSING: - break; - case EVENT_IGNORING_DIR: - out.println("> Ignoring directory " + src.getName()); - break; - case EVENT_SOURCE_NOT_MODIFIED: - out.println("> Skipping " + src.getName()); - break; - case EVENT_WARNING: - warn.println(": " + (String)param); - break; - } - } - }); - - /* Loading data model. */ - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - dbf.setValidating(false); - DocumentBuilder db; - try { - db = dbf.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - throw new TemplateException(e.getMessage()); - } - Document dom1, dom_snippets; - try { - dom1 = db.parse(xmldata); - java.io.File xmlsnippets = libpath.addTrailingSeparator().append("code_snippets.xml").toFile(); - dom_snippets = db.parse(xmlsnippets); - } catch (SAXException e) { - throw new TemplateException(e.getMessage()); - } catch (IOException e) { - throw new TemplateException(e.getMessage()); - } - - NodeModel.removeComments(dom1); - NodeModel.mergeAdjacentText(dom1); - NodeModel.removeComments(dom_snippets); - TemplateNodeModel doc1 = NodeModel.wrap(dom1); - NodeModel.mergeAdjacentText(dom_snippets); - TemplateNodeModel doc_snippets = NodeModel.wrap(dom_snippets); - - HashMap xmls = new HashMap(); - xmls.put("doc1", doc1); - xmls.put("doc_snippets", doc_snippets); - - /* Setting libraries path. */ - HashMap libs = new HashMap(); - libs.put("lib", libpath.toString()); - - /* Other settings. */ - try { - settings.add("freemarkerLinks", libs); - settings.add("data", xmls); - settings.add("sourceRoot", sourcedir.toString()); - settings.add("outputRoot", outputdir.toString()); - settings.add("ignoreCvsFiles", true); - settings.add("ignoreSvnFiles", true); - } catch (SettingException e) { - throw new TemplateException(e.getMessage()); - } - - /* Processor execution. */ - try { - settings.execute(); - } catch (SettingException e) { - throw new TemplateException(e.getMessage()); - } catch (ProcessingException e) { - throw new TemplateException(e.getMessage()); - } - } - - private static MessageConsole findConsole(String name) { - ConsolePlugin plugin = ConsolePlugin.getDefault(); - IConsoleManager conMan = plugin.getConsoleManager(); - IConsole[] existing = conMan.getConsoles(); - for (int i = 0; i < existing.length; i++) - if (name.equals(existing[i].getName())) - return (MessageConsole) existing[i]; - - /* No console found, so create a new one. */ - MessageConsole myConsole = new MessageConsole(name, null); - conMan.addConsoles(new IConsole[] { myConsole }); - return myConsole; - } - - private static void activateConsole(MessageConsole console) { - IWorkbench wb = PlatformUI.getWorkbench(); - IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); - IWorkbenchPage page = win.getActivePage(); - IConsoleView view; - try { - view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); - } catch (PartInitException e) { - e.printStackTrace(); - return; - } - view.display(console); - } -} diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java deleted file mode 100644 index 73746de1d..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.utils; - -public class TemplateException extends Exception { - - private static final long serialVersionUID = -3317410595937500925L; - - public TemplateException(String msg) { - super(msg); - } -} diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java deleted file mode 100644 index 28ee7e6e7..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.wizards; - -import java.lang.reflect.InvocationTargetException; -import java.io.*; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.operation.*; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.ui.*; -import org.eclipse.ui.ide.IDE; -import org.osgi.framework.Bundle; - -import config_wizard.Activator; - -/** - * This is a sample new wizard. Its role is to create a new file resource in the - * provided container. If the container resource (a folder or a project) is - * selected in the workspace when the wizard is opened, it will accept it as the - * target container. The wizard creates one file with the extension "chcfg". If - * a sample multi-page editor (also available as a template) is registered for - * the same extension, it will be able to open it. - */ - -public class ConfigurationNewWizard extends Wizard implements INewWizard { - private ConfigurationNewWizardPage page; - private ISelection selection; - - private String containerName; - private String projectFileName; - private String defaultDataFile; - - /** - * Constructor for ConfigurationNewWizard. - */ - public ConfigurationNewWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - public void addPages() { - page = new ConfigurationNewWizardPage(selection); - addPage(page); - } - - /** - * Checks if the wizard page allows to finish. - */ - public boolean canFinish() { - - return page.canFinish(); - } - - /** - * This method is called when 'Finish' button is pressed in the wizard. We - * will create an operation and run it using wizard as execution context. - */ - public boolean performFinish() { - - containerName = page.getContainerName(); - projectFileName = page.getProjectFileName(); - defaultDataFile = page.getDefaultDataFile(); - - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException { - try { - doFinish(monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the file if missing - * or just replace its contents, and open the editor on the newly created - * file. - */ - private void doFinish(IProgressMonitor monitor) throws CoreException { - - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName + "\" does not exist."); - } - IContainer container = (IContainer)resource; - monitor.beginTask("Creating " + projectFileName, 3); - - /* Step #1, creates the project file.*/ - final IFile projectFile = container.getFile(new Path(projectFileName)); - Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - IPath path = new Path(defaultDataFile); - String s; - try { - s = FileLocator.toFileURL(FileLocator.find(bundle, path, null)).getFile(); - InputStream stream = new FileInputStream(s); - if (projectFile.exists()) { - projectFile.setContents(stream, true, true, monitor); - } else { - projectFile.create(stream, true, monitor); - } - stream.close(); - } catch (IOException e) { - } - monitor.worked(1); - - /* Step #2, opens the XML data file.*/ - monitor.setTaskName("Opening XML data file for editing..."); - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - try { - IDE.openEditor(page, projectFile, true); - } catch (PartInitException e) { - } - } - }); - monitor.worked(1); - - /* Step #3, refreshing local resources.*/ - container.refreshLocal(IResource.DEPTH_INFINITE, monitor); - monitor.worked(1); - } - - private void throwCoreException(String message) throws CoreException { - IStatus status = new Status(IStatus.ERROR, - "org.chibios.tools.eclipse.config", IStatus.OK, - message, null); - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if we can initialize - * from it. - * - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java deleted file mode 100644 index d503d9748..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.wizards; - -import java.io.IOException; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -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.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Combo; - -import org.osgi.framework.Bundle; - -import org.jdom2.Document; -import org.jdom2.Element; -import org.jdom2.JDOMException; -import org.jdom2.input.SAXBuilder; - -import config_wizard.Activator; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (chcfg). - */ - -public class ConfigurationNewWizardPage extends WizardPage { - - private ISelection selection; - private IContainer resourceContainer; - - private Document processorsDocument; - private String currentDefaultDataFile; - - private Composite container; - private Combo configurationTemplatesCombo; - private Text confProjectFilenameText; - - /** - * Constructor for SampleNewWizardPage. - */ - public ConfigurationNewWizardPage(ISelection selection) { - - super("wizardPage"); - setTitle("ChibiOS/RT Configuration Project File"); - setDescription("This wizard creates a ChibiOS/RT configuration resource. Configuration resources allow to generate project resources starting from high level descriptions written in XML."); - this.selection = selection; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - @Override - public void createControl(Composite parent) { - container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - - Label lbl1 = new Label(container, SWT.NULL); - lbl1.setText("Configuration template:"); - - configurationTemplatesCombo = new Combo(container, SWT.READ_ONLY); - configurationTemplatesCombo.setLayoutData(new GridData(SWT.FILL, - SWT.CENTER, true, - false, 1, 1)); - - Label lbl2 = new Label(container, SWT.NULL); - lbl2.setText("Configuration project filename:"); - - confProjectFilenameText = new Text(container, SWT.BORDER | SWT.SINGLE); - confProjectFilenameText.setText("config.chcfg"); - confProjectFilenameText - .setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - confProjectFilenameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - confProjectFilenameUpdated(); - } - }); - - /* Note, it must stay after the creation of the text fields. */ - configurationTemplatesCombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - Element processor = getSelectedTemplate(); - String basefilename = processor.getChildText("basefilename"); - confProjectFilenameText.setText(basefilename.concat(".chcfg")); - currentDefaultDataFile = processor.getChildText("default"); - } - }); - - initialize(); - setControl(container); - } - - public String getContainerName() { - - return resourceContainer.getFullPath().toString(); - } - - public String getProjectFileName() { - - return confProjectFilenameText.getText(); - } - - public String getDefaultDataFile() { - - return currentDefaultDataFile; - } - - public boolean canFinish() { - - return container.getEnabled(); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - private void initialize() { - - if (selection != null && selection.isEmpty() == false - && selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() > 1) - return; - Object obj = ssel.getFirstElement(); - if (obj instanceof IResource) { - if (obj instanceof IContainer) - resourceContainer = (IContainer) obj; - else - resourceContainer = ((IResource) obj).getParent(); - } - } - else { - MessageDialog.openError(getShell(), - "Error", "Container for the resource not selected."); - container.setEnabled(false); - updateStatus("Container for the resource not selected."); - } - - /* Retrieving the resource path of the processors.xml file. */ - String fpath; - try { - Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - IPath path = new Path("resources/gencfg/processors/processors.xml"); - fpath = FileLocator.toFileURL(FileLocator.find(bundle, path, null)) - .getFile(); - } catch (IOException e) { - e.printStackTrace(); - return; - } - - /* DOM tree creation. */ - SAXBuilder builder = new SAXBuilder(); - try { - processorsDocument = builder.build(fpath); - } catch (JDOMException e) { - e.printStackTrace(); - return; - } catch (IOException e) { - e.printStackTrace(); - return; - } - - /* Parsing the content of the processors.xml file in order to populate the - panel objects.*/ - Element root = processorsDocument.getRootElement(); - for (Element processor : root.getChildren("processor")) { - String name = processor.getChildText("name"); - configurationTemplatesCombo.add(name); - } - configurationTemplatesCombo.select(0); - } - - /** - * Checks the content of the confProjectFilenameText field. - */ - private void confProjectFilenameUpdated() { - String fileName = getProjectFileName(); - - if (fileName.length() == 0) { - updateStatus("File name must be specified"); - return; - } - if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { - updateStatus("File name must be valid"); - return; - } - int dotLoc = fileName.lastIndexOf('.'); - if (dotLoc != -1) { - String ext = fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("chcfg") == false) { - updateStatus("Configuration project filename extension must be \"chcfg\""); - return; - } - } - updateStatus(null); - } - - /** - * Returns the XML Element associated to the current selection in the combo - * box. - * - * @return An Element Object. - */ - private Element getSelectedTemplate() { - - for (Element processor : processorsDocument.getRootElement() - .getChildren("processor")) { - String name = processor.getChildText("name"); - String item = configurationTemplatesCombo - .getItem(configurationTemplatesCombo.getSelectionIndex()); - if (name.compareTo(item) == 0) { - return processor; - } - } - return null; - } - - /** - * Updates the status text in the Wizard page. - * - * @param message - * the message to be shown - */ - private void updateStatus(String message) { - - setErrorMessage(message); - setPageComplete(message == null); - } -} 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 deleted file mode 100644 index b94df01cc..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.wizards; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; -import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; -import org.eclipse.cdt.managedbuilder.core.IBuilder; -import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.cdt.managedbuilder.internal.core.Configuration; -import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -@SuppressWarnings("restriction") -public class NewApplicationProjectWizard extends Wizard implements INewWizard { - - private NewApplicationProjectWizardPage page; - private ISelection selection; - - private String projectName; - private String finalProjectPath; - private String platform; - - /** - * Constructor for ConfigurationNewWizard. - */ - public NewApplicationProjectWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - public void addPages() { - page = new NewApplicationProjectWizardPage(selection); - addPage(page); - } - - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } - - @Override - public boolean performFinish() { - - projectName = page.getProjectName(); - finalProjectPath = page.getFinalProjectPath(); - platform = page.getPlatform(); - - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException { - try { - doFinish(monitor); - } - catch (CoreException e) { - throw new InvocationTargetException(e); - } - finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } - catch (InterruptedException e) { - return false; - } - catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the file if missing - * or just replace its contents, and open the editor on the newly created - * file. - */ - private void doFinish(IProgressMonitor monitor) throws CoreException { - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = workspace.getRoot(); - - monitor.beginTask("Creating " + projectName, 3); - - /* Step #1, creates the project file.*/ - IProject project = root.getProject(projectName); - if (project.exists()) { - monitor.done(); - MessageDialog.openError(getShell(), "Error", "Project " + projectName + - " already exists in workspace"); - return; - } - - IProjectDescription desc = project.getWorkspace().newProjectDescription(projectName); - if (finalProjectPath != null) - desc.setLocation(new Path(finalProjectPath)); - project.create(desc, null); - - /* Step #2, makes it a CDT project.*/ - desc = workspace.newProjectDescription(projectName); - project = CCorePlugin.getDefault().createCDTProject(desc, project, null); - - ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); - ICProjectDescription cdesc = mngr.createProjectDescription(project, false); - ManagedProject mproject = new ManagedProject(cdesc); - Configuration cfg = new Configuration(mproject, null, "Default", "Default"); - IBuilder bld = cfg.getEditableBuilder(); - bld.setManagedBuildOn(false); - CConfigurationData data = cfg.getConfigurationData(); - cdesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); - - mngr.setProjectDescription(project, cdesc); - monitor.worked(1); - } -} 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 deleted file mode 100644 index b2daabeac..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.config.wizards; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -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.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.widgets.Combo; - -import org.jdom2.Document; -import org.jdom2.Element; -import org.jdom2.JDOMException; -import org.jdom2.input.SAXBuilder; -import org.osgi.framework.Bundle; - -import config_wizard.Activator; - -public class NewApplicationProjectWizardPage extends WizardPage { - - private Composite container; - private Text projectParentPathText; - private Button btnBrowse; - private Label lbl1; - private Text projectNameText; - private Button useCustomPathButton; - private Label lbl3; - private Text projectFinalPathText; - private Label lbl4; - private Combo platformCombo; - - /** - * Constructor for SampleNewWizardPage. - */ - public NewApplicationProjectWizardPage(ISelection selection) { - - super("wizardPage"); - setTitle("ChibiOS/RT New Application Project Wizard"); - setDescription("This wizard creates a new ChibiOS/RT application project."); - } - - /** - * @see IDialogPage#createControl(Composite) - */ - @Override - public void createControl(Composite parent) { - container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - - /* Layout row 1.*/ - lbl1 = new Label(container, SWT.NONE); - lbl1.setText("Project name:"); - projectNameText = new Text(container, SWT.BORDER); - projectNameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - projectPageUpdated(); - } - }); - projectNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - new Label(container, SWT.NONE); - - /* Layout row 2.*/ - useCustomPathButton = new Button(container, SWT.CHECK); - useCustomPathButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (useCustomPathButton.getSelection()) { - projectParentPathText.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()); - projectParentPathText.setEnabled(false); - btnBrowse.setEnabled(false); - updateFinalProjectPathText(); - } - else { - projectParentPathText.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()); - projectParentPathText.setEnabled(true); - btnBrowse.setEnabled(true); - updateFinalProjectPathText(); - } - } - }); - useCustomPathButton.setText("Use default location"); - new Label(container, SWT.NONE); - new Label(container, SWT.NONE); - - /* Layout row 3.*/ - Label lbl2 = new Label(container, SWT.NULL); - lbl2.setText("Project parent path:"); - projectParentPathText = new Text(container, SWT.BORDER | SWT.SINGLE); - projectParentPathText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - projectPageUpdated(); - } - }); - projectParentPathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - btnBrowse = new Button(container, SWT.NONE); - btnBrowse.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - /* Prompts the user for a parent directory for the new project.*/ - DirectoryDialog dlg = new DirectoryDialog(getShell()); - dlg.setFilterPath(projectParentPathText.getText()); - dlg.setText("New ChibiOS/RT Project"); - dlg.setMessage("Select the parent directory for the new ChibiOS/RT application project."); - String parent = dlg.open(); - if (parent != null) { - projectParentPathText.setText(parent); - projectPageUpdated(); - } - } - }); - btnBrowse.setText("Browse..."); - - /* Layout row 4.*/ - lbl3 = new Label(container, SWT.NONE); - lbl3.setText("Final project path:"); - projectFinalPathText = new Text(container, SWT.BORDER); - projectFinalPathText.setEditable(false); - projectFinalPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - new Label(container, SWT.NONE); - - /* Layout row 5.*/ - lbl4 = new Label(container, SWT.NONE); - lbl4.setText("Target platform:"); - platformCombo = new Combo(container, SWT.READ_ONLY); - platformCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - new Label(container, SWT.NONE); - - initialize(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - private void initialize() { - - /* Initial state of the check box and project path text.*/ - useCustomPathButton.setSelection(true); - projectParentPathText.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()); - projectParentPathText.setEnabled(false); - btnBrowse.setEnabled(false); - - /* Retrieving the resource path of the processors.xml file. */ - String fpath; - try { - Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - IPath path = new Path("resources/gencfg/processors/processors.xml"); - fpath = FileLocator.toFileURL(FileLocator.find(bundle, path, null)).getFile(); - } catch (IOException e) { - e.printStackTrace(); - return; - } - - /* DOM tree creation. */ - SAXBuilder builder = new SAXBuilder(); - Document document; - try { - document = builder.build(fpath); - } catch (JDOMException e) { - e.printStackTrace(); - return; - } catch (IOException e) { - e.printStackTrace(); - return; - } - - /* Parsing the content of the processors.xml file in order to populate the - panel objects.*/ - Element root = document.getRootElement(); - for (Element processor : root.getChildren("processor")) { - String class_attr = processor.getAttributeValue("class", ""); - if (class_attr.compareToIgnoreCase("build") == 0) { - String name = processor.getAttributeValue("target", "internal error"); - platformCombo.add(name); - } - } - platformCombo.select(0); - - /* Update checks on the fields.*/ - projectPageUpdated(); - - /* Focus on the first editable field.*/ - projectNameText.setFocus(); - } - - public String getProjectName() { - - return projectNameText.getText(); - } - - public String getProjectParentPath() { - - return projectParentPathText.getText(); - } - - public String getFinalProjectPath() { - - if (useCustomPathButton.getSelection()) - return null; - return projectFinalPathText.getText(); - } - - public String getPlatform() { - - return platformCombo.getText(); - } - - private void projectPageUpdated() { - - updateFinalProjectPathText(); - - /* Checks the project location.*/ - File path = new File(projectParentPathText.getText()); - if (!path.exists()) { - updateStatus("Project path is not valid."); - return; - } - if (!path.isDirectory()) { - updateStatus("Project path is a directory."); - return; - } - - /* Checks the project name.*/ - String name = projectNameText.getText(); - if (!isValidFilename(name)) { - updateStatus("Invalid project name."); - return; - } - - /* Checks if the project already exists in the workspace.*/ - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (project.exists()) { - updateStatus("Project exists."); - return; - } - - updateStatus(null); - } - - /** - * Updates the status text in the Wizard page. - * - * @param message - * the message to be shown - */ - private void updateStatus(String message) { - - setErrorMessage(message); - setPageComplete(message == null); - } - - private void updateFinalProjectPathText() { - - IPath parent = new Path(projectParentPathText.getText()); - IPath project = parent.addTrailingSeparator().append(projectNameText.getText()); - projectFinalPathText.setText(project.toString()); - } - - private boolean isValidFilename(String name) { - - if (name.length() == 0) - return false; - if ((name.indexOf("`") >= 0) || (name.indexOf("?") >= 0) || - (name.indexOf("*") >= 0) || (name.indexOf("<") >= 0) || - (name.indexOf(">") >= 0) || (name.indexOf("|") >= 0) || - (name.indexOf("\"") >= 0) || (name.indexOf(":") >= 0) || - (name.indexOf("#") >= 0) || (name.indexOf("\\") >= 0) || - (name.indexOf("/") >= 0) || (name.indexOf("|") >= 0)) - return false; - return true; - } -} diff --git a/tools/eclipse/debug_support/.classpath b/tools/eclipse/debug_support/.classpath deleted file mode 100644 index 8a8f1668c..000000000 --- a/tools/eclipse/debug_support/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tools/eclipse/debug_support/.project b/tools/eclipse/debug_support/.project deleted file mode 100644 index eb8a22dc0..000000000 --- a/tools/eclipse/debug_support/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - Tool Debug Support - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs b/tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c63fde790..000000000 --- a/tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Fri Jul 01 10:57:07 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tools/eclipse/debug_support/META-INF/MANIFEST.MF b/tools/eclipse/debug_support/META-INF/MANIFEST.MF deleted file mode 100644 index 2908664cf..000000000 --- a/tools/eclipse/debug_support/META-INF/MANIFEST.MF +++ /dev/null @@ -1,14 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: ChibiOS-RT_Debug_Support -Bundle-SymbolicName: org.chibios.tools.eclipse.debug; singleton:=true -Bundle-Version: 1.1.0 -Bundle-Activator: org.chibios.tools.eclipse.debug.activator.Activator -Bundle-Vendor: chibios.org -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.cdt.debug.mi.core, - org.eclipse.debug.ui, - org.eclipse.cdt.debug.core -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ClassPath: . diff --git a/tools/eclipse/debug_support/build.properties b/tools/eclipse/debug_support/build.properties deleted file mode 100644 index 255e23b61..000000000 --- a/tools/eclipse/debug_support/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - contexts.xml diff --git a/tools/eclipse/debug_support/contexts.xml b/tools/eclipse/debug_support/contexts.xml deleted file mode 100644 index 02e26e45c..000000000 --- a/tools/eclipse/debug_support/contexts.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - This is the context help for the sample view with a table viewer. It was generated by a PDE template. - - - - - - - - - diff --git a/tools/eclipse/debug_support/icons/sample.gif b/tools/eclipse/debug_support/icons/sample.gif deleted file mode 100644 index 34fb3c9d8..000000000 Binary files a/tools/eclipse/debug_support/icons/sample.gif and /dev/null differ diff --git a/tools/eclipse/debug_support/plugin.xml b/tools/eclipse/debug_support/plugin.xml deleted file mode 100644 index b6102196c..000000000 --- a/tools/eclipse/debug_support/plugin.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java deleted file mode 100644 index b2cfc6098..000000000 --- a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.debug.activator; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.chibios.tools.eclipse.debug"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} diff --git a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java deleted file mode 100644 index 6104b840b..000000000 --- a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java +++ /dev/null @@ -1,582 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.debug.utils; - -import java.util.HashMap; -import java.util.LinkedHashMap; - -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIFormat; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression; -import org.eclipse.cdt.debug.mi.core.command.MIDataReadMemory; -import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo; -import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IDebugTarget; - -@SuppressWarnings("restriction") -public class DebugProxy { - - private CommandFactory cmd_factory; - private MISession mi_session; - - protected final static String[] threadStates = { - "READY", - "CURRENT", - "SUSPENDED", - "WTSEM", - "WTMTX", - "WTCOND", - "SLEEPING", - "WTEXIT", - "WTOREVT", - "WTANDEVT", - "SNDMSGQ", - "SNDMSG", - "WTMSG", - "WTQUEUE", - "FINAL" - }; - - private void getSession(CDebugTarget target) - throws DebugProxyException { - ICDITarget[] targets = target.getCDISession().getTargets(); - ICDITarget cdi_target = null; - for (int i = 0; i < targets.length; i++) { - if (targets[i] instanceof Target) { - cdi_target = targets[i]; - break; - } - } - if (cdi_target == null) - throw new DebugProxyException("no CDI session found"); - mi_session = ((Target)cdi_target).getMISession(); - cmd_factory = mi_session.getCommandFactory(); - } - - public DebugProxy() - throws DebugProxyException { - IDebugTarget[] targets = DebugPlugin.getDefault().getLaunchManager().getDebugTargets(); - for (IDebugTarget target:targets) { - if(target instanceof CDebugTarget) { - getSession((CDebugTarget)target); - return; - } - } - } - - public DebugProxy(CDebugTarget target) - throws DebugProxyException { - getSession(target); - } - - public String evaluateExpression(String expression) - throws DebugProxyException { - if (mi_session.getMIInferior().isRunning()) - return null; - MIDataEvaluateExpression expr = cmd_factory.createMIDataEvaluateExpression(expression); - try { - mi_session.postCommand(expr); - MIDataEvaluateExpressionInfo info = expr.getMIDataEvaluateExpressionInfo(); - if (info != null) - return info.getExpression(); - } catch (MIException e) {} - throw new DebugProxyException("error evaluating the expression: '" + - expression + "'"); - } - - public long scanStack(long base, long end, long pattern) - throws DebugProxyException { - if (mi_session.getMIInferior().isRunning()) - return -1; - if (end > base) { - MIDataReadMemory mem = cmd_factory.createMIDataReadMemory(0, - Long.toString(base), - MIFormat.HEXADECIMAL, - 4, - 1, - (int)(end - base), - '.'); - try { - mi_session.postCommand(mem); - MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo(); - if (info != null) { - long[] data = info.getMemories()[0].getData(); - int i = 0; - while ((i < data.length) && (data[i] == pattern)) - i++; - return i * 4; - } - } catch (MIException e) {} - throw new DebugProxyException("error reading memory at " + - base); - } - return 0; - } - - public String readCString(long address, int max) - throws DebugProxyException { - if (mi_session.getMIInferior().isRunning()) - return null; - MIDataReadMemory mem = cmd_factory.createMIDataReadMemory(0, - Long.toString(address), - MIFormat.HEXADECIMAL, - 1, - 1, - max, - '.'); - try { - mi_session.postCommand(mem); - MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo(); - if (info != null) { - String s = info.getMemories()[0].getAscii(); - int i = s.indexOf('.'); - if (i >= 0) - return s.substring(0, s.indexOf('.')); - else - return s; - } - } catch (MIException e) {} - throw new DebugProxyException("error reading memory at " + - address); - } - - /** - * @brief Return the list of threads. - * @details The threads list is fetched from memory by scanning the - * registry. - * - * @return A @p LinkedHashMap object whose keys are the threads addresses - * as decimal strings, the value is an @p HashMap of the thread - * fields: - * - stack - * - stklimit - * - name - * - state - * - state_s - * - flags - * - prio - * - refs - * - time - * - wtobjp - * . - * Missing fields are set to "-". - * @retval null If the debugger encountered an error or - * the target is running. - * - * @throws DebugProxyException If the debugger is active but the registry - * is not found, not initialized or corrupted. - */ - public LinkedHashMap> readThreads() - throws DebugProxyException { - // rlist structure address. - String rlist; - try { - rlist = evaluateExpression("(uint32_t)&rlist"); - if (rlist == null) - return null; - } catch (DebugProxyException e) { - throw new DebugProxyException("ChibiOS/RT not found on target"); - } catch (Exception e) { - return null; - } - - // Scanning registry. - LinkedHashMap> lhm = - new LinkedHashMap>(10); - String current = rlist; - String previous = rlist; - while (true) { - - // Fetching next thread in the registry (newer link). This fetch fails - // if the register is not enabled in the kernel and the p_newer field - // does not exist. - try { - current = evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_newer"); - } catch (DebugProxyException e1) { - throw new DebugProxyException("ChibiOS/RT registry not enabled in kernel"); - } - - // This can happen if the kernel is not initialized yet or if the - // registry is corrupted. - if (current.compareTo("0") == 0) - throw new DebugProxyException("ChibiOS/RT registry integrity check failed, NULL pointer"); - - // TODO: integrity check on the pointer value (alignment, range). - - // The previous thread in the list is fetched as a integrity check. - String older = evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_older"); - if (older.compareTo("0") == 0) - throw new DebugProxyException("ChibiOS/RT registry integrity check failed, NULL pointer"); - if (previous.compareTo(older) != 0) - throw new DebugProxyException("ChibiOS/RT registry integrity check failed, double linked list violation"); - - // End of the linked list condition. - if (current.compareTo(rlist) == 0) - break; - - // Hash of threads fields. - HashMap map = new HashMap(16); - - // Fetch of the various fields in the Thread structure. Some fields - // are optional so are placed within try-catch. - long stklimit; - try { - stklimit = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_stklimit")); - map.put("stklimit", Long.toString(stklimit)); - } catch (DebugProxyException e) { - map.put("stklimit", "-"); - stklimit = -1; - } - - long stack; - try { - stack = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_ctx.r13")); - map.put("stack", Long.toString(stack)); - } catch (DebugProxyException e) { - try { - stack = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_ctx.sp")); - map.put("stack", Long.toString(stack)); - } catch (DebugProxyException ex) { - map.put("stack", "-"); - stack = -1; - } - } - - if ((stklimit < 0) || (stack < 0)) - map.put("stkunused", "-"); - else { - if ((stack < 0) || (stack < stklimit)) - map.put("stkunused", "overflow"); - else { - long stkunused = scanStack(stklimit, stack, 0x55555555); - map.put("stkunused", Long.toString(stkunused)); - } - } - - long n; - try { - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_name")); - if (n == 0) - map.put("name", ""); - else - map.put("name", readCString(n, 16)); - } catch (DebugProxyException e) { - map.put("name", "-"); - } - - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_state")); - map.put("state", Long.toString(n)); - if ((n >= 0) && (n < threadStates.length)) { - map.put("state_s", threadStates[(int)n]); - } - else - map.put("state_s", "unknown"); - - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_flags")); - map.put("flags", Long.toString(n)); - - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_prio")); - map.put("prio", Long.toString(n)); - - try { - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_refs")); - map.put("refs", Long.toString(n)); - } catch (DebugProxyException e) { - map.put("refs", "-"); - } - - try { - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_time")); - map.put("time", Long.toString(n)); - } catch (DebugProxyException e) { - map.put("time", "-"); - } - - try { - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + current + ")->p_u.wtobjp")); - map.put("wtobjp", Long.toString(n)); - } catch (DebugProxyException e) { - map.put("wtobjp", "-"); - } - - // Inserting the new thread map into the threads list. - lhm.put(current, map); - - previous = current; - } - return lhm; - } - - /** - * @brief Return the list of timers. - * @details The timers list is fetched from memory by scanning the - * @p vtlist structure. - * - * @return A @p LinkedHashMap object whose keys are the timers addresses - * as decimal strings, the value is an @p HashMap of the timers - * fields: - * - delta - * - func - * - par - * . - * @retval null If the debugger encountered an error or - * the target is running. - * - * @throws DebugProxyException If the debugger is active but the structure - * @p vtlist is not found, not initialized or - * corrupted. - */ - public LinkedHashMap> readTimers() - throws DebugProxyException { - // Delta list structure address. - String vtlist; - try { - vtlist = evaluateExpression("(uint32_t)&vtlist"); - if (vtlist == null) - return null; - } catch (DebugProxyException e) { - throw new DebugProxyException("ChibiOS/RT not found on target"); - } catch (Exception e) { - return null; - } - - // Scanning delta list. - LinkedHashMap> lhm = - new LinkedHashMap>(10); - String current = vtlist; - String previous = vtlist; - while (true) { - - // Fetching next timer in the delta list (vt_next link). - current = evaluateExpression("(uint32_t)((VirtualTimer *)" + current + ")->vt_next"); - - // This can happen if the kernel is not initialized yet or if the - // delta list is corrupted. - if (current.compareTo("0") == 0) - throw new DebugProxyException("ChibiOS/RT delta list integrity check failed, NULL pointer"); - - // TODO: integrity check on the pointer value (alignment, range). - - // The previous timer in the delta list is fetched as a integrity check. - String prev = evaluateExpression("(uint32_t)((VirtualTimer *)" + current + ")->vt_prev"); - if (prev.compareTo("0") == 0) - throw new DebugProxyException("ChibiOS/RT delta list integrity check failed, NULL pointer"); - if (previous.compareTo(prev) != 0) - throw new DebugProxyException("ChibiOS/RT delta list integrity check failed, double linked list violation"); - - // End of the linked list condition. - if (current.compareTo(vtlist) == 0) - break; - - // Hash of timers fields. - HashMap map = new HashMap(16); - - // Fetch of the various fields in the Thread structure. Some fields - // are optional so are placed within try-catch. - long n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((VirtualTimer *)" + current + ")->vt_time")); - map.put("delta", Long.toString(n)); - - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((VirtualTimer *)" + current + ")->vt_func")); - map.put("func", Long.toString(n)); - - n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((VirtualTimer *)" + current + ")->vt_par")); - map.put("par", Long.toString(n)); - - // Inserting the new thread map into the threads list. - lhm.put(current, map); - - previous = current; - } - return lhm; - } - - /** - * @brief Return the list of trace buffer entries. - * @details The trace buffer is fetched from memory by scanning the - * @p dbg_trace_buffer array. - * - * @return A @p LinkedHashMap object whose keys are the timers addresses - * as decimal strings, the value is an @p HashMap of the timers - * fields: - * - time - * - tp - * - wtobjp - * - state - * - state_s - * . - * @retval null If the debugger encountered an error or - * the target is running. - * - * @throws DebugProxyException If the debugger is active but the structure - * @p dbg_trace_buffer is not found, not - * initialized or corrupted. - */ - public LinkedHashMap> readTraceBuffer() - throws DebugProxyException { - - // Trace buffer size. - String s; - try { - s = evaluateExpression("(uint32_t)dbg_trace_buffer.tb_size"); - if (s == null) - return null; - } catch (DebugProxyException e) { - throw new DebugProxyException("trace buffer not found on target"); - } catch (Exception e) { - return null; - } - - int tbsize = (int)HexUtils.parseNumber(s); - int tbrecsize = (int)HexUtils.parseNumber(evaluateExpression("(uint32_t)sizeof (ch_swc_event_t)")); - long tbstart = HexUtils.parseNumber(evaluateExpression("(uint32_t)dbg_trace_buffer.tb_buffer")); - long tbend = HexUtils.parseNumber(evaluateExpression("(uint32_t)&dbg_trace_buffer.tb_buffer[" + tbsize + "]")); - long tbptr = HexUtils.parseNumber(evaluateExpression("(uint32_t)dbg_trace_buffer.tb_ptr")); - - // Scanning the trace buffer from the oldest event to the newest. - LinkedHashMap> lhm = - new LinkedHashMap>(64); - int n = tbsize; - int i = -tbsize + 1; - while (n > 0) { - // Hash of timers fields. - HashMap map = new HashMap(16); - - String time = evaluateExpression("(uint32_t)(((ch_swc_event_t *)" + tbptr + ")->se_time)"); - map.put("time", time); - - String tp = evaluateExpression("(uint32_t)(((ch_swc_event_t *)" + tbptr + ")->se_tp)"); - map.put("tp", tp); - - String wtobjp = evaluateExpression("(uint32_t)(((ch_swc_event_t *)" + tbptr + ")->se_wtobjp)"); - map.put("wtobjp", wtobjp); - - long state = HexUtils.parseNumber(evaluateExpression("(uint32_t)(((ch_swc_event_t *)" + tbptr + ")->se_state)")); - map.put("state", Long.toString(state)); - if ((state >= 0) && (state < threadStates.length)) - map.put("state_s", threadStates[(int)state]); - else - map.put("state_s", "unknown"); - - // Inserting the new event map into the events list. - if (tp.compareTo("0") != 0) - lhm.put(Integer.toString(i), map); - - tbptr += tbrecsize; - if (tbptr >= tbend) - tbptr = tbstart; - n--; - i++; - } - return lhm; - } - - /** - * @brief Return the list of the system global variables. - * - * @return A @p LinkedHashMap object whose keys are the variable names and - * the values are the variable values. - * - * @retval null If the debugger encountered an error or - * the target is running. - * - * @throws DebugProxyException If the debugger is active but the structure - * @p dbg_trace_buffer is not found, not - * initialized or corrupted. - */ - public LinkedHashMap readGlobalVariables() - throws DebugProxyException { - - LinkedHashMap map = new LinkedHashMap(16); - - try { - String vt_systime = evaluateExpression("(uint32_t)vtlist.vt_systime"); - if (vt_systime == null) - return null; - map.put("vt_systime", vt_systime); - } catch (DebugProxyException e) { - throw new DebugProxyException("ChibiOS/RT not found on target"); - } catch (Exception e) { - return null; - } - - try { - long r_current = HexUtils.parseNumber(evaluateExpression("(uint32_t)rlist.r_current")); - if (r_current != 0) { - String name; - try { - long n = HexUtils.parseNumber(evaluateExpression("(uint32_t)((Thread *)" + r_current + ")->p_name")); - if (n == 0) - name = ""; - else - name = readCString(n, 16); - } catch (DebugProxyException e) { - name = "-"; - } - map.put("r_current", HexUtils.dword2HexString((int)r_current) + " \"" + name + "\""); - } - else - map.put("r_current", "0"); - } catch (DebugProxyException e) {} - - try { - String r_preempt = evaluateExpression("(uint32_t)rlist.r_preempt"); - map.put("r_preempt", r_preempt); - } catch (DebugProxyException e) {} - - try { - Long addr = HexUtils.parseNumber(evaluateExpression("(uint32_t)dbg_panic_msg")); - if (addr == 0) - map.put("dbg_panic_msg", ""); - else - map.put("dbg_panic_msg", readCString(addr, 32)); - } catch (DebugProxyException e) { - map.put("dbg_panic_msg", ""); - } - - try { - Long isr_cnt = HexUtils.parseNumber(evaluateExpression("(uint32_t)dbg_isr_cnt")); - if (isr_cnt == 0) - map.put("dbg_isr_cnt", "not within ISR"); - else - map.put("dbg_isr_cnt", "within ISR"); - } catch (DebugProxyException e) { - map.put("dbg_isr_cnt", ""); - } - - try { - Long lock_cnt = HexUtils.parseNumber(evaluateExpression("(uint32_t)dbg_lock_cnt")); - if (lock_cnt == 0) - map.put("dbg_lock_cnt", "not within lock"); - else - map.put("dbg_lock_cnt", "within lock"); - } catch (DebugProxyException e) { - map.put("dbg_lock_cnt", ""); - } - - return map; - } -} diff --git a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java deleted file mode 100644 index 62b791732..000000000 --- a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.debug.utils; - -public class DebugProxyException extends Exception { - - private static final long serialVersionUID = 6860700758297226746L; - - public DebugProxyException() { - super("Debug Proxy Exception"); - } - - public DebugProxyException(String s) { - super(s); - } -} diff --git a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java deleted file mode 100644 index 983561cb0..000000000 --- a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.debug.utils; - -public class HexUtils { - - protected final static String[] hexChars = { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" - }; - - static public boolean isHexChar(char c) { - - if (Character.isDigit(c) || (c >= 'a') && (c <= 'f') || - (c >= 'A') && (c <= 'F')) - return true; - return false; - } - - static public boolean isHexString(String hstring) { - int l = hstring.length(); - - if ((l & 1) == 1) - return false; - - for (int i = 0; i < l; i++) - if (!isHexChar(hstring.charAt(i))) - return false; - return true; - } - - static public byte[] hexStringToByteArray(String hstring) { - - if (!isHexString(hstring)) - throw new NumberFormatException("not a hex string"); - - byte[] result = new byte[hstring.length() / 2]; - - for (int i = 0; i < hstring.length(); i += 2) { - String toParse = hstring.substring(i, i + 2); - - result[i / 2] = (byte)Integer.parseInt(toParse, 16); - } - return result; - } - - static public byte hexStringToByte(String hstring) { - - if (hstring.length() != 2) - throw new NumberFormatException("not a byte hex string"); - - return (byte)Integer.parseInt(hstring, 16); - } - - static public String byteArrayToHexString(byte[] data) { - StringBuffer out = new StringBuffer(data.length * 2); - - for (int i = 0; i < data.length; i++) { - out.append(hexChars[(data[i] >> 4) & 15]); - out.append(hexChars[data[i] & 15]); - } - return out.toString(); - } - - static public String byte2HexString(int b) { - - return hexChars[(b >> 4) & 15] + hexChars[b & 15]; - } - - static public String word2HexString(int w) { - - return hexChars[(w >> 12) & 15] - + hexChars[(w >> 8) & 15] - + hexChars[(w >> 4) & 15] - + hexChars[w & 15]; - } - - static public String dword2HexString(int w) { - - return hexChars[(w >> 28) & 15] - + hexChars[(w >> 24) & 15] - + hexChars[(w >> 20) & 15] - + hexChars[(w >> 16) & 15] - + hexChars[(w >> 12) & 15] - + hexChars[(w >> 8) & 15] - + hexChars[(w >> 4) & 15] - + hexChars[w & 15]; - } - - static public long parseNumber(String s) { - - if (s.toLowerCase().startsWith("0x")) - return Long.parseLong(s.substring(2), 16); - return Long.parseLong(s); - } -} - diff --git a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java deleted file mode 100644 index 597a837c2..000000000 --- a/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java +++ /dev/null @@ -1,585 +0,0 @@ -/* - 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 . - */ - -package org.chibios.tools.eclipse.debug.views; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map.Entry; -import java.util.Set; - -import org.chibios.tools.eclipse.debug.utils.DebugProxy; -import org.chibios.tools.eclipse.debug.utils.DebugProxyException; -import org.chibios.tools.eclipse.debug.utils.HexUtils; - -import org.eclipse.ui.internal.IWorkbenchThemeConstants; -import org.eclipse.ui.part.*; -import org.eclipse.ui.themes.ITheme; -import org.eclipse.jface.action.*; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; - -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.wb.swt.SWTResourceManager; -import org.eclipse.wb.swt.ResourceManager; -import org.eclipse.swt.events.FocusAdapter; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; - -/** - * This sample class demonstrates how to plug-in a new workbench view. The view - * shows data obtained from the model. The sample creates a dummy model on the - * fly, but a real implementation would connect to the model available either in - * this or another plug-in (e.g. the workspace). The view is connected to the - * model using a content provider. - *

- * The view uses a label provider to define how model objects should be - * presented in the view. Each view can present the same model objects using - * different labels and icons, if needed. Alternatively, a single label provider - * can be shared between views in order to ensure that objects of the same type - * are presented in the same way everywhere. - *

- */ - -@SuppressWarnings("restriction") -public class ChibiView extends ViewPart implements IDebugEventSetListener { - - /** - * The ID of the view as specified by the extension. - */ - public static final String ID = "org.chibios.tools.eclipse.debug.views.ChibiView"; - - private CTabFolder tabFolder; - private CTabItem tbtmGlobal; - private CTabItem tbtmThreads; - private CTabItem tbtmTimers; - private CTabItem tbtmTraceBuffer; - - private Action refreshAction; - private Table threadsTable; - private Table timersTable; - - private DebugProxy debugger; - private Table tbTable; - private Table globalTable; - - private ITheme theme; - - private FocusAdapter focus = new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - setInactive(); - } - @Override - public void focusGained(FocusEvent e) { - setActive(); - } - }; - - /** - * The constructor. - */ - public ChibiView() { - - theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); - } - - private void setActive() { - tabFolder.setSelectionBackground( - new org.eclipse.swt.graphics.Color[] { - theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START), - theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END) - }, - new int[] {100}, - true); - tabFolder.setSelectionForeground(theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR)); - } - - private void setInactive() { - tabFolder.setSelectionBackground( - new org.eclipse.swt.graphics.Color[] { - theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START), - theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END) - }, - new int[] {theme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT)}, - true); - tabFolder.setSelectionForeground(theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR)); - } - - /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ - public void createPartControl(Composite parent) { - - tabFolder = new CTabFolder(parent, SWT.BORDER | SWT.BOTTOM); - tabFolder.setFont(theme.getFontRegistry().get(IWorkbenchThemeConstants.TAB_TEXT_FONT)); - tabFolder.setBackground(theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END)); - tabFolder.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setActive(); - tabFolder.getSelection().getControl().setFocus(); - } - }); - tabFolder.addFocusListener(new FocusAdapter() { - @Override - public void focusGained(FocusEvent e) { - tabFolder.getSelection().getControl().setFocus(); - } - }); - setInactive(); - tabFolder.setSimple(false); - - tbtmGlobal = new CTabItem(tabFolder, SWT.NONE); - tbtmGlobal.setText("Global"); - - globalTable = new Table(tabFolder, SWT.FULL_SELECTION); - globalTable.addFocusListener(focus); - globalTable.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL)); - tbtmGlobal.setControl(globalTable); - globalTable.setHeaderVisible(true); - - TableColumn tblclmnGlobalHidden = new TableColumn(globalTable, SWT.RIGHT); - tblclmnGlobalHidden.setWidth(0); - tblclmnGlobalHidden.setText(""); - - TableColumn tblclmnGlobalVariableName = new TableColumn(globalTable, SWT.LEFT); - tblclmnGlobalVariableName.setWidth(150); - tblclmnGlobalVariableName.setText("Variable"); - - TableColumn tblclmnGlobalVariableValue = new TableColumn(globalTable, SWT.LEFT); - tblclmnGlobalVariableValue.setWidth(300); - tblclmnGlobalVariableValue.setText("Value"); - - tbtmThreads = new CTabItem(tabFolder, SWT.NONE); - tbtmThreads.setText("Threads"); - - threadsTable = new Table(tabFolder, SWT.FULL_SELECTION); - threadsTable.addFocusListener(focus); - tbtmThreads.setControl(threadsTable); - threadsTable.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL)); - threadsTable.setHeaderVisible(true); - - TableColumn tblclmnThreadAddress = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadAddress.setWidth(72); - tblclmnThreadAddress.setText("Address"); - - TableColumn tblclmnThreadLimit = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadLimit.setWidth(72); - tblclmnThreadLimit.setText("StkLimit"); - - TableColumn tblclmnThreadStack = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadStack.setWidth(72); - tblclmnThreadStack.setText("Stack"); - - TableColumn tblclmnThreadUsed = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadUsed.setWidth(72); - tblclmnThreadUsed.setText("StkUnused"); - - TableColumn tblclmnThreadName = new TableColumn(threadsTable, SWT.LEFT); - tblclmnThreadName.setWidth(144); - tblclmnThreadName.setText("Name"); - - TableColumn tblclmnThreadState = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadState.setWidth(72); - tblclmnThreadState.setText("State"); - - TableColumn tblclmnThreadFlags = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadFlags.setWidth(40); - tblclmnThreadFlags.setText("Flgs"); - - TableColumn tblclmnThreadPriority = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadPriority.setWidth(40); - tblclmnThreadPriority.setText("Prio"); - - TableColumn tblclmnThreadRefs = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadRefs.setWidth(40); - tblclmnThreadRefs.setText("Refs"); - - TableColumn tblclmnThreadTime = new TableColumn(threadsTable, SWT.RIGHT); - tblclmnThreadTime.setWidth(64); - tblclmnThreadTime.setText("Time"); - - TableColumn tblclmnThreadShared = new TableColumn(threadsTable, SWT.LEFT); - tblclmnThreadShared.setWidth(72); - tblclmnThreadShared.setText("Obj/Msg"); - - tbtmTimers = new CTabItem(tabFolder, SWT.NONE); - tbtmTimers.setText("Timers"); - - timersTable = new Table(tabFolder, SWT.FULL_SELECTION); - timersTable.addFocusListener(focus); - tbtmTimers.setControl(timersTable); - timersTable.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL)); - timersTable.setHeaderVisible(true); - - TableColumn tblclmnTimerAddress = new TableColumn(timersTable, SWT.RIGHT); - tblclmnTimerAddress.setWidth(72); - tblclmnTimerAddress.setText("Address"); - - TableColumn tblclmnTimerTime = new TableColumn(timersTable, SWT.RIGHT); - tblclmnTimerTime.setWidth(72); - tblclmnTimerTime.setText("Time"); - - TableColumn tblclmnTimerDelta = new TableColumn(timersTable, SWT.RIGHT); - tblclmnTimerDelta.setWidth(72); - tblclmnTimerDelta.setText("Delta"); - - TableColumn tblclmnTimerCallback = new TableColumn(timersTable, SWT.RIGHT); - tblclmnTimerCallback.setWidth(72); - tblclmnTimerCallback.setText("Callback"); - - TableColumn tblclmnTimerParameter = new TableColumn(timersTable, SWT.LEFT); - tblclmnTimerParameter.setWidth(72); - tblclmnTimerParameter.setText("Param"); - - tbtmTraceBuffer = new CTabItem(tabFolder, SWT.NONE); - tbtmTraceBuffer.setText("TraceBuffer"); - - tbTable = new Table(tabFolder, SWT.FULL_SELECTION); - tbTable.addFocusListener(focus); - tbTable.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL)); - tbtmTraceBuffer.setControl(tbTable); - tbTable.setHeaderVisible(true); - - TableColumn tblclmnTraceBufferHidden = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferHidden.setWidth(0); - tblclmnTraceBufferHidden.setText(""); - - TableColumn tblclmnTraceBufferIndex = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferIndex.setWidth(48); - tblclmnTraceBufferIndex.setText("Event"); - - TableColumn tblclmnTraceBufferTime = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferTime.setWidth(64); - tblclmnTraceBufferTime.setText("Time"); - - TableColumn tblclmnTraceBufferPrevAddress = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferPrevAddress.setWidth(72); - tblclmnTraceBufferPrevAddress.setText("Previous"); - - TableColumn tblclmnTraceBufferPrevName = new TableColumn(tbTable, SWT.LEFT); - tblclmnTraceBufferPrevName.setWidth(144); - tblclmnTraceBufferPrevName.setText("Previous Name"); - - TableColumn tblclmnTraceBufferState = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferState.setWidth(72); - tblclmnTraceBufferState.setText("State"); - - TableColumn tblclmnTraceBufferShared = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferShared.setWidth(72); - tblclmnTraceBufferShared.setText("Obj/Msg"); - - TableColumn tblclmnTraceBufferCurrentAddress = new TableColumn(tbTable, SWT.RIGHT); - tblclmnTraceBufferCurrentAddress.setWidth(72); - tblclmnTraceBufferCurrentAddress.setText("Current"); - - TableColumn tblclmnTraceBufferCurrentName = new TableColumn(tbTable, SWT.LEFT); - tblclmnTraceBufferCurrentName.setWidth(144); - tblclmnTraceBufferCurrentName.setText("Current Name"); - - makeActions(); - hookContextMenu(); - contributeToActionBars(); - - tabFolder.setSelection(tbtmGlobal); - - DebugPlugin.getDefault().addDebugEventListener(this); - - try { - debugger = new DebugProxy(); - } catch (DebugProxyException e) {} - } - - /** - * @brief Handling events from the debugger. - */ - @Override - public void handleDebugEvents(DebugEvent[] events) { - for (DebugEvent event : events) { - switch (event.getKind()) { - case DebugEvent.CREATE: - Object source = event.getSource(); - if (source instanceof CDebugTarget) { - try { - debugger = new DebugProxy((CDebugTarget)source); - } catch (DebugProxyException e) {} - } - break; - } - } - } - - private void hookContextMenu() { - MenuManager menuMgr = new MenuManager("#PopupMenu"); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - ChibiView.this.fillContextMenu(manager); - } - }); - } - - private void contributeToActionBars() { - IActionBars bars = getViewSite().getActionBars(); - fillLocalPullDown(bars.getMenuManager()); - fillLocalToolBar(bars.getToolBarManager()); - } - - private void fillLocalPullDown(IMenuManager manager) { - manager.add(refreshAction); -/* manager.add(new Separator()); - manager.add(refreshAction);*/ - } - - private void fillContextMenu(IMenuManager manager) { - manager.add(refreshAction); - // Other plug-ins can contribute there actions here - manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - } - - private void fillLocalToolBar(IToolBarManager manager) { - manager.add(refreshAction); - } - - private void fillGlobalTable() { - LinkedHashMap lhm; - - // If the debugger is not yet present then do nothing. - if (debugger == null) - return; - - // Reading the list of global variables, null can be returned if the debugger - // does not respond. - try { - lhm = debugger.readGlobalVariables(); - if (lhm == null) - return; - } catch (DebugProxyException e) { - showMessage("Error: " + e.getMessage() + "."); - return; - } - - globalTable.removeAll(); - - Set> set = lhm.entrySet(); - for (Entry entry : set) { - TableItem tableItem = new TableItem(globalTable, SWT.NONE); - tableItem.setText(new String[] { - "", - entry.getKey(), - entry.getValue() - }); - } - } - - private String makeHex(String s) { - try { - s = HexUtils.dword2HexString((int)HexUtils.parseNumber(s)); - } catch (Exception e) {} - return s; - } - - private void fillThreadsTable() { - LinkedHashMap> lhm; - - // If the debugger is not yet present then do nothing. - if (debugger == null) - return; - - // Reading the list of threads, null can be returned if the debugger - // does not respond. - try { - lhm = debugger.readThreads(); - if (lhm == null) - return; - } catch (DebugProxyException e) { - showMessage("Error: " + e.getMessage() + "."); - return; - } - - threadsTable.removeAll(); - - Set>> set = lhm.entrySet(); - for (Entry> entry : set) { - HashMap map = entry.getValue(); - TableItem tableItem = new TableItem(threadsTable, SWT.NONE); - tableItem.setText(new String[] { - makeHex(entry.getKey()), - makeHex(map.get("stklimit")), - makeHex(map.get("stack")), - map.get("stkunused"), - map.get("name"), - map.get("state_s"), - HexUtils.byte2HexString((int)HexUtils.parseNumber(map.get("flags"))), - map.get("prio"), - map.get("refs"), - map.get("time"), - makeHex(map.get("wtobjp")) - }); - } - } - - private void fillTimersTable() { - LinkedHashMap> lhm; - - // If the debugger is not yet present then do nothing. - if (debugger == null) - return; - - // Reading the list of threads, null can be returned if the debugger - // does not respond. - try { - lhm = debugger.readTimers(); - if (lhm == null) - return; - } catch (DebugProxyException e) { - showMessage("Error: " + e.getMessage() + "."); - return; - } - - timersTable.removeAll(); - - Set>> set = lhm.entrySet(); - long time = 0; - for (Entry> entry : set) { - HashMap map = entry.getValue(); - time = time + HexUtils.parseNumber(map.get("delta")); - TableItem tableItem = new TableItem(timersTable, SWT.NONE); - tableItem.setText(new String[] { - makeHex(entry.getKey()), - Long.toString(time), - "+" + HexUtils.parseNumber(map.get("delta")), - makeHex(map.get("func")), - makeHex(map.get("par")) - }); - } - } - - private void fillTraceBufferTable() { - LinkedHashMap> lhm, lhmthreads; - - // If the debugger is not yet present then do nothing. - if (debugger == null) - return; - - // Read active threads for retrieving names. - try { - lhmthreads = debugger.readThreads(); - if (lhmthreads == null) - return; - } catch (DebugProxyException e) { - lhmthreads = new LinkedHashMap>(0); - } - - // Reading the list of threads, null can be returned if the debugger - // does not respond. - try { - lhm = debugger.readTraceBuffer(); - if (lhm == null) - return; - } catch (DebugProxyException e) { - showMessage("Error: " + e.getMessage() + "."); - return; - } - - tbTable.removeAll(); - - Set>> set = lhm.entrySet(); - String prev = ""; - String prevname = ""; - for (Entry> entry : set) { - HashMap map = entry.getValue(); - TableItem tableItem = new TableItem(tbTable, SWT.NONE); - - // Searches the current thread into the threads map. - String currentaddr = map.get("tp"); - HashMap thread = lhmthreads.get(currentaddr); - String currentname; - if (thread != null) - currentname = thread.get("name"); - else - currentname = ""; - - String current = makeHex(currentaddr); - tableItem.setText(new String[] { - "", - entry.getKey(), - map.get("time"), - prev, - prevname, - map.get("state_s"), - makeHex(map.get("wtobjp")), - current, - currentname - }); - prev = current; - prevname = currentname; - } - } - - private void makeActions() { - - // Refresh action. - refreshAction = new Action() { - public void run() { - CTabItem tabitem = tabFolder.getSelection(); - if (tabitem == null) - return; - if (tabitem == tbtmGlobal) - fillGlobalTable(); - else if (tabitem == tbtmThreads) - fillThreadsTable(); - else if (tabitem == tbtmTimers) - fillTimersTable(); - else if (tabitem == tbtmTraceBuffer) - fillTraceBufferTable(); - } - }; - refreshAction.setDisabledImageDescriptor(ResourceManager.getPluginImageDescriptor("org.eclipse.cdt.ui", "/icons/dlcl16/refresh_nav.gif")); - refreshAction.setImageDescriptor(ResourceManager.getPluginImageDescriptor("org.eclipse.cdt.ui", "/icons/elcl16/refresh_nav.gif")); - refreshAction.setText("Refresh"); - refreshAction.setToolTipText("Refresh timers list"); - } - - private void showMessage(String message) { - MessageDialog.openInformation(tabFolder.getShell(), - "ChibiOS/RT Views", message); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - tabFolder.setFocus(); - } -} diff --git a/tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java b/tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java deleted file mode 100644 index 4bfbc6b6e..000000000 --- a/tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java +++ /dev/null @@ -1,415 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Google, Inc. - * 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: - * Google, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.wb.swt; - -import java.io.File; -import java.io.InputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.CompositeImageDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.osgi.framework.Bundle; - -/** - * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, - * etc. - * - * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the - * operating system resources managed by cached objects when those objects and OS resources are no longer - * needed (e.g. on application shutdown) - * - * This class may be freely distributed as part of any application or plugin. - *

- * - * @author scheglov_ke - * @author Dan Rubel - */ -public class ResourceManager extends SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - private static Map m_descriptorImageMap = new HashMap(); - /** - * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified - * class. - * - * @param clazz - * the {@link Class} relative to which to find the image descriptor. - * @param path - * the path to the image file. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - */ - public static ImageDescriptor getImageDescriptor(Class clazz, String path) { - return ImageDescriptor.createFromFile(clazz, path); - } - /** - * Returns an {@link ImageDescriptor} stored in the file at the specified path. - * - * @param path - * the path to the image file. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - */ - public static ImageDescriptor getImageDescriptor(String path) { - try { - return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); - } catch (MalformedURLException e) { - return null; - } - } - /** - * Returns an {@link Image} based on the specified {@link ImageDescriptor}. - * - * @param descriptor - * the {@link ImageDescriptor} for the {@link Image}. - * @return the {@link Image} based on the specified {@link ImageDescriptor}. - */ - public static Image getImage(ImageDescriptor descriptor) { - if (descriptor == null) { - return null; - } - Image image = m_descriptorImageMap.get(descriptor); - if (image == null) { - image = descriptor.createImage(); - m_descriptorImageMap.put(descriptor, image); - } - return image; - } - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated. - * @param decorator - * the {@link Image} to decorate the base image. - * @return {@link Image} The resulting decorated image. - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated. - * @param decorator - * the {@link Image} to decorate the base image. - * @param corner - * the corner to place decorator image. - * @return the resulting decorated {@link Image}. - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - final Rectangle bib = baseImage.getBounds(); - final Rectangle dib = decorator.getBounds(); - final Point baseImageSize = new Point(bib.width, bib.height); - CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() { - @Override - protected void drawCompositeImage(int width, int height) { - drawImage(baseImage.getImageData(), 0, 0); - if (corner == TOP_LEFT) { - drawImage(decorator.getImageData(), 0, 0); - } else if (corner == TOP_RIGHT) { - drawImage(decorator.getImageData(), bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - drawImage(decorator.getImageData(), 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height); - } - } - @Override - protected Point getSize() { - return baseImageSize; - } - }; - // - result = compositImageDesc.createImage(); - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached images. - */ - public static void disposeImages() { - SWTResourceManager.disposeImages(); - // dispose ImageDescriptor images - { - for (Iterator I = m_descriptorImageMap.values().iterator(); I.hasNext();) { - I.next().dispose(); - } - m_descriptorImageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - // dispose plugin images - { - for (Iterator I = m_URLImageMap.values().iterator(); I.hasNext();) { - I.next().dispose(); - } - m_URLImageMap.clear(); - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Plugin images support - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps URL to images. - */ - private static Map m_URLImageMap = new HashMap(); - /** - * Provider for plugin resources, used by WindowBuilder at design time. - */ - public interface PluginResourceProvider { - URL getEntry(String symbolicName, String path); - } - /** - * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time. - */ - private static PluginResourceProvider m_designTimePluginResourceProvider = null; - /** - * Returns an {@link Image} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the image - * @param name - * the path to the image within the plugin - * @return the {@link Image} stored in the file at the specified path - * - * @deprecated Use {@link #getPluginImage(String, String)} instead. - */ - @Deprecated - public static Image getPluginImage(Object plugin, String name) { - try { - URL url = getPluginImageURL(plugin, name); - if (url != null) { - return getPluginImageFromUrl(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link Image} based on a {@link Bundle} and resource entry path. - * - * @param symbolicName - * the symbolic name of the {@link Bundle}. - * @param path - * the path of the resource entry. - * @return the {@link Image} stored in the file at the specified path. - */ - public static Image getPluginImage(String symbolicName, String path) { - try { - URL url = getPluginImageURL(symbolicName, path); - if (url != null) { - return getPluginImageFromUrl(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link Image} based on given {@link URL}. - */ - private static Image getPluginImageFromUrl(URL url) { - try { - try { - String key = url.toExternalForm(); - Image image = m_URLImageMap.get(key); - if (image == null) { - InputStream stream = url.openStream(); - try { - image = getImage(stream); - m_URLImageMap.put(key, image); - } finally { - stream.close(); - } - } - return image; - } catch (Throwable e) { - // Ignore any exceptions - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link ImageDescriptor} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the image. - * @param name - * the path to th eimage within the plugin. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - * - * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. - */ - @Deprecated - public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) { - try { - try { - URL url = getPluginImageURL(plugin, name); - return ImageDescriptor.createFromURL(url); - } catch (Throwable e) { - // Ignore any exceptions - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. - * - * @param symbolicName - * the symbolic name of the {@link Bundle}. - * @param path - * the path of the resource entry. - * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. - */ - public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) { - try { - URL url = getPluginImageURL(symbolicName, path); - if (url != null) { - return ImageDescriptor.createFromURL(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link URL} based on a {@link Bundle} and resource entry path. - */ - private static URL getPluginImageURL(String symbolicName, String path) { - // try runtime plugins - { - Bundle bundle = Platform.getBundle(symbolicName); - if (bundle != null) { - return bundle.getEntry(path); - } - } - // try design time provider - if (m_designTimePluginResourceProvider != null) { - return m_designTimePluginResourceProvider.getEntry(symbolicName, path); - } - // no such resource - return null; - } - /** - * Returns an {@link URL} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the file path. - * @param name - * the file path. - * @return the {@link URL} representing the file at the specified path. - * @throws Exception - */ - private static URL getPluginImageURL(Object plugin, String name) throws Exception { - // try to work with 'plugin' as with OSGI BundleContext - try { - Class BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ - Class BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ - if (BundleContextClass.isAssignableFrom(plugin.getClass())) { - Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ - Object bundle = getBundleMethod.invoke(plugin, new Object[0]); - // - Class PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ - Constructor pathConstructor = PathClass.getConstructor(new Class[]{String.class}); - Object path = pathConstructor.newInstance(new Object[]{name}); - // - Class IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ - Class PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ - Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$ - return (URL) findMethod.invoke(null, new Object[]{bundle, path}); - } - } catch (Throwable e) { - // Ignore any exceptions - } - // else work with 'plugin' as with usual Eclipse plugin - { - Class PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ - if (PluginClass.isAssignableFrom(plugin.getClass())) { - // - Class PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ - Constructor pathConstructor = PathClass.getConstructor(new Class[]{String.class}); - Object path = pathConstructor.newInstance(new Object[]{name}); - // - Class IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ - Method findMethod = PluginClass.getMethod("find", new Class[]{IPathClass}); //$NON-NLS-1$ - return (URL) findMethod.invoke(plugin, new Object[]{path}); - } - } - return null; - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeFonts(); - disposeImages(); - } -} \ No newline at end of file diff --git a/tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java b/tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java deleted file mode 100644 index 8b6d4cc3f..000000000 --- a/tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Google, Inc. - * 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: - * Google, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.wb.swt; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Display; - -/** - * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. - *

- * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the - * operating system resources managed by cached objects when those objects and OS resources are no longer - * needed (e.g. on application shutdown) - *

- * This class may be freely distributed as part of any application or plugin. - *

- * @author scheglov_ke - * @author Dan Rubel - */ -public class SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Color - // - //////////////////////////////////////////////////////////////////////////// - private static Map m_colorMap = new HashMap(); - /** - * Returns the system {@link Color} matching the specific ID. - * - * @param systemColorID - * the ID value for the color - * @return the system {@link Color} matching the specific ID - */ - public static Color getColor(int systemColorID) { - Display display = Display.getCurrent(); - return display.getSystemColor(systemColorID); - } - /** - * Returns a {@link Color} given its red, green and blue component values. - * - * @param r - * the red component of the color - * @param g - * the green component of the color - * @param b - * the blue component of the color - * @return the {@link Color} matching the given red, green and blue component values - */ - public static Color getColor(int r, int g, int b) { - return getColor(new RGB(r, g, b)); - } - /** - * Returns a {@link Color} given its RGB value. - * - * @param rgb - * the {@link RGB} value of the color - * @return the {@link Color} matching the RGB value - */ - public static Color getColor(RGB rgb) { - Color color = m_colorMap.get(rgb); - if (color == null) { - Display display = Display.getCurrent(); - color = new Color(display, rgb); - m_colorMap.put(rgb, color); - } - return color; - } - /** - * Dispose of all the cached {@link Color}'s. - */ - public static void disposeColors() { - for (Color color : m_colorMap.values()) { - color.dispose(); - } - m_colorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps image paths to images. - */ - private static Map m_imageMap = new HashMap(); - /** - * Returns an {@link Image} encoded by the specified {@link InputStream}. - * - * @param stream - * the {@link InputStream} encoding the image data - * @return the {@link Image} encoded by the specified input stream - */ - protected static Image getImage(InputStream stream) throws IOException { - try { - Display display = Display.getCurrent(); - ImageData data = new ImageData(stream); - if (data.transparentPixel > 0) { - return new Image(display, data, data.getTransparencyMask()); - } - return new Image(display, data); - } finally { - stream.close(); - } - } - /** - * Returns an {@link Image} stored in the file at the specified path. - * - * @param path - * the path to the image file - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(String path) { - Image image = m_imageMap.get(path); - if (image == null) { - try { - image = getImage(new FileInputStream(path)); - m_imageMap.put(path, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(path, image); - } - } - return image; - } - /** - * Returns an {@link Image} stored in the file at the specified path relative to the specified class. - * - * @param clazz - * the {@link Class} relative to which to find the image - * @param path - * the path to the image file, if starts with '/' - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(Class clazz, String path) { - String key = clazz.getName() + '|' + path; - Image image = m_imageMap.get(key); - if (image == null) { - try { - image = getImage(clazz.getResourceAsStream(path)); - m_imageMap.put(key, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(key, image); - } - } - return image; - } - private static final int MISSING_IMAGE_SIZE = 10; - /** - * @return the small {@link Image} that can be used as placeholder for missing image. - */ - private static Image getMissingImage() { - Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - // - GC gc = new GC(image); - gc.setBackground(getColor(SWT.COLOR_RED)); - gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - gc.dispose(); - // - return image; - } - /** - * Style constant for placing decorator image in top left corner of base image. - */ - public static final int TOP_LEFT = 1; - /** - * Style constant for placing decorator image in top right corner of base image. - */ - public static final int TOP_RIGHT = 2; - /** - * Style constant for placing decorator image in bottom left corner of base image. - */ - public static final int BOTTOM_LEFT = 3; - /** - * Style constant for placing decorator image in bottom right corner of base image. - */ - public static final int BOTTOM_RIGHT = 4; - /** - * Internal value. - */ - protected static final int LAST_CORNER_KEY = 5; - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @return {@link Image} The resulting decorated image - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @param corner - * the corner to place decorator image - * @return the resulting decorated {@link Image} - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - Rectangle bib = baseImage.getBounds(); - Rectangle dib = decorator.getBounds(); - // - result = new Image(Display.getCurrent(), bib.width, bib.height); - // - GC gc = new GC(result); - gc.drawImage(baseImage, 0, 0); - if (corner == TOP_LEFT) { - gc.drawImage(decorator, 0, 0); - } else if (corner == TOP_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - gc.drawImage(decorator, 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); - } - gc.dispose(); - // - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached {@link Image}'s. - */ - public static void disposeImages() { - // dispose loaded images - { - for (Image image : m_imageMap.values()) { - image.dispose(); - } - m_imageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Font - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps font names to fonts. - */ - private static Map m_fontMap = new HashMap(); - /** - * Maps fonts to their bold versions. - */ - private static Map m_fontToBoldFontMap = new HashMap(); - /** - * Returns a {@link Font} based on its name, height and style. - * - * @param name - * the name of the font - * @param height - * the height of the font - * @param style - * the style of the font - * @return {@link Font} The font matching the name, height and style - */ - public static Font getFont(String name, int height, int style) { - return getFont(name, height, style, false, false); - } - /** - * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline - * flags are also supported. - * - * @param name - * the name of the font - * @param size - * the size of the font - * @param style - * the style of the font - * @param strikeout - * the strikeout flag (warning: Windows only) - * @param underline - * the underline flag (warning: Windows only) - * @return {@link Font} The font matching the name, height, style, strikeout and underline - */ - public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { - String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; - Font font = m_fontMap.get(fontName); - if (font == null) { - FontData fontData = new FontData(name, size, style); - if (strikeout || underline) { - try { - Class logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ - Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ - if (logFont != null && logFontClass != null) { - if (strikeout) { - logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - if (underline) { - logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - } - } catch (Throwable e) { - System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - font = new Font(Display.getCurrent(), fontData); - m_fontMap.put(fontName, font); - } - return font; - } - /** - * Returns a bold version of the given {@link Font}. - * - * @param baseFont - * the {@link Font} for which a bold version is desired - * @return the bold version of the given {@link Font} - */ - public static Font getBoldFont(Font baseFont) { - Font font = m_fontToBoldFontMap.get(baseFont); - if (font == null) { - FontData fontDatas[] = baseFont.getFontData(); - FontData data = fontDatas[0]; - font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); - m_fontToBoldFontMap.put(baseFont, font); - } - return font; - } - /** - * Dispose all of the cached {@link Font}'s. - */ - public static void disposeFonts() { - // clear fonts - for (Font font : m_fontMap.values()) { - font.dispose(); - } - m_fontMap.clear(); - // clear bold fonts - for (Font font : m_fontToBoldFontMap.values()) { - font.dispose(); - } - m_fontToBoldFontMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Cursor - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps IDs to cursors. - */ - private static Map m_idToCursorMap = new HashMap(); - /** - * Returns the system cursor matching the specific ID. - * - * @param id - * int The ID value for the cursor - * @return Cursor The system cursor matching the specific ID - */ - public static Cursor getCursor(int id) { - Integer key = Integer.valueOf(id); - Cursor cursor = m_idToCursorMap.get(key); - if (cursor == null) { - cursor = new Cursor(Display.getDefault(), id); - m_idToCursorMap.put(key, cursor); - } - return cursor; - } - /** - * Dispose all of the cached cursors. - */ - public static void disposeCursors() { - for (Cursor cursor : m_idToCursorMap.values()) { - cursor.dispose(); - } - m_idToCursorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeImages(); - disposeFonts(); - disposeCursors(); - } -} \ No newline at end of file diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar deleted file mode 100644 index e29e8a946..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar deleted file mode 100644 index ecd42c1f9..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar and /dev/null differ diff --git a/tools/eclipse/readme.txt b/tools/eclipse/readme.txt deleted file mode 100644 index 07e387f9e..000000000 --- a/tools/eclipse/readme.txt +++ /dev/null @@ -1,16 +0,0 @@ -This folder contains ChibiOS/RT related Eclipse extensions: - -- org.chibios.tools.eclipse.debug_x.y.z.jar, debugger extension that allows to - inspect the ChibiOS/RT internal data structures at debug time. This plugin - is best used when the kernel debug options are turned on. - Installation: - - Copy the plugin under [eclipse]/plugins. - - Start Eclipse and enable the plugin from: - Window->Show View->Others...->ChibiOS/RT - - Make sure that Eclipse is using the "Standard Debugger" from: - Window->Preferences->Run/Debug->Launching->Default Launchers-> - GDB Hardware Debugging->[Debug] - - Start a debug session of a ChibiOS/RT demo or application and step until - after chSysInit() has been invoked. - - Inspect the various structures (Timers, Threads etc) using the ChibiOS/RT - view by pressing the yellow refresh button. -- cgit v1.2.3