From 50a41618beccf297631423b10aba8daa3be1e901 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 10 Aug 2011 09:17:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3220 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../plugins/org.chibios.tools.eclipse.debug_1.0.4.jar | Bin 0 -> 34681 bytes tools/eclipse/readme.txt | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar create mode 100644 tools/eclipse/readme.txt (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar new file mode 100644 index 000000000..7a72647d3 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar differ diff --git a/tools/eclipse/readme.txt b/tools/eclipse/readme.txt new file mode 100644 index 000000000..07e387f9e --- /dev/null +++ b/tools/eclipse/readme.txt @@ -0,0 +1,16 @@ +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 From e0309ba9738efc707f8c43de43e04d2c62a32e8c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 12 Aug 2011 06:47:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3222 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../plugins/org.chibios.tools.eclipse.debug_1.0.4.jar | Bin 34681 -> 0 bytes .../plugins/org.chibios.tools.eclipse.debug_1.0.5.jar | Bin 0 -> 34867 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar deleted file mode 100644 index 7a72647d3..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.4.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar new file mode 100644 index 000000000..dd46cfc15 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar differ -- cgit v1.2.3 From 9ff43d016e507151e59d2acbf33b701178bbfc90 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Sep 2011 09:52:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3302 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../plugins/org.chibios.tools.eclipse.debug_1.0.5.jar | Bin 34867 -> 0 bytes .../plugins/org.chibios.tools.eclipse.debug_1.0.7.jar | Bin 0 -> 34937 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar deleted file mode 100644 index dd46cfc15..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.5.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar new file mode 100644 index 000000000..fd5622085 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar differ -- cgit v1.2.3 From 3cf38d95f52d00e39548e7ef82af42919b82eaf8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Feb 2012 10:28:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3911 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../plugins/org.chibios.tools.eclipse.debug_1.0.7.jar | Bin 34937 -> 0 bytes .../plugins/org.chibios.tools.eclipse.debug_1.0.8.jar | Bin 0 -> 34953 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.jar deleted file mode 100644 index fd5622085..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.7.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 new file mode 100644 index 000000000..ecd42c1f9 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.debug_1.0.8.jar differ -- cgit v1.2.3 From 5f342be96eb860286417b9ad84b861dede2cdd25 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 07:52:10 +0000 Subject: Configuration tool prototype (not complete). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4427 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../.externalToolBuilders/FMPP Builder.launch | 9 + tools/gencfg/.project | 25 + tools/gencfg/config.fmpp | 10 + .../gencfg/processors/boards/stm32f4xx/config.fmpp | 5 + .../boards/stm32f4xx/datamodel/stm32f4board.xml | 1040 ++++++++++++++++++++ .../boards/stm32f4xx/templates/board.mk.ftl | 27 + tools/gencfg/readme.txt | 1 + tools/gencfg/run.bat | 1 + tools/gencfg/schema/boards/abstract_board.xsd | 49 + tools/gencfg/schema/boards/stm32f4xx_board.xsd | 84 ++ tools/gencfg/schema/common/doc.xsd | 42 + .../schema/common/stm32/stm32_gpiov2_port.xsd | 105 ++ tools/gencfg/schema/stm32f4board.xml | 1040 ++++++++++++++++++++ 13 files changed, 2438 insertions(+) create mode 100644 tools/gencfg/.externalToolBuilders/FMPP Builder.launch create mode 100644 tools/gencfg/.project create mode 100644 tools/gencfg/config.fmpp create mode 100644 tools/gencfg/processors/boards/stm32f4xx/config.fmpp create mode 100644 tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml create mode 100644 tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl create mode 100644 tools/gencfg/readme.txt create mode 100644 tools/gencfg/run.bat create mode 100644 tools/gencfg/schema/boards/abstract_board.xsd create mode 100644 tools/gencfg/schema/boards/stm32f4xx_board.xsd create mode 100644 tools/gencfg/schema/common/doc.xsd create mode 100644 tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd create mode 100644 tools/gencfg/schema/stm32f4board.xml (limited to 'tools') diff --git a/tools/gencfg/.externalToolBuilders/FMPP Builder.launch b/tools/gencfg/.externalToolBuilders/FMPP Builder.launch new file mode 100644 index 000000000..266ef7bdc --- /dev/null +++ b/tools/gencfg/.externalToolBuilders/FMPP Builder.launch @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tools/gencfg/.project b/tools/gencfg/.project new file mode 100644 index 000000000..a112039b3 --- /dev/null +++ b/tools/gencfg/.project @@ -0,0 +1,25 @@ + + + _Configuration Tool + + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/FMPP Builder.launch + + + incclean + true + + + + + + + diff --git a/tools/gencfg/config.fmpp b/tools/gencfg/config.fmpp new file mode 100644 index 000000000..0f34b0a03 --- /dev/null +++ b/tools/gencfg/config.fmpp @@ -0,0 +1,10 @@ +# Change the next line to point to the processor you want to use. Processors +# are identified by a file named "config.fmpp" under the "processors" root +# directory. +inheritConfiguration: processors/boards/stm32f4xx/config.fmpp + +# Settings common to all processors. Do not change the following lines. +freemarkerLinks: { + lib: ./lib +} +logFile: ./log.fmpp diff --git a/tools/gencfg/processors/boards/stm32f4xx/config.fmpp b/tools/gencfg/processors/boards/stm32f4xx/config.fmpp new file mode 100644 index 000000000..a182fe12e --- /dev/null +++ b/tools/gencfg/processors/boards/stm32f4xx/config.fmpp @@ -0,0 +1,5 @@ +sourceRoot: templates +outputRoot: output +data: { + doc1: xml(../datamodel/stm32f4board.xml) +} diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml new file mode 100644 index 000000000..08016b73c --- /dev/null +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -0,0 +1,1040 @@ + + + +
Board definition for STM32F4-Discovery.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl new file mode 100644 index 000000000..d221241ed --- /dev/null +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl @@ -0,0 +1,27 @@ +[#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 /] +[@pp.changeOutputFile name="boark.mk" /] +# List of all the board related files. +BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.@BoardID[0]}/board.c + +# Required include directories +BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.@BoardID[0]} diff --git a/tools/gencfg/readme.txt b/tools/gencfg/readme.txt new file mode 100644 index 000000000..ffd318f25 --- /dev/null +++ b/tools/gencfg/readme.txt @@ -0,0 +1 @@ +Write requirements and setup documentation here. \ No newline at end of file diff --git a/tools/gencfg/run.bat b/tools/gencfg/run.bat new file mode 100644 index 000000000..460783f39 --- /dev/null +++ b/tools/gencfg/run.bat @@ -0,0 +1 @@ +fmpp -C config.fmpp diff --git a/tools/gencfg/schema/boards/abstract_board.xsd b/tools/gencfg/schema/boards/abstract_board.xsd new file mode 100644 index 000000000..9ce06495a --- /dev/null +++ b/tools/gencfg/schema/boards/abstract_board.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + Board identifier string, it is used to + create the board files folder name and the board + identifier macro in board.h. + + + + + + + + + + + PHY identifier as defined in mii.h or empty if a PHY is not present. + + + + + + + + + + + Type of the PHY device: RMII or MII, this attribute is defaulted to MII if not present. + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/boards/stm32f4xx_board.xsd b/tools/gencfg/schema/boards/stm32f4xx_board.xsd new file mode 100644 index 000000000..8b7ba2bbb --- /dev/null +++ b/tools/gencfg/schema/boards/stm32f4xx_board.xsd @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + HSE frequency or zero if not present. + + + + + + + + + + + + + LSE frequency or zero if not present. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/common/doc.xsd b/tools/gencfg/schema/common/doc.xsd new file mode 100644 index 000000000..573beb618 --- /dev/null +++ b/tools/gencfg/schema/common/doc.xsd @@ -0,0 +1,42 @@ + + + + + + >Generic item with optional name and brief description + + + + + + + + + >Something that can have a detailed description attached + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd b/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd new file mode 100644 index 000000000..dbefc05d3 --- /dev/null +++ b/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + + + + + + + + + + + Pin type as defined in TYPER register. + + + + + + + + + + + Pin speed as defined in SPEEDR 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/gencfg/schema/stm32f4board.xml b/tools/gencfg/schema/stm32f4board.xml new file mode 100644 index 000000000..08016b73c --- /dev/null +++ b/tools/gencfg/schema/stm32f4board.xml @@ -0,0 +1,1040 @@ + + + +
Board definition for STM32F4-Discovery.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-- cgit v1.2.3 From f8211377ce31fe1e327fcb0606c659f9df0ae513 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 07:55:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4428 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/schema/stm32f4board.xml | 1040 ---------------------------------- tools/gencfg/xml/stm32f4board.xml | 1040 ++++++++++++++++++++++++++++++++++ 2 files changed, 1040 insertions(+), 1040 deletions(-) delete mode 100644 tools/gencfg/schema/stm32f4board.xml create mode 100644 tools/gencfg/xml/stm32f4board.xml (limited to 'tools') diff --git a/tools/gencfg/schema/stm32f4board.xml b/tools/gencfg/schema/stm32f4board.xml deleted file mode 100644 index 08016b73c..000000000 --- a/tools/gencfg/schema/stm32f4board.xml +++ /dev/null @@ -1,1040 +0,0 @@ - - - -
Board definition for STM32F4-Discovery.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml new file mode 100644 index 000000000..08016b73c --- /dev/null +++ b/tools/gencfg/xml/stm32f4board.xml @@ -0,0 +1,1040 @@ + + + +
Board definition for STM32F4-Discovery.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-- cgit v1.2.3 From 94251b69f4ebabb4c9c33b60270e1f140ca06f66 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 08:02:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4429 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/readme.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/gencfg/readme.txt b/tools/gencfg/readme.txt index ffd318f25..5b2b58ba4 100644 --- a/tools/gencfg/readme.txt +++ b/tools/gencfg/readme.txt @@ -1 +1,14 @@ -Write requirements and setup documentation here. \ No newline at end of file +***************************************************************************** +*** Files Organization *** +***************************************************************************** + +--{root} - Configuration Generator tool. + +--readme.txt - This file. + +--config.fmpp - Tool configuration file, tool setup is done here. + +--run.bat - Tool runner batch file. + +--lib/ - FTL library files. + +--processors/ - Various configuration generators. + +--schema/ - Schema files used to validate XML configurations. + +--xml/ - Templates of configuration files. + +Write requirements and setup documentation here. -- cgit v1.2.3 From ea38721fc33720fcf09c5f778e91e70d20bdc5ab Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 08:32:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4430 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/lib/liblicense.ftl | 58 ++++++++++ tools/gencfg/lib/libutils.ftl | 109 +++++++++++++++++++ .../boards/stm32f4xx/datamodel/stm32f4board.xml | 3 +- .../boards/stm32f4xx/templates/board.c.ftl | 120 +++++++++++++++++++++ .../boards/stm32f4xx/templates/board.h.ftl | 46 ++++++++ .../boards/stm32f4xx/templates/board.mk.ftl | 3 +- 6 files changed, 336 insertions(+), 3 deletions(-) create mode 100644 tools/gencfg/lib/liblicense.ftl create mode 100644 tools/gencfg/lib/libutils.ftl create mode 100644 tools/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl create mode 100644 tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl (limited to 'tools') diff --git a/tools/gencfg/lib/liblicense.ftl b/tools/gencfg/lib/liblicense.ftl new file mode 100644 index 000000000..18581ee29 --- /dev/null +++ b/tools/gencfg/lib/liblicense.ftl @@ -0,0 +1,58 @@ +[#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/gencfg/lib/libutils.ftl b/tools/gencfg/lib/libutils.ftl new file mode 100644 index 000000000..03b0622a3 --- /dev/null +++ b/tools/gencfg/lib/libutils.ftl @@ -0,0 +1,109 @@ +[#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/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml index 08016b73c..fc54e70b1 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -3,12 +3,11 @@ -
Board definition for STM32F4-Discovery.
. + --] +[@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 HAL_USE_SDC || defined(__DOXYGEN__) +/** + * @brief SDC card detection. + * @todo Fill the implementation. + */ +bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) { + + (void)sdcp; + return TRUE; +} + +/* + * @brief SDC card write protection detection. + * @todo Fill the implementation. + */ +bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) { + + (void)sdcp; + return FALSE; +} +#endif /* HAL_USE_SDC */ + +#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) +/** + * @brief MMC_SPI card detection. + * @todo Fill the implementation. + */ +bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { + + (void)mmcp; + return TRUE; +} + +/* + * @brief MMC_SPI card write protection detection. + * @todo Fill the implementation. + */ +bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { + + (void)mmcp; + return FALSE; +} +#endif + +/** + * @brief Board-specific initialization code. + * @todo Add your board-specific code, if any. + */ +void boardInit(void) { +} diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl new file mode 100644 index 000000000..d2ef1802f --- /dev/null +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -0,0 +1,46 @@ +[#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.@name[0]} board. + */ + +#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/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl index d221241ed..34804dd67 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl @@ -19,7 +19,8 @@ along with this program. If not, see . --] [@pp.dropOutputFile /] -[@pp.changeOutputFile name="boark.mk" /] +[#import "/@lib/libutils.ftl" as utils /] +[@pp.changeOutputFile name="board.mk" /] # List of all the board related files. BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.@BoardID[0]}/board.c -- cgit v1.2.3 From 3d44ca0b8b480970a094f265ffa020e211896789 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 08:46:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4431 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/datamodel/stm32f4board.xml | 4 +++- .../processors/boards/stm32f4xx/templates/board.c.ftl | 4 ++-- .../processors/boards/stm32f4xx/templates/board.h.ftl | 16 ++++++++++++++++ tools/gencfg/schema/boards/abstract_board.xsd | 4 ++-- 4 files changed, 23 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml index fc54e70b1..0a5959eec 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -7,7 +7,9 @@ BoardID="ST_STM32F4_DISCOVERY" HSEBypass="true" HSEFrequency="0" - LSEFrequency="0"> + LSEFrequency="0" + BoardPHYID="MII_KS8721_ID" + BoardPHYType="RMII"> - + - + Type of the PHY device: RMII or MII, this attribute is defaulted to MII if not present. -- cgit v1.2.3 From df72da79cfa6a9edab2811a057f137b069f37c13 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 09:55:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4432 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/datamodel/stm32f4board.xml | 3 +- .../boards/stm32f4xx/templates/board.h.ftl | 36 ++++++++++++++++++++++ tools/gencfg/schema/boards/stm32f4xx_board.xsd | 22 ++++++++++--- 3 files changed, 55 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml index 0a5959eec..343d3ea85 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -9,7 +9,8 @@ HSEFrequency="0" LSEFrequency="0" BoardPHYID="MII_KS8721_ID" - BoardPHYType="RMII"> + BoardPHYType="RMII" + VDD="330"> - @@ -32,7 +32,6 @@ - @@ -50,12 +49,26 @@ - + + + + + STM32F4xx VDD. + + + + + + + + + - - -- cgit v1.2.3 From a6228c717d001bef0c16ebeaefaf59ac7cd5b2ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 10:32:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4433 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../processors/boards/stm32f4xx/templates/board.h.ftl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index 8080f2ba8..d0253cfcd 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -85,6 +85,19 @@ * IO pins assignments. */ +[#list doc1.board.ports.* as port] + [#assign pinidx = 0 /] + [#list port.* as pin] + [#assign name = pin.@ID[0]?string?trim /] + [#if name?length == 0] + [#assign name = pin?node_name?upper_case /] + [/#if] +#define ${(port?node_name + "_" + name)?right_pad(23, " ")} ${pinidx?string} + [#assign pinidx = pinidx + 1 /] + [/#list] + +[/#list] + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { -- cgit v1.2.3 From e4c592d9cfb2740678862865498d545bf8160e12 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 12:05:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4434 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/datamodel/stm32f4board.xml | 292 ++++++++++----------- .../boards/stm32f4xx/templates/board.h.ftl | 61 ++++- .../schema/common/stm32/stm32_gpiov2_port.xsd | 2 +- 3 files changed, 202 insertions(+), 153 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml index 343d3ea85..bd5e1bdb0 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -14,115 +14,115 @@ @@ -131,112 +131,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -245,112 +245,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -359,112 +359,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -473,112 +473,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -587,112 +587,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -701,112 +701,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -815,112 +815,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> @@ -929,112 +929,112 @@ ID="" Type="PushPull" Speed="Minimum" - Resistor="None" + Resistor="Floating" Mode="Input" Alternate="0" /> diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index d0253cfcd..cb46a90d8 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -37,13 +37,13 @@ * Board identifier. */ #define BOARD_${doc1.board.@BoardID[0]} -#define BOARD_NAME "${doc1.board.@name[0]}" +#define BOARD_NAME "${doc1.board.@name[0]}" [#if doc1.board.@BoardPHYID[0]??] /* * Ethernet PHY type. */ -#define BOARD_PHY_ID ${doc1.board.@BoardPHYID[0]} +#define BOARD_PHY_ID ${doc1.board.@BoardPHYID[0]} [#if doc1.board.@BoardPHYType[0]?string == "RMII"] #define BOARD_PHY_RMII [/#if] @@ -59,11 +59,11 @@ [/#if] */ #if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.@LSEFrequency[0]} +#define STM32_LSECLK ${doc1.board.@LSEFrequency[0]} #endif #if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.@HSEFrequency[0]} +#define STM32_HSECLK ${doc1.board.@HSEFrequency[0]} #endif [#if doc1.board.@HSEBypass[0]?string == "true"] @@ -74,7 +74,7 @@ * Board voltages. * Required for performance limits calculation. */ -#define STM32_VDD ${doc1.board.@VDD[0]} +#define STM32_VDD ${doc1.board.@VDD[0]} /* * MCU type as defined in the ST header file stm32f4xx.h. @@ -84,17 +84,66 @@ /* * IO pins assignments. */ +[#list doc1.board.ports.* as port] + [#assign pinidx = 0 /] + [#list port.* as pin] + [#assign name = pin.@ID[0]?string?trim /] + [#if name?length == 0] + [#assign name = pin?node_name?upper_case /] + [/#if] +#define ${(port?node_name + "_" + name)?right_pad(27, " ")} ${pinidx?string} + [#assign pinidx = pinidx + 1 /] + [/#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_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_PUDR_FLOATING(n) (0U << ((n) * 2)) +#define PIN_PUDR_PULLUP(n) (1U << ((n) * 2)) +#define PIN_PUDR_PULLDOWN(n) (2U << ((n) * 2)) +#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) [#list doc1.board.ports.* as port] +/* + * ${port?node_name} setup: + * [#assign pinidx = 0 /] [#list port.* as pin] [#assign name = pin.@ID[0]?string?trim /] [#if name?length == 0] [#assign name = pin?node_name?upper_case /] [/#if] -#define ${(port?node_name + "_" + name)?right_pad(23, " ")} ${pinidx?string} + [#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..] + pinidx?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). [#assign pinidx = pinidx + 1 /] [/#list] + */ [/#list] diff --git a/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd b/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd index dbefc05d3..b363b0006 100644 --- a/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd +++ b/tools/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd @@ -82,7 +82,7 @@ - + -- cgit v1.2.3 From 10703d315c315361b47a7434a9d54175542af56b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 12:46:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4435 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/templates/board.h.ftl | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index cb46a90d8..0873c9c55 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -85,13 +85,15 @@ * IO pins assignments. */ [#list doc1.board.ports.* as port] + [#assign port_name = port?node_name?upper_case /] [#assign pinidx = 0 /] [#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?node_name?upper_case /] + [#assign name = pin_name /] [/#if] -#define ${(port?node_name + "_" + name)?right_pad(27, " ")} ${pinidx?string} +#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pinidx?string} [#assign pinidx = pinidx + 1 /] [/#list] @@ -117,14 +119,17 @@ #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?node_name} setup: + * ${port_name} setup: * + [#-- Generating pin descriptions inside the comment.--] [#assign pinidx = 0 /] [#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?node_name?upper_case /] + [#assign name = pin_name /] [/#if] [#assign mode = pin.@Mode[0] /] [#assign type = pin.@Type[0] /] @@ -144,6 +149,38 @@ [#assign pinidx = pinidx + 1 /] [/#list] */ + [#-- Generating MODER register value.--] + [#assign pinidx = 0 /] + [#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 + "_" + pin_name + ")" /] + [#elseif mode == "Output"] + [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + pin_name + ")" /] + [#elseif mode == "Alternate"] + [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + pin_name + ")" /] + [#else] + [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + pin_name + ")" /] + [/#if] + [#if pinidx == 0] + [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] +[#--#define VAL_${port_name}_MODER (${out?right_pad(30, " ")}[#rt]--] + [#else] + [#assign line = " " + out /] +[#-- ${out?right_pad(30, " ")}[#rt]--] + [/#if] + [#if pinidx < 15] +${(line + " |")?right_pad(76, " ") + "\\"} + [#else] +${line + ")"} + [/#if] + [#assign pinidx = pinidx + 1 /] + [/#list] [/#list] -- cgit v1.2.3 From 4399d50df58675f8a32abb338f6cbe721d0296bf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 13:21:00 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4436 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/datamodel/stm32f4board.xml | 148 +++++++++++++- .../boards/stm32f4xx/templates/board.h.ftl | 152 +++++++++++++- .../schema/common/stm32/stm32_gpiov2_port.xsd | 223 +++++++++++++++------ 3 files changed, 461 insertions(+), 62 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml index bd5e1bdb0..88113fea3 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml @@ -14,8 +14,9 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + + + Object representing an STM32 pin for the GPIOv2 + peripheral. + + + + + Pin identifier, used to generate a #define with the + pin name. + + + - 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. - - + + + + Pin mode, as defined for MODER register. + + + @@ -51,23 +130,29 @@ - - - - Pin type as defined in TYPER register. - - + + + + Logic level for the ODR register. + + - - + + - - - Pin speed as defined in SPEEDR register. - - + + + + Pin speed as defined in SPEEDR register. + + + @@ -75,12 +160,31 @@ + + + + + Pin type as defined in TYPER register. + + + + + + + + - - - Pin pull-up/down resistor as defined in PUDR register. - - + + + + Pin pull-up/down resistor as defined in PUDR register. + + + @@ -88,13 +192,18 @@ - - - Pin alternate function number, only valid if "Alternate" is selected in the Mode attribute. - - + + + + Pin alternate function number, only valid if + "Alternate" is selected + in the Mode attribute. + + + - -- cgit v1.2.3 From 1412b2244137b366c6b6741ac56e3b14048d57a2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 13:23:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4437 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/xml/stm32f4board.xml | 446 +++++++++++++++++++++++++------------- 1 file changed, 296 insertions(+), 150 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml index 08016b73c..ae76505c5 100644 --- a/tools/gencfg/xml/stm32f4board.xml +++ b/tools/gencfg/xml/stm32f4board.xml @@ -3,124 +3,142 @@ -
Board definition for STM32F4-Discovery.
+ name="-----descriptive board name here-----" + BoardID="IDENTIFIER_NAME" + HSEBypass="false" + HSEFrequency="8000000" + LSEFrequency="32768" + BoardPHYID="MII_KS8721_ID" + BoardPHYType="RMII" + VDD="330"> @@ -128,113 +146,129 @@ @@ -242,113 +276,129 @@ @@ -356,113 +406,129 @@ @@ -470,113 +536,129 @@ @@ -584,113 +666,129 @@ @@ -698,113 +796,129 @@ @@ -812,113 +926,129 @@ @@ -926,113 +1056,129 @@ -- cgit v1.2.3 From 7f96cf83f5bc9e2f4fcd1b9f060cffe8f4f326e8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 13:32:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4438 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/templates/board.h.ftl | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index 9127e0a10..59790e41e 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -163,7 +163,7 @@ [/#if] [#assign mode = pin.@Mode[0] /] [#if mode == "Input"] - [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] [#elseif mode == "Output"] [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + pin_name + ")" /] [#elseif mode == "Alternate"] @@ -195,9 +195,9 @@ ${line + ")"} [/#if] [#assign type = pin.@Type[0] /] [#if type == "PushPull"] - [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] @@ -223,13 +223,13 @@ ${line + ")"} [/#if] [#assign speed = pin.@Speed[0] /] [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_25M(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OSPEED_25M(" + port_name + "_" + name + ")" /] [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_50M(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OSPEED_50M(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] @@ -255,11 +255,11 @@ ${line + ")"} [/#if] [#assign resistor = pin.@Resistor[0] /] [#if resistor == "Floating"] - [#assign out = "PIN_PUDR_FLOATING(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_PUDR_FLOATING(" + port_name + "_" + name + ")" /] [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUDR_PULLUP(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_PUDR_PULLUP(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_PUDR_PULLDOWN(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_PUDR_PULLDOWN(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_PUDR (" + out /] @@ -285,9 +285,9 @@ ${line + ")"} [/#if] [#assign level = pin.@Level[0] /] [#if level == "Low"] - [#assign out = "PIN_ODR_LOW(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_ODR_LOW(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] @@ -312,7 +312,7 @@ ${line + ")"} [#assign name = pin_name /] [/#if] [#assign alternate = pin.@Alternate[0]?trim /] - [#assign out = "PIN_AFIO_AF(" + port_name + "_" + pin_name + ", " + alternate + ")" /] + [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] [#elseif pinidx == 8] -- cgit v1.2.3 From 1a1058cda3211faa65b8f622fb1f79d9a673efc4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 13:50:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4439 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index 59790e41e..f424822fd 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -165,11 +165,11 @@ [#if mode == "Input"] [#assign out = "PIN_MODE_INPUT(" + port_name + "_" + name + ")" /] [#elseif mode == "Output"] - [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_MODE_OUTPUT(" + port_name + "_" + name + ")" /] [#elseif mode == "Alternate"] - [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_MODE_ALTERNATE(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + pin_name + ")" /] + [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] -- cgit v1.2.3 From 4d773146cd6acd29bbe66a123ea27b953f5c6000 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 14:13:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4440 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f4xx/datamodel/stm32f4board.xml | 1186 -------------------- 1 file changed, 1186 deletions(-) delete mode 100644 tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml b/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml deleted file mode 100644 index 88113fea3..000000000 --- a/tools/gencfg/processors/boards/stm32f4xx/datamodel/stm32f4board.xml +++ /dev/null @@ -1,1186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 0d474a24f2322e7f635faf3400d459f9b3d84077 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Jul 2012 14:58:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4441 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../processors/boards/stm32f4xx/templates/board.h.ftl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index f424822fd..3a6881fc4 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -115,9 +115,9 @@ #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_PUDR_FLOATING(n) (0U << ((n) * 2)) -#define PIN_PUDR_PULLUP(n) (1U << ((n) * 2)) -#define PIN_PUDR_PULLDOWN(n) (2U << ((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] @@ -244,7 +244,7 @@ ${line + ")"} [#assign pinidx = pinidx + 1 /] [/#list] [#-- - -- Generating PUDR register value. + -- Generating PUPDR register value. --] [#assign pinidx = 0 /] [#list port.* as pin] @@ -255,14 +255,14 @@ ${line + ")"} [/#if] [#assign resistor = pin.@Resistor[0] /] [#if resistor == "Floating"] - [#assign out = "PIN_PUDR_FLOATING(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_PUPDR_FLOATING(" + port_name + "_" + name + ")" /] [#elseif resistor == "PullUp"] - [#assign out = "PIN_PUDR_PULLUP(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_PUPDR_PULLUP(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_PUDR_PULLDOWN(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] [/#if] [#if pinidx == 0] - [#assign line = "#define VAL_" + port_name + "_PUDR (" + out /] + [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] [#else] [#assign line = " " + out /] [/#if] -- cgit v1.2.3 From b847957f922f668c9ccd017dbede768ae1e9917f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 15:59:36 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4450 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/hal/stm32f4xx/config.fmpp | 5 + tools/gencfg/schema/common/doc.xsd | 57 ++- tools/gencfg/schema/hal/abstract_adc_cfg.xsd | 43 ++ tools/gencfg/schema/hal/abstract_driver_cfg.xsd | 8 + .../hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd | 219 +++++++++++ .../schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd | 437 +++++++++++++++++++++ .../gencfg/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd | 29 ++ tools/gencfg/xml/stm32f4xx_cfg.xml | 43 ++ 8 files changed, 820 insertions(+), 21 deletions(-) create mode 100644 tools/gencfg/processors/hal/stm32f4xx/config.fmpp create mode 100644 tools/gencfg/schema/hal/abstract_adc_cfg.xsd create mode 100644 tools/gencfg/schema/hal/abstract_driver_cfg.xsd create mode 100644 tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd create mode 100644 tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd create mode 100644 tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd create mode 100644 tools/gencfg/xml/stm32f4xx_cfg.xml (limited to 'tools') diff --git a/tools/gencfg/processors/hal/stm32f4xx/config.fmpp b/tools/gencfg/processors/hal/stm32f4xx/config.fmpp new file mode 100644 index 000000000..307a6f61c --- /dev/null +++ b/tools/gencfg/processors/hal/stm32f4xx/config.fmpp @@ -0,0 +1,5 @@ +sourceRoot: templates +outputRoot: output +data: { + doc1: xml(../input/stm32f4xx_cfg.xml) +} diff --git a/tools/gencfg/schema/common/doc.xsd b/tools/gencfg/schema/common/doc.xsd index 573beb618..b7395605b 100644 --- a/tools/gencfg/schema/common/doc.xsd +++ b/tools/gencfg/schema/common/doc.xsd @@ -1,42 +1,57 @@ - - >Generic item with optional name and brief description + >Generic item with optional name and brief + description - - + + + Object name. + + + + + + + + + + Object brief description, 72 chars max in a + single line. + + + + + + + + + - >Something that can have a detailed description attached + >Something that can have a detailed description + attached - - + + + + Object documentation as text, does not + preserve formatting. + - +
diff --git a/tools/gencfg/schema/hal/abstract_adc_cfg.xsd b/tools/gencfg/schema/hal/abstract_adc_cfg.xsd new file mode 100644 index 000000000..4a2901c4e --- /dev/null +++ b/tools/gencfg/schema/hal/abstract_adc_cfg.xsd @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/hal/abstract_driver_cfg.xsd b/tools/gencfg/schema/hal/abstract_driver_cfg.xsd new file mode 100644 index 000000000..a884cd090 --- /dev/null +++ b/tools/gencfg/schema/hal/abstract_driver_cfg.xsd @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd new file mode 100644 index 000000000..ff700b621 --- /dev/null +++ b/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd new file mode 100644 index 000000000..18cb6a03b --- /dev/null +++ b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd @@ -0,0 +1,437 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd new file mode 100644 index 000000000..f846403f3 --- /dev/null +++ b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/xml/stm32f4xx_cfg.xml b/tools/gencfg/xml/stm32f4xx_cfg.xml new file mode 100644 index 000000000..65c9294e0 --- /dev/null +++ b/tools/gencfg/xml/stm32f4xx_cfg.xml @@ -0,0 +1,43 @@ + + + +
Application HAL configurations.
+ + + + + + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + ADC_SAMPLE_3 + + + ADC_CHANNEL_IN0 + + + + +
-- cgit v1.2.3 From 4002c66734db00de0a27ce3e1c7dbf0757cba260 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 16:01:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4451 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd | 219 --------------------- 1 file changed, 219 deletions(-) delete mode 100644 tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd (limited to 'tools') diff --git a/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd deleted file mode 100644 index ff700b621..000000000 --- a/tools/gencfg/schema/hal/stm32f4xx/Copy of stm32f4xx_adc_cfg.xsd +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 7f7cf9e8a81388cd68cba4eeb76894549e6755fb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 17:01:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4452 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../gencfg/processors/boards/stm32f4xx/config.fmpp | 2 +- .../hal/stm32f4xx/templates/hal_cfg.c.ftl | 30 ++++++++++++++++ .../hal/stm32f4xx/templates/hal_cfg.h.ftl | 40 ++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl create mode 100644 tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl (limited to 'tools') diff --git a/tools/gencfg/processors/boards/stm32f4xx/config.fmpp b/tools/gencfg/processors/boards/stm32f4xx/config.fmpp index a182fe12e..970d936ca 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/config.fmpp +++ b/tools/gencfg/processors/boards/stm32f4xx/config.fmpp @@ -1,5 +1,5 @@ sourceRoot: templates outputRoot: output data: { - doc1: xml(../datamodel/stm32f4board.xml) + doc1: xml(../input/stm32f4board.xml) } diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl new file mode 100644 index 000000000..922e614d8 --- /dev/null +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl @@ -0,0 +1,30 @@ +[#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=doc1.configuration.@name[0] + ".c" /] +/* +[@license.EmitLicenseAsText /] +*/ + +#include "ch.h" +#include "hal.h" diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl new file mode 100644 index 000000000..d4c05c1cf --- /dev/null +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl @@ -0,0 +1,40 @@ +[#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=doc1.configuration.@name[0] + ".h" /] +/* +[@license.EmitLicenseAsText /] +*/ + +#ifndef _x_H_ +#define _x_H_ + +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif + +#endif /* _x_H_ */ -- cgit v1.2.3 From 30a69000562fda260f742c134501f006c0ec8ca8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 17:12:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4453 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl | 3 ++- tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl index 922e614d8..3f70e952d 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl @@ -21,7 +21,8 @@ [@pp.dropOutputFile /] [#import "/@lib/libutils.ftl" as utils /] [#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name=doc1.configuration.@name[0] + ".c" /] +[#assign fname = doc1.configuration.@name[0] /] +[@pp.changeOutputFile name = fname + ".c" /] /* [@license.EmitLicenseAsText /] */ diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl index d4c05c1cf..cfdf73b45 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl @@ -21,20 +21,21 @@ [@pp.dropOutputFile /] [#import "/@lib/libutils.ftl" as utils /] [#import "/@lib/liblicense.ftl" as license /] -[@pp.changeOutputFile name=doc1.configuration.@name[0] + ".h" /] +[#assign fname = doc1.configuration.@name[0] /] +[@pp.changeOutputFile name = fname + ".h" /] /* [@license.EmitLicenseAsText /] */ -#ifndef _x_H_ -#define _x_H_ +#ifndef _${fname?upper_case}_H_ +#define _${fname?upper_case}_H_ #ifdef __cplusplus extern "C" { #endif - void boardInit(void); + #ifdef __cplusplus } #endif -#endif /* _x_H_ */ +#endif /* _${fname?upper_case}_H_ */ -- cgit v1.2.3 From 5521ecc4fb61cda3cad92de5f0505c873b6abb99 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 18:47:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4455 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/config.fmpp | 2 +- tools/gencfg/lib/libcode.ftl | 261 +++++++++++++++++++++ tools/gencfg/lib/libstm32f4xx.ftl | 34 +++ .../hal/stm32f4xx/templates/hal_cfg.c.ftl | 33 +++ .../hal/stm32f4xx/templates/hal_cfg.h.ftl | 24 ++ .../schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd | 2 +- tools/gencfg/xml/stm32f4xx_cfg.xml | 4 +- 7 files changed, 356 insertions(+), 4 deletions(-) create mode 100644 tools/gencfg/lib/libcode.ftl create mode 100644 tools/gencfg/lib/libstm32f4xx.ftl (limited to 'tools') diff --git a/tools/gencfg/config.fmpp b/tools/gencfg/config.fmpp index 0f34b0a03..9fc5a31dd 100644 --- a/tools/gencfg/config.fmpp +++ b/tools/gencfg/config.fmpp @@ -1,7 +1,7 @@ # Change the next line to point to the processor you want to use. Processors # are identified by a file named "config.fmpp" under the "processors" root # directory. -inheritConfiguration: processors/boards/stm32f4xx/config.fmpp +inheritConfiguration: processors/hal/stm32f4xx/config.fmpp # Settings common to all processors. Do not change the following lines. freemarkerLinks: { diff --git a/tools/gencfg/lib/libcode.ftl b/tools/gencfg/lib/libcode.ftl new file mode 100644 index 000000000..8147e02c4 --- /dev/null +++ b/tools/gencfg/lib/libcode.ftl @@ -0,0 +1,261 @@ +[#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 brief=[]] + [#if brief[0]??] +[@utils.FormatStringAsText " * @brief " + " * " + utils.WithDot(brief[0]?cap_first) + boundary /] + [/#if] +[/#macro] + +[#-- + -- This macro generates a detailed description in DoxyGen format. + --] +[#macro EmitDoxygenDetails details=[]] + [#if details[0]??] +[@utils.FormatStringAsText " * @details " + " * " + utils.WithDot(details[0]?cap_first) + boundary /] + [/#if] +[/#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/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl new file mode 100644 index 000000000..f6df3a771 --- /dev/null +++ b/tools/gencfg/lib/libstm32f4xx.ftl @@ -0,0 +1,34 @@ +[#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 EmitADCConfig config] + [#local cfg_name = config.@name[0]?string /] +/* ADC Config.*/ +/** +[@code.EmitDoxygenBrief config.@brief /] +[@code.EmitDoxygenDetails config.details /] + */ +const ADCConfig ${cfg_name} = {0}; +[/#macro] diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl index 3f70e952d..e97f20c82 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl @@ -21,6 +21,8 @@ [@pp.dropOutputFile /] [#import "/@lib/libutils.ftl" as utils /] [#import "/@lib/liblicense.ftl" as license /] +[#import "/@lib/libcode.ftl" as code /] +[#import "/@lib/libstm32f4xx.ftl" as stm32f4xx /] [#assign fname = doc1.configuration.@name[0] /] [@pp.changeOutputFile name = fname + ".c" /] /* @@ -29,3 +31,34 @@ #include "ch.h" #include "hal.h" + +/*===========================================================================*/ +/* Module local definitions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module exported variables. */ +/*===========================================================================*/ + +[#list doc1.configuration.configs.* as config] + [#assign config_type = config?node_name /] + [#if config_type == "adc_config"] + [@stm32f4xx.EmitADCConfig config /] + [/#if] + +[/#list] +/*===========================================================================*/ +/* Module local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local functions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module exported functions. */ +/*===========================================================================*/ diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl index cfdf73b45..b8f350ff9 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl @@ -30,6 +30,30 @@ #ifndef _${fname?upper_case}_H_ #define _${fname?upper_case}_H_ +/*===========================================================================*/ +/* Module constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module pre-compile time settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module data structures and types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module macros. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + #ifdef __cplusplus extern "C" { #endif diff --git a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd index 18cb6a03b..c038263c2 100644 --- a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd +++ b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd @@ -338,7 +338,7 @@ minOccurs="1"> - diff --git a/tools/gencfg/xml/stm32f4xx_cfg.xml b/tools/gencfg/xml/stm32f4xx_cfg.xml index 65c9294e0..a0ed7fbb6 100644 --- a/tools/gencfg/xml/stm32f4xx_cfg.xml +++ b/tools/gencfg/xml/stm32f4xx_cfg.xml @@ -5,9 +5,9 @@ name="hal_configs">
Application HAL configurations.
- + - Date: Tue, 10 Jul 2012 19:23:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4456 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/lib/libstm32f4xx.ftl | 1 - tools/gencfg/schema/hal/abstract_driver_cfg.xsd | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl index f6df3a771..47b0659e3 100644 --- a/tools/gencfg/lib/libstm32f4xx.ftl +++ b/tools/gencfg/lib/libstm32f4xx.ftl @@ -25,7 +25,6 @@ --] [#macro EmitADCConfig config] [#local cfg_name = config.@name[0]?string /] -/* ADC Config.*/ /** [@code.EmitDoxygenBrief config.@brief /] [@code.EmitDoxygenDetails config.details /] diff --git a/tools/gencfg/schema/hal/abstract_driver_cfg.xsd b/tools/gencfg/schema/hal/abstract_driver_cfg.xsd index a884cd090..d6501ff2a 100644 --- a/tools/gencfg/schema/hal/abstract_driver_cfg.xsd +++ b/tools/gencfg/schema/hal/abstract_driver_cfg.xsd @@ -4,5 +4,9 @@ - + + + + +
-- cgit v1.2.3 From dbfb5a1f70e69a3f412f2a69f528bf398633c10f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Jul 2012 20:08:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4457 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/lib/libstm32f4xx.ftl | 55 ++++++++++++++++++++-- .../hal/stm32f4xx/templates/hal_cfg.c.ftl | 2 + .../hal/stm32f4xx/templates/hal_cfg.h.ftl | 9 +++- 3 files changed, 61 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl index 47b0659e3..9ede34c2c 100644 --- a/tools/gencfg/lib/libstm32f4xx.ftl +++ b/tools/gencfg/lib/libstm32f4xx.ftl @@ -20,14 +20,61 @@ --] [#-- - -- Emits the ChibiOS/RT standard license exception text. - -- The license exception text is indented by 4 spaces. + -- Emits the STM32F4xx ADC driver constant configuration structures. --] [#macro EmitADCConfig config] [#local cfg_name = config.@name[0]?string /] /** -[@code.EmitDoxygenBrief config.@brief /] -[@code.EmitDoxygenDetails config.details /] + [@code.EmitDoxygenBrief config.@brief /] + [@code.EmitDoxygenDetails config.details /] */ const ADCConfig ${cfg_name} = {0}; + + [#list config.groups.group as group] + [#local grpcfg_name = group.@name[0]?string /] +/** + [@code.EmitDoxygenBrief group.@brief /] + [@code.EmitDoxygenDetails group.details /] + */ +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.@conversion_callback[0]?string?trim == ""] + NULL, + [#else] + ${group.@conversion_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] +}; + [/#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.@conversion_callback[0]?string?trim != ""] + void ${group.@conversion_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/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl index e97f20c82..cd8b17a01 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl @@ -32,6 +32,8 @@ #include "ch.h" #include "hal.h" +#include "${fname + ".h"}" + /*===========================================================================*/ /* Module local definitions. */ /*===========================================================================*/ diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl index b8f350ff9..050b2f84d 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl @@ -21,6 +21,8 @@ [@pp.dropOutputFile /] [#import "/@lib/libutils.ftl" as utils /] [#import "/@lib/liblicense.ftl" as license /] +[#import "/@lib/libcode.ftl" as code /] +[#import "/@lib/libstm32f4xx.ftl" as stm32f4xx /] [#assign fname = doc1.configuration.@name[0] /] [@pp.changeOutputFile name = fname + ".h" /] /* @@ -57,7 +59,12 @@ #ifdef __cplusplus extern "C" { #endif - +[#list doc1.configuration.configs.* as config] + [#assign config_type = config?node_name /] + [#if config_type == "adc_config"] + [@stm32f4xx.EmitADCConfigExtern config /] + [/#if] +[/#list] #ifdef __cplusplus } #endif -- cgit v1.2.3 From 2ab5ce68ba6f7913fe63b2905f8065327d769b79 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 11 Jul 2012 11:59:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4458 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/lib/libstm32f4xx.ftl | 70 ++++++++++++++++++++++ .../boards/stm32f4xx/templates/board.h.ftl | 46 +++++--------- 2 files changed, 85 insertions(+), 31 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl index 9ede34c2c..2a541606d 100644 --- a/tools/gencfg/lib/libstm32f4xx.ftl +++ b/tools/gencfg/lib/libstm32f4xx.ftl @@ -53,6 +53,76 @@ const ADCGroupConfig ${grpcfg_name} = { [#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 discnum = group.@discontinuous_number[0]?word_list[0]?number /] + [#local cr1 = cr1 + " | ADC_CR1_DISCNUM_N(" + (discnum - 1)?string + ")" /] + [#if group.@discontinuous_mode[0]?string == "true"] + [#local cr1 = cr1 + " | ADC_CR1_DISCEN" /] + [/#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] diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index 3a6881fc4..dccb8782f 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -86,15 +86,13 @@ */ [#list doc1.board.ports.* as port] [#assign port_name = port?node_name?upper_case /] - [#assign pinidx = 0 /] [#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, " ")} ${pinidx?string} - [#assign pinidx = pinidx + 1 /] +#define ${(port_name + "_" + name)?right_pad(27, " ")} ${pin_index?string} [/#list] [/#list] @@ -126,7 +124,6 @@ * ${port_name} setup: * [#-- Generating pin descriptions inside the comment.--] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -147,14 +144,12 @@ [#else] [#assign desc = "Analog" /] [/#if] - * P${(port?node_name[4..] + pinidx?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). - [#assign pinidx = pinidx + 1 /] + * P${(port?node_name[4..] + pin_index?string)?right_pad(3, " ")} - ${name?right_pad(26, " ")}(${desc?lower_case}). [/#list] */ [#-- -- Generating MODER register value. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -171,22 +166,20 @@ [#else] [#assign out = "PIN_MODE_ANALOG(" + port_name + "_" + name + ")" /] [/#if] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_MODER (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if pinidx < 15] + [#if pin_index < 15] ${(line + " |")?right_pad(76, " ") + "\\"} [#else] ${line + ")"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [#-- -- Generating OTYPER register value. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -199,22 +192,20 @@ ${line + ")"} [#else] [#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + name + ")" /] [/#if] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if pinidx < 15] + [#if pin_index < 15] ${(line + " |")?right_pad(76, " ") + "\\"} [#else] ${line + ")"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [#-- -- Generating SPEEDR register value. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -231,22 +222,20 @@ ${line + ")"} [#else] [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + name + ")" /] [/#if] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if pinidx < 15] + [#if pin_index < 15] ${(line + " |")?right_pad(76, " ") + "\\"} [#else] ${line + ")"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [#-- -- Generating PUPDR register value. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -261,22 +250,20 @@ ${line + ")"} [#else] [#assign out = "PIN_PUPDR_PULLDOWN(" + port_name + "_" + name + ")" /] [/#if] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_PUPDR (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if pinidx < 15] + [#if pin_index < 15] ${(line + " |")?right_pad(76, " ") + "\\"} [#else] ${line + ")"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [#-- -- Generating ODR register value. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -289,22 +276,20 @@ ${line + ")"} [#else] [#assign out = "PIN_ODR_HIGH(" + port_name + "_" + name + ")" /] [/#if] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_ODR (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if pinidx < 15] + [#if pin_index < 15] ${(line + " |")?right_pad(76, " ") + "\\"} [#else] ${line + ")"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [#-- -- Generating AFRx registers values. --] - [#assign pinidx = 0 /] [#list port.* as pin] [#assign pin_name = pin?node_name?upper_case /] [#assign name = pin.@ID[0]?string?trim /] @@ -313,19 +298,18 @@ ${line + ")"} [/#if] [#assign alternate = pin.@Alternate[0]?trim /] [#assign out = "PIN_AFIO_AF(" + port_name + "_" + name + ", " + alternate + ")" /] - [#if pinidx == 0] + [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_AFRL (" + out /] - [#elseif pinidx == 8] + [#elseif pin_index == 8] [#assign line = "#define VAL_" + port_name + "_AFRH (" + out /] [#else] [#assign line = " " + out /] [/#if] - [#if (pinidx == 7) || (pinidx == 15)] + [#if (pin_index == 7) || (pin_index == 15)] ${line + ")"} [#else] ${(line + " |")?right_pad(76, " ") + "\\"} [/#if] - [#assign pinidx = pinidx + 1 /] [/#list] [/#list] -- cgit v1.2.3 From ab4703c491d8cbc4848d43902857adcfb8768a87 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 12 Jul 2012 14:02:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4463 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/lib/libcode.ftl | 67 +- tools/gencfg/lib/libstm32f4xx.ftl | 50 +- .../boards/stm32f4xx/templates/board.h.ftl | 24 +- .../boards/stm32f4xx/templates/board.mk.ftl | 4 +- .../hal/stm32f4xx/templates/hal_cfg.c.ftl | 2 +- .../hal/stm32f4xx/templates/hal_cfg.h.ftl | 2 +- tools/gencfg/schema/boards/abstract_board.xsd | 81 +- tools/gencfg/schema/boards/stm32f4xx_board.xsd | 99 +- tools/gencfg/schema/common/doc.xsd | 111 +- tools/gencfg/schema/hal/abstract_adc_cfg.xsd | 56 +- .../schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd | 227 ++- tools/gencfg/xml/stm32f4board.xml | 1460 ++++---------------- tools/gencfg/xml/stm32f4xx_cfg.xml | 31 +- 13 files changed, 728 insertions(+), 1486 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/lib/libcode.ftl b/tools/gencfg/lib/libcode.ftl index 8147e02c4..45b94a320 100644 --- a/tools/gencfg/lib/libcode.ftl +++ b/tools/gencfg/lib/libcode.ftl @@ -31,11 +31,11 @@ [#-- -- This macro generates a brief description in DoxyGen format. --] -[#macro EmitDoxygenBrief brief=[]] - [#if brief[0]??] +[#macro EmitDoxygenBrief object=[]] + [#if object.brief[0]??] [@utils.FormatStringAsText " * @brief " " * " - utils.WithDot(brief[0]?cap_first) + utils.WithDot(object.brief[0]?cap_first) boundary /] [/#if] [/#macro] @@ -43,15 +43,70 @@ [#-- -- This macro generates a detailed description in DoxyGen format. --] -[#macro EmitDoxygenDetails details=[]] - [#if details[0]??] +[#macro EmitDoxygenDetails object=[]] + [#if object.details[0]??] [@utils.FormatStringAsText " * @details " " * " - utils.WithDot(details[0]?cap_first) + 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. --] diff --git a/tools/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl index 2a541606d..81b8f987c 100644 --- a/tools/gencfg/lib/libstm32f4xx.ftl +++ b/tools/gencfg/lib/libstm32f4xx.ftl @@ -23,51 +23,45 @@ -- Emits the STM32F4xx ADC driver constant configuration structures. --] [#macro EmitADCConfig config] - [#local cfg_name = config.@name[0]?string /] -/** - [@code.EmitDoxygenBrief config.@brief /] - [@code.EmitDoxygenDetails config.details /] - */ + [#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.EmitDoxygenBrief group.@brief /] - [@code.EmitDoxygenDetails group.details /] - */ + [#local grpcfg_name = group.name[0]?string /] + [@code.EmitDoxygenDocumentationComment group /] const ADCGroupConfig ${grpcfg_name} = { /* Circular conversion flag.*/ - ${group.@circular[0]?string?upper_case}, + ${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.@conversion_callback[0]?string?trim == ""] + [#if group.conv_callback[0]?string?trim == ""] NULL, [#else] - ${group.@conversion_callback[0]?string?trim}, + ${group.conv_callback[0]?string?trim}, [/#if] /* Error callback or NULL.*/ - [#if group.@error_callback[0]?string?trim == ""] + [#if group.error_callback[0]?string?trim == ""] NULL, [#else] - ${group.@error_callback[0]?string?trim}, + ${group.error_callback[0]?string?trim}, [/#if] /* CR1 register initialization value.*/ - [#local resolution = group.@resolution[0]?word_list[0]?number /] + [#local resolution = group.resolution[0]?word_list[0]?number /] [#local cr1 = "ADC_CR1_RESOLUTION_N(" + resolution?string + ")" /] - [#local discnum = group.@discontinuous_number[0]?word_list[0]?number /] - [#local cr1 = cr1 + " | ADC_CR1_DISCNUM_N(" + (discnum - 1)?string + ")" /] - [#if group.@discontinuous_mode[0]?string == "true"] + [#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 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 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] + [#if group.alignment[0]?word_list[0]?number != 0] [#local cr2 = cr2 + " | ADC_CR2_ALIGN" /] [/#if] ${cr2}, @@ -131,19 +125,19 @@ const ADCGroupConfig ${grpcfg_name} = { -- Emits the STM32F4xx ADC driver configuration external declarations. --] [#macro EmitADCConfigExtern config] - [#local cfg_name = config.@name[0]?string /] + [#local cfg_name = config.name[0]?string /] [#list config.groups.group as group] - [#local grpcfg_name = group.@name[0]?string /] + [#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.@conversion_callback[0]?string?trim != ""] - void ${group.@conversion_callback[0]?string?trim}(ADCDriver *, adcsample_t *, size_t); + [#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 group.error_callback[0]?string?trim != ""] + void ${group.error_callback[0]?string?trim}(ADCDriver *, adcerror_t); [/#if] [/#list] diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index dccb8782f..593b3883c 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -30,43 +30,43 @@ #define _BOARD_H_ /* - * Setup for ${doc1.board.@name[0]} board. + * Setup for ${doc1.board.board_name[0]} board. */ /* * Board identifier. */ -#define BOARD_${doc1.board.@BoardID[0]} -#define BOARD_NAME "${doc1.board.@name[0]}" +#define BOARD_${doc1.board.board_id[0]} +#define BOARD_NAME "${doc1.board.board_name[0]}" -[#if doc1.board.@BoardPHYID[0]??] +[#if doc1.board.ethernet_phy[0]??] /* * Ethernet PHY type. */ -#define BOARD_PHY_ID ${doc1.board.@BoardPHYID[0]} -[#if doc1.board.@BoardPHYType[0]?string == "RMII"] +#define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} +[#if doc1.board.ethernet_phy.type[0]?string == "RMII"] #define BOARD_PHY_RMII [/#if] [/#if] /* * Board oscillators-related settings. -[#if doc1.board.@LSEFrequency[0]?number == 0] +[#if doc1.board.clocks.@LSEFrequency[0]?number == 0] * NOTE: LSE not fitted. [/#if] -[#if doc1.board.@HSEFrequency[0]?number == 0] +[#if doc1.board.clocks.@HSEFrequency[0]?number == 0] * NOTE: HSE not fitted. [/#if] */ #if !defined(STM32_LSECLK) -#define STM32_LSECLK ${doc1.board.@LSEFrequency[0]} +#define STM32_LSECLK ${doc1.board.clocks.@LSEFrequency[0]} #endif #if !defined(STM32_HSECLK) -#define STM32_HSECLK ${doc1.board.@HSEFrequency[0]} +#define STM32_HSECLK ${doc1.board.clocks.@HSEFrequency[0]} #endif -[#if doc1.board.@HSEBypass[0]?string == "true"] +[#if doc1.board.clocks.@HSEBypass[0]?string == "true"] #define STM32_HSE_BYPASS [/#if] @@ -74,7 +74,7 @@ * Board voltages. * Required for performance limits calculation. */ -#define STM32_VDD ${doc1.board.@VDD[0]} +#define STM32_VDD ${doc1.board.clocks.@VDD[0]} /* * MCU type as defined in the ST header file stm32f4xx.h. diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl index 34804dd67..c88471ac3 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl @@ -22,7 +22,7 @@ [#import "/@lib/libutils.ftl" as utils /] [@pp.changeOutputFile name="board.mk" /] # List of all the board related files. -BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.@BoardID[0]}/board.c +BOARDSRC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]}/board.c # Required include directories -BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.@BoardID[0]} +BOARDINC = ${'$'}{CHIBIOS}/boards/${doc1.board.board_id[0]} diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl index cd8b17a01..eeea09d99 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl @@ -23,7 +23,7 @@ [#import "/@lib/liblicense.ftl" as license /] [#import "/@lib/libcode.ftl" as code /] [#import "/@lib/libstm32f4xx.ftl" as stm32f4xx /] -[#assign fname = doc1.configuration.@name[0] /] +[#assign fname = doc1.configuration.name[0] /] [@pp.changeOutputFile name = fname + ".c" /] /* [@license.EmitLicenseAsText /] diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl index 050b2f84d..47ea70f7c 100644 --- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl +++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl @@ -23,7 +23,7 @@ [#import "/@lib/liblicense.ftl" as license /] [#import "/@lib/libcode.ftl" as code /] [#import "/@lib/libstm32f4xx.ftl" as stm32f4xx /] -[#assign fname = doc1.configuration.@name[0] /] +[#assign fname = doc1.configuration.name[0] /] [@pp.changeOutputFile name = fname + ".h" /] /* [@license.EmitLicenseAsText /] diff --git a/tools/gencfg/schema/boards/abstract_board.xsd b/tools/gencfg/schema/boards/abstract_board.xsd index b3a854307..1a2c38bf2 100644 --- a/tools/gencfg/schema/boards/abstract_board.xsd +++ b/tools/gencfg/schema/boards/abstract_board.xsd @@ -5,45 +5,48 @@ - - - - - Board identifier string, it is used to - create the board files folder name and the board - identifier macro in board.h. - - - - - - - - - - - PHY identifier as defined in mii.h or empty if a PHY is not present. - - - - - - - - - - - Type of the PHY device: RMII or MII, this attribute is defaulted to MII if not present. - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/schema/boards/stm32f4xx_board.xsd b/tools/gencfg/schema/boards/stm32f4xx_board.xsd index 0b3622e6f..ace3b5acb 100644 --- a/tools/gencfg/schema/boards/stm32f4xx_board.xsd +++ b/tools/gencfg/schema/boards/stm32f4xx_board.xsd @@ -10,61 +10,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - HSE frequency or zero if not present. - - - - - - - - - - - - LSE frequency or zero if not present. - - - - - - - - + + - - - STM32F4xx VDD. - - - - - - - - - @@ -93,4 +85,5 @@ + diff --git a/tools/gencfg/schema/common/doc.xsd b/tools/gencfg/schema/common/doc.xsd index b7395605b..e5be361d5 100644 --- a/tools/gencfg/schema/common/doc.xsd +++ b/tools/gencfg/schema/common/doc.xsd @@ -4,33 +4,26 @@ - >Generic item with optional name and brief + + >Generic item with optional name and brief description - - - Object name. - - - - - - - - - - Object brief description, 72 chars max in a - single line. - - - - - - - - - + + + + Name of the object. + + + + + + + + + + + @@ -41,15 +34,73 @@ - - + + + + + Brief description of the object. + + + + + + + + + + + + + + Object documentation as text, does not preserve + formatting. + + + + + + + + + - 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/gencfg/schema/hal/abstract_adc_cfg.xsd b/tools/gencfg/schema/hal/abstract_adc_cfg.xsd index 4a2901c4e..52a6c9096 100644 --- a/tools/gencfg/schema/hal/abstract_adc_cfg.xsd +++ b/tools/gencfg/schema/hal/abstract_adc_cfg.xsd @@ -7,29 +7,37 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -37,7 +45,7 @@ - + diff --git a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd index c038263c2..331933109 100644 --- a/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd +++ b/tools/gencfg/schema/hal/stm32f4xx/stm32f4xx_adc_cfg.xsd @@ -20,34 +20,103 @@ - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -61,8 +130,7 @@ - + @@ -76,8 +144,7 @@ - + @@ -91,8 +158,7 @@ - + @@ -106,8 +172,7 @@ - + @@ -121,8 +186,7 @@ - + @@ -136,8 +200,7 @@ - + @@ -151,8 +214,7 @@ - + @@ -166,8 +228,7 @@ - + @@ -181,8 +242,7 @@ - + @@ -196,8 +256,7 @@ - + @@ -211,8 +270,7 @@ - + @@ -226,8 +284,7 @@ - + @@ -241,8 +298,7 @@ - + @@ -256,8 +312,7 @@ - + @@ -271,8 +326,7 @@ - + @@ -286,8 +340,7 @@ - + @@ -316,8 +369,7 @@ - + @@ -368,68 +420,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml index ae76505c5..dffa016c7 100644 --- a/tools/gencfg/xml/stm32f4board.xml +++ b/tools/gencfg/xml/stm32f4board.xml @@ -2,1185 +2,319 @@ - + xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd"> + -----human readable blard name----- + BOARD_IDENTIFIER + + MII_KS8721_ID + RMII + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + diff --git a/tools/gencfg/xml/stm32f4xx_cfg.xml b/tools/gencfg/xml/stm32f4xx_cfg.xml index a0ed7fbb6..896cc2614 100644 --- a/tools/gencfg/xml/stm32f4xx_cfg.xml +++ b/tools/gencfg/xml/stm32f4xx_cfg.xml @@ -1,18 +1,25 @@ -
Application HAL configurations.
+ xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/hal/stm32f4xx/stm32f4xx_cfg.xsd"> + hal_configs + Application HAL-related settings. - + + adccfg1 + Example ADC configuration. - + + adcgrpcfg1 + Example ADC conversion group configuration. + true + conv_callback + error_callback + 0 Samples are Right Aligned + 0 12 bits + 0 Software + 0 Timer 1 CC1 event + 2 Two discontinous conversions ADC_SAMPLE_3 ADC_SAMPLE_3 @@ -36,8 +43,10 @@ ADC_CHANNEL_IN0 + ADC_CHANNEL_IN8 - + +
-- cgit v1.2.3 From db9be46157550da43fbf43685a67c7a686b95e85 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 Jul 2012 18:09:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4468 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/schema/hal/abstract_cfg.xsd | 344 +++++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 tools/gencfg/schema/hal/abstract_cfg.xsd (limited to 'tools') diff --git a/tools/gencfg/schema/hal/abstract_cfg.xsd b/tools/gencfg/schema/hal/abstract_cfg.xsd new file mode 100644 index 000000000..72491eea9 --- /dev/null +++ b/tools/gencfg/schema/hal/abstract_cfg.xsd @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From bec694657d30fcf912138d490828dc6add9042c7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 17 Jul 2012 08:54:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4469 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/schema/boards/abstract_board.xsd | 52 +++++++++++++++++---------- tools/gencfg/xml/stm32f4board.xml | 1 + 2 files changed, 35 insertions(+), 18 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/schema/boards/abstract_board.xsd b/tools/gencfg/schema/boards/abstract_board.xsd index 1a2c38bf2..c4c953240 100644 --- a/tools/gencfg/schema/boards/abstract_board.xsd +++ b/tools/gencfg/schema/boards/abstract_board.xsd @@ -6,24 +6,40 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml index dffa016c7..b1f755a2f 100644 --- a/tools/gencfg/xml/stm32f4board.xml +++ b/tools/gencfg/xml/stm32f4board.xml @@ -5,6 +5,7 @@ xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd"> -----human readable blard name----- BOARD_IDENTIFIER + MII_KS8721_ID RMII -- cgit v1.2.3 From 8c7611e9cac0d3fb9d112797e1d235a25143122b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 18 Jul 2012 16:19:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4470 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/.project | 64 +++++++++++++--------- tools/gencfg/config.fmpp | 2 +- tools/gencfg/fmpp.sh | 7 +++ .../boards/stm32f4xx/templates/board.c.ftl | 27 +++++++-- .../boards/stm32f4xx/templates/board.h.ftl | 2 +- 5 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 tools/gencfg/fmpp.sh (limited to 'tools') diff --git a/tools/gencfg/.project b/tools/gencfg/.project index a112039b3..9872c4eef 100644 --- a/tools/gencfg/.project +++ b/tools/gencfg/.project @@ -1,25 +1,39 @@ - - - _Configuration Tool - - - - - - org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, - - - LaunchConfigHandle - <project>/.externalToolBuilders/FMPP Builder.launch - - - incclean - true - - - - - - - + + + _Configuration Tool + + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/FMPP Builder (Windows).launch + + + incclean + true + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/FMPP Builder (Linux).launch + + + incclean + true + + + + + + + diff --git a/tools/gencfg/config.fmpp b/tools/gencfg/config.fmpp index 9fc5a31dd..0f34b0a03 100644 --- a/tools/gencfg/config.fmpp +++ b/tools/gencfg/config.fmpp @@ -1,7 +1,7 @@ # Change the next line to point to the processor you want to use. Processors # are identified by a file named "config.fmpp" under the "processors" root # directory. -inheritConfiguration: processors/hal/stm32f4xx/config.fmpp +inheritConfiguration: processors/boards/stm32f4xx/config.fmpp # Settings common to all processors. Do not change the following lines. freemarkerLinks: { diff --git a/tools/gencfg/fmpp.sh b/tools/gencfg/fmpp.sh new file mode 100644 index 000000000..b98398702 --- /dev/null +++ b/tools/gencfg/fmpp.sh @@ -0,0 +1,7 @@ +#!/bin/bash +JAVA_HOME=/usr/lib/jvm/java-6-sun +export JAVA_HOME +PATH=$PATH:$JAVA_HOME/bin +export PATH +fmpp -C config.fmpp + diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl index 1e2a8ee95..f38fd106a 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl @@ -66,49 +66,68 @@ const PALConfig pal_default_config = 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. - * @todo Fill the implementation. */ 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. - * @todo Fill the implementation. */ 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. - * @todo Fill the implementation. */ 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. - * @todo Fill the implementation. */ 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 diff --git a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl index 593b3883c..c24c0a355 100644 --- a/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl +++ b/tools/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -44,7 +44,7 @@ * Ethernet PHY type. */ #define BOARD_PHY_ID ${doc1.board.ethernet_phy.identifier[0]} -[#if doc1.board.ethernet_phy.type[0]?string == "RMII"] +[#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] #define BOARD_PHY_RMII [/#if] [/#if] -- cgit v1.2.3 From 5eb882bc39755b6402f19bc208b44c48c6d2572e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 22 Jul 2012 08:04:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4472 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/.externalToolBuilders/FMPP Builder (Linux).launch | 10 ++++++++++ .../gencfg/.externalToolBuilders/FMPP Builder (Windows).launch | 10 ++++++++++ tools/gencfg/.externalToolBuilders/FMPP Builder.launch | 9 --------- 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tools/gencfg/.externalToolBuilders/FMPP Builder (Linux).launch create mode 100644 tools/gencfg/.externalToolBuilders/FMPP Builder (Windows).launch delete mode 100644 tools/gencfg/.externalToolBuilders/FMPP Builder.launch (limited to 'tools') diff --git a/tools/gencfg/.externalToolBuilders/FMPP Builder (Linux).launch b/tools/gencfg/.externalToolBuilders/FMPP Builder (Linux).launch new file mode 100644 index 000000000..0a4fc898b --- /dev/null +++ b/tools/gencfg/.externalToolBuilders/FMPP Builder (Linux).launch @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/gencfg/.externalToolBuilders/FMPP Builder (Windows).launch b/tools/gencfg/.externalToolBuilders/FMPP Builder (Windows).launch new file mode 100644 index 000000000..abf46ff08 --- /dev/null +++ b/tools/gencfg/.externalToolBuilders/FMPP Builder (Windows).launch @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/gencfg/.externalToolBuilders/FMPP Builder.launch b/tools/gencfg/.externalToolBuilders/FMPP Builder.launch deleted file mode 100644 index 266ef7bdc..000000000 --- a/tools/gencfg/.externalToolBuilders/FMPP Builder.launch +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - -- cgit v1.2.3 From e737b65a33a0d27d9c9dfbac26ab3151b482ddd4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 2 Aug 2012 14:23:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4495 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/processors.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tools/gencfg/processors/processors.xml (limited to 'tools') diff --git a/tools/gencfg/processors/processors.xml b/tools/gencfg/processors/processors.xml new file mode 100644 index 000000000..e0dd4efe4 --- /dev/null +++ b/tools/gencfg/processors/processors.xml @@ -0,0 +1,16 @@ + + + STM32F4xx Board Configuration + resources/gencfg/processors/boards/stm32f4xx + resources/gencfg/xml/stm32f4board.xml + board + . + + + STM32F0xx Board Configuration + resources/gencfg/processors/boards/stm32f0xx + resources/gencfg/xml/stm32f0board.xml + board + . + + -- cgit v1.2.3 From fa1a63ceb20bd310a845d889fc1eec393fdfd47f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 3 Aug 2012 16:19:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4498 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/processors.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/processors.xml b/tools/gencfg/processors/processors.xml index e0dd4efe4..0b582bbe2 100644 --- a/tools/gencfg/processors/processors.xml +++ b/tools/gencfg/processors/processors.xml @@ -1,14 +1,14 @@ STM32F4xx Board Configuration - resources/gencfg/processors/boards/stm32f4xx + resources/gencfg/processors/boards/stm32f4xx/templates resources/gencfg/xml/stm32f4board.xml board . STM32F0xx Board Configuration - resources/gencfg/processors/boards/stm32f0xx + resources/gencfg/processors/boards/stm32f0xx/templates resources/gencfg/xml/stm32f0board.xml board . -- cgit v1.2.3 From b43e91d43be2e7ccb3d8ea41dc6ce783580d9cdb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 07:48:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4500 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/processors/processors.xml | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/processors/processors.xml b/tools/gencfg/processors/processors.xml index 0b582bbe2..cac95cc23 100644 --- a/tools/gencfg/processors/processors.xml +++ b/tools/gencfg/processors/processors.xml @@ -4,13 +4,11 @@ resources/gencfg/processors/boards/stm32f4xx/templates resources/gencfg/xml/stm32f4board.xml board - . STM32F0xx Board Configuration resources/gencfg/processors/boards/stm32f0xx/templates resources/gencfg/xml/stm32f0board.xml board - . -- cgit v1.2.3 From fda34884b648bcc1eacc81c7e61904c308545ceb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 15:54:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4506 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 | 21 ++ .../bin/config_wizard/Activator.class | Bin 0 -> 1158 bytes .../eclipse/config/handlers/CheckDescription.class | Bin 0 -> 1217 bytes .../eclipse/config/handlers/GenerateFiles.class | Bin 0 -> 4350 bytes .../eclipse/config/utils/TemplateEngine$1.class | Bin 0 -> 1694 bytes .../eclipse/config/utils/TemplateEngine.class | Bin 0 -> 6309 bytes .../eclipse/config/utils/TemplateException.class | Bin 0 -> 481 bytes .../config/wizards/ConfigurationNewWizard$1.class | Bin 0 -> 1489 bytes .../config/wizards/ConfigurationNewWizard$2.class | Bin 0 -> 1610 bytes .../config/wizards/ConfigurationNewWizard.class | Bin 0 -> 7930 bytes .../wizards/ConfigurationNewWizardPage$1.class | Bin 0 -> 1008 bytes .../wizards/ConfigurationNewWizardPage$2.class | Bin 0 -> 1008 bytes .../wizards/ConfigurationNewWizardPage$3.class | Bin 0 -> 1816 bytes .../wizards/ConfigurationNewWizardPage$4.class | Bin 0 -> 1008 bytes .../wizards/ConfigurationNewWizardPage.class | Bin 0 -> 10577 bytes tools/eclipse/config_wizard/build.properties | 39 +++ tools/eclipse/config_wizard/icons/check.gif | Bin 0 -> 591 bytes tools/eclipse/config_wizard/icons/chibios.gif | Bin 0 -> 581 bytes tools/eclipse/config_wizard/icons/generate.gif | Bin 0 -> 378 bytes tools/eclipse/config_wizard/icons/sample.gif | Bin 0 -> 983 bytes tools/eclipse/config_wizard/lib/bsh.jar | Bin 0 -> 281694 bytes tools/eclipse/config_wizard/lib/fmpp.jar | Bin 0 -> 314020 bytes tools/eclipse/config_wizard/lib/freemarker.jar | Bin 0 -> 931168 bytes tools/eclipse/config_wizard/lib/jdom-2.0.2.jar | Bin 0 -> 295355 bytes tools/eclipse/config_wizard/lib/oro.jar | Bin 0 -> 65261 bytes tools/eclipse/config_wizard/lib/resolver.jar | Bin 0 -> 60047 bytes tools/eclipse/config_wizard/plugin.xml | 165 +++++++++ .../config_wizard/resources/gencfg/lib/libcode.ftl | 316 ++++++++++++++++++ .../resources/gencfg/lib/liblicense.ftl | 58 ++++ .../resources/gencfg/lib/libstm32f4xx.ftl | 144 ++++++++ .../resources/gencfg/lib/libutils.ftl | 109 ++++++ .../gencfg/processors/boards/stm32f4xx/config.fmpp | 5 + .../boards/stm32f4xx/templates/board.c.ftl | 139 ++++++++ .../boards/stm32f4xx/templates/board.h.ftl | 327 ++++++++++++++++++ .../boards/stm32f4xx/templates/board.mk.ftl | 28 ++ .../resources/gencfg/processors/processors.xml | 8 + .../gencfg/schema/boards/abstract_board.xsd | 68 ++++ .../gencfg/schema/boards/stm32f4xx_board.xsd | 89 +++++ .../resources/gencfg/schema/common/doc.xsd | 108 ++++++ .../schema/common/stm32/stm32_gpiov2_port.xsd | 214 ++++++++++++ .../resources/gencfg/xml/stm32f4board.xml | 321 ++++++++++++++++++ .../config_wizard/src/config_wizard/Activator.java | 88 +++++ .../eclipse/config/handlers/CheckDescription.java | 54 +++ .../eclipse/config/handlers/GenerateFiles.java | 141 ++++++++ .../tools/eclipse/config/utils/TemplateEngine.java | 213 ++++++++++++ .../eclipse/config/utils/TemplateException.java | 30 ++ .../config/wizards/ConfigurationNewWizard.java | 221 ++++++++++++ .../config/wizards/ConfigurationNewWizardPage.java | 371 +++++++++++++++++++++ 51 files changed, 3326 insertions(+) create mode 100644 tools/eclipse/config_wizard/.classpath create mode 100644 tools/eclipse/config_wizard/.project create mode 100644 tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs create mode 100644 tools/eclipse/config_wizard/META-INF/MANIFEST.MF create mode 100644 tools/eclipse/config_wizard/bin/config_wizard/Activator.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class create mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class create mode 100644 tools/eclipse/config_wizard/build.properties create mode 100644 tools/eclipse/config_wizard/icons/check.gif create mode 100644 tools/eclipse/config_wizard/icons/chibios.gif create mode 100644 tools/eclipse/config_wizard/icons/generate.gif create mode 100644 tools/eclipse/config_wizard/icons/sample.gif create mode 100644 tools/eclipse/config_wizard/lib/bsh.jar create mode 100644 tools/eclipse/config_wizard/lib/fmpp.jar create mode 100644 tools/eclipse/config_wizard/lib/freemarker.jar create mode 100644 tools/eclipse/config_wizard/lib/jdom-2.0.2.jar create mode 100644 tools/eclipse/config_wizard/lib/oro.jar create mode 100644 tools/eclipse/config_wizard/lib/resolver.jar create mode 100644 tools/eclipse/config_wizard/plugin.xml create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml create mode 100644 tools/eclipse/config_wizard/src/config_wizard/Activator.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java (limited to 'tools') diff --git a/tools/eclipse/config_wizard/.classpath b/tools/eclipse/config_wizard/.classpath new file mode 100644 index 000000000..232d040e3 --- /dev/null +++ b/tools/eclipse/config_wizard/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/.project b/tools/eclipse/config_wizard/.project new file mode 100644 index 000000000..7df6fc0f9 --- /dev/null +++ b/tools/eclipse/config_wizard/.project @@ -0,0 +1,28 @@ + + + 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 new file mode 100644 index 000000000..da0e3846d --- /dev/null +++ b/tools/eclipse/config_wizard/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 000000000..1eb0a3bef --- /dev/null +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +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.0.0 +Bundle-Activator: config_wizard.Activator +Require-Bundle: org.eclipse.core.resources, + org.eclipse.core.runtime, + org.eclipse.ui, + org.eclipse.ui.console;bundle-version="3.5.100", + org.eclipse.ui.ide +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Vendor: CHIBIOS +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/bin/config_wizard/Activator.class b/tools/eclipse/config_wizard/bin/config_wizard/Activator.class new file mode 100644 index 000000000..4acd9e4d3 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/config_wizard/Activator.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class new file mode 100644 index 000000000..649096ab1 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class new file mode 100644 index 000000000..dc686d354 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class new file mode 100644 index 000000000..fdd9954c2 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class new file mode 100644 index 000000000..c50929ac5 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class new file mode 100644 index 000000000..f374c70da Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class new file mode 100644 index 000000000..52ee47c3a Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class new file mode 100644 index 000000000..0f52f0daf Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class new file mode 100644 index 000000000..723ab1ed0 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class new file mode 100644 index 000000000..58d9625eb Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class new file mode 100644 index 000000000..e35befef7 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class new file mode 100644 index 000000000..50fab6cee Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class new file mode 100644 index 000000000..8bac428cc Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class new file mode 100644 index 000000000..09a6fa2c0 Binary files /dev/null and b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class differ diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties new file mode 100644 index 000000000..cc671117e --- /dev/null +++ b/tools/eclipse/config_wizard/build.properties @@ -0,0 +1,39 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + resources/,\ + lib/bsh.jar,\ + lib/fmpp.jar,\ + lib/freemarker.jar,\ + lib/oro.jar,\ + lib/resolver.jar,\ + lib/jdom-2.0.2.jar +bin.excludes = resources/.svn/,\ + resources/gencfg/.svn/,\ + resources/gencfg/.project,\ + resources/gencfg/.externalToolBuilders/,\ + resources/gencfg/config.fmpp,\ + resources/gencfg/fmpp.sh,\ + resources/gencfg/run.bat,\ + resources/gencfg/readme.txt,\ + resources/gencfg/schema/.svn/,\ + resources/gencfg/schema/boards/.svn/,\ + resources/gencfg/schema/common/.svn/,\ + resources/gencfg/schema/hal/.svn/,\ + resources/gencfg/schema/hal/stm32f4xx/.svn/,\ + resources/gencfg/schema/common/stm32/.svn/,\ + resources/gencfg/processors/.svn/,\ + resources/gencfg/processors/boards/.svn/,\ + resources/gencfg/processors/hal/.svn/,\ + resources/gencfg/processors/boards/stm32f4xx/.svn/,\ + resources/gencfg/processors/boards/stm32f4xx/input/,\ + resources/gencfg/processors/boards/stm32f4xx/output/,\ + resources/gencfg/processors/boards/stm32f4xx/templates/.svn/,\ + resources/gencfg/processors/boards/stm32f4xx/config.fmpp,\ + resources/gencfg/processors/hal/stm32f4xx/.svn/,\ + resources/gencfg/processors/hal/stm32f4xx/config.fmpp,\ + resources/gencfg/processors/hal/stm32f4xx/input/,\ + resources/gencfg/processors/hal/stm32f4xx/output/,\ + resources/gencfg/processors/hal/stm32f4xx/templates/.svn/ diff --git a/tools/eclipse/config_wizard/icons/check.gif b/tools/eclipse/config_wizard/icons/check.gif new file mode 100644 index 000000000..18ffabe77 Binary files /dev/null and b/tools/eclipse/config_wizard/icons/check.gif differ diff --git a/tools/eclipse/config_wizard/icons/chibios.gif b/tools/eclipse/config_wizard/icons/chibios.gif new file mode 100644 index 000000000..ddbf1e1d1 Binary files /dev/null and b/tools/eclipse/config_wizard/icons/chibios.gif differ diff --git a/tools/eclipse/config_wizard/icons/generate.gif b/tools/eclipse/config_wizard/icons/generate.gif new file mode 100644 index 000000000..55e2d04ad Binary files /dev/null and b/tools/eclipse/config_wizard/icons/generate.gif differ diff --git a/tools/eclipse/config_wizard/icons/sample.gif b/tools/eclipse/config_wizard/icons/sample.gif new file mode 100644 index 000000000..34fb3c9d8 Binary files /dev/null and b/tools/eclipse/config_wizard/icons/sample.gif differ diff --git a/tools/eclipse/config_wizard/lib/bsh.jar b/tools/eclipse/config_wizard/lib/bsh.jar new file mode 100644 index 000000000..36fe03d71 Binary files /dev/null and b/tools/eclipse/config_wizard/lib/bsh.jar differ diff --git a/tools/eclipse/config_wizard/lib/fmpp.jar b/tools/eclipse/config_wizard/lib/fmpp.jar new file mode 100644 index 000000000..8cb8e6262 Binary files /dev/null and b/tools/eclipse/config_wizard/lib/fmpp.jar differ diff --git a/tools/eclipse/config_wizard/lib/freemarker.jar b/tools/eclipse/config_wizard/lib/freemarker.jar new file mode 100644 index 000000000..b13671dac Binary files /dev/null and b/tools/eclipse/config_wizard/lib/freemarker.jar 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 new file mode 100644 index 000000000..d540bad66 Binary files /dev/null and b/tools/eclipse/config_wizard/lib/jdom-2.0.2.jar differ diff --git a/tools/eclipse/config_wizard/lib/oro.jar b/tools/eclipse/config_wizard/lib/oro.jar new file mode 100644 index 000000000..23488d260 Binary files /dev/null and b/tools/eclipse/config_wizard/lib/oro.jar differ diff --git a/tools/eclipse/config_wizard/lib/resolver.jar b/tools/eclipse/config_wizard/lib/resolver.jar new file mode 100644 index 000000000..073d78967 Binary files /dev/null and b/tools/eclipse/config_wizard/lib/resolver.jar differ diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml new file mode 100644 index 000000000..e2163c8fb --- /dev/null +++ b/tools/eclipse/config_wizard/plugin.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl new file mode 100644 index 000000000..45b94a320 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/libcode.ftl @@ -0,0 +1,316 @@ +[#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 new file mode 100644 index 000000000..18581ee29 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/liblicense.ftl @@ -0,0 +1,58 @@ +[#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/libstm32f4xx.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl new file mode 100644 index 000000000..81b8f987c --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/libstm32f4xx.ftl @@ -0,0 +1,144 @@ +[#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 new file mode 100644 index 000000000..03b0622a3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/libutils.ftl @@ -0,0 +1,109 @@ +[#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/stm32f4xx/config.fmpp b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp new file mode 100644 index 000000000..970d936ca --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp @@ -0,0 +1,5 @@ +sourceRoot: templates +outputRoot: output +data: { + doc1: xml(../input/stm32f4board.xml) +} 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 new file mode 100644 index 000000000..f38fd106a --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl @@ -0,0 +1,139 @@ +[#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 new file mode 100644 index 000000000..c24c0a355 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl @@ -0,0 +1,327 @@ +[#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 new file mode 100644 index 000000000..c88471ac3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl @@ -0,0 +1,28 @@ +[#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 new file mode 100644 index 000000000..e044f903d --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml @@ -0,0 +1,8 @@ + + + STM32F4xx Board Configuration + resources/gencfg/processors/boards/stm32f4xx/templates + resources/gencfg/xml/stm32f4board.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 new file mode 100644 index 000000000..c4c953240 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000..ace3b5acb --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd new file mode 100644 index 000000000..e5be361d5 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/common/doc.xsd @@ -0,0 +1,108 @@ + + + + + + + >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 new file mode 100644 index 000000000..c3ac59487 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/stm32f4board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml new file mode 100644 index 000000000..b1f755a2f --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml @@ -0,0 +1,321 @@ + + + + -----human readable blard name----- + BOARD_IDENTIFIER + + + MII_KS8721_ID + RMII + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/src/config_wizard/Activator.java b/tools/eclipse/config_wizard/src/config_wizard/Activator.java new file mode 100644 index 000000000..1f62c4f62 --- /dev/null +++ b/tools/eclipse/config_wizard/src/config_wizard/Activator.java @@ -0,0 +1,88 @@ +/* + 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 new file mode 100644 index 000000000..f9e8cd6bf --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java @@ -0,0 +1,54 @@ +/* + 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 new file mode 100644 index 000000000..e10d4c667 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -0,0 +1,141 @@ +/* + 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.FileReader; +import java.io.IOException; +import java.util.Properties; + +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.IFile; +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.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(); + + /* Determines the base path as the parent of the configuration file.*/ + IPath basepath = cfgfilepath.removeLastSegments(1); + + /* Reads the configuration file into a Properties object. */ + Properties cfgfile = new Properties(); + try { + cfgfile.load(new FileReader(cfgfilepath.toFile())); + } catch (IOException e) { + MessageDialog.openInformation(window.getShell(), "I/O Error", + e.getMessage()); + return null; + } + + /* Retrieves source property. */ + String source = cfgfile.getProperty("source"); + if (source == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"source\" not found in configuration file."); + return null; + } + + /* Retrieves xmlfile property. */ + String xmlfile = cfgfile.getProperty("xmlfile"); + if (xmlfile == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"xmlfile\" not found in configuration file."); + return null; + } + + /* Retrieves output property. */ + String output = cfgfile.getProperty("output"); + if (output == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"output\" not found in configuration file."); + return null; + } + + /* Calculating derived paths. */ + IPath sourcepath = new Path(source); + IPath libpath = new Path("resources/gencfg/lib"); + try { + Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); + sourcepath = new Path(FileLocator.toFileURL( + FileLocator.find(bundle, sourcepath, null)).getFile()); + libpath = new Path(FileLocator.toFileURL( + FileLocator.find(bundle, libpath, null)).getFile()); + } catch (IOException e) { + MessageDialog.openInformation(window.getShell(), "Path Error", + e.getMessage()); + return null; + } + + /* Templates execution. */ + try { + TemplateEngine.process(basepath.addTrailingSeparator().append(xmlfile) + .toFile(), libpath.toFile(), sourcepath.toFile(), + basepath.toFile(), new File(output)); + } catch (TemplateException e) { + MessageDialog.openInformation(window.getShell(), "Processing Error", + e.getMessage()); + return null; + } + } + return null; + } +} 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 new file mode 100644 index 000000000..6c2771d9f --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -0,0 +1,213 @@ +/* + 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.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.w3c.dom.Document; +import org.xml.sax.SAXException; + +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 static final String CONSOLE_NAME = "ChibiOS/RT Configuration Tool"; + + private static Settings settings; + private static MessageConsoleStream out; + + /** + * Runs the templates engine. + * + * @param xmldata + * absolute path to XML data file + * @param libdir + * absolute path to libraries directory + * @param sourcedir + * absolute path to templates directory + * @param basedir + * absolute path to project directory + * @param outputdir + * output directory relative to basedir + * + * @throws SettingException + * @throws ProcessingException + */ + public static void process(java.io.File xmldata, java.io.File libdir, + java.io.File sourcedir, java.io.File basedir, + java.io.File outputdir) throws TemplateException { + + /* Finds or creates a named console. */ + MessageConsole console = findConsole(CONSOLE_NAME); + activateConsole(console); + console.clearConsole(); + out = console.newMessageStream(); + + /* + * Instantiates the FMPP Settings engine and associates a listener for + * events to be logged. + */ + try { + settings = new Settings(basedir); + } 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 (pMode == Engine.PMODE_IGNORE) + return; + + switch (event) { + case EVENT_BEGIN_PROCESSING_SESSION: + out.println("Starting session"); + break; + case EVENT_END_PROCESSING_SESSION: + out.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: + out.println("Warning:" + (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; + try { + dom1 = db.parse(xmldata); + } catch (SAXException e) { + throw new TemplateException(e.getMessage()); + } catch (IOException e) { + throw new TemplateException(e.getMessage()); + } + + NodeModel.removeComments(dom1); + NodeModel.mergeAdjacentText(dom1); + TemplateNodeModel doc1 = NodeModel.wrap(dom1); + + HashMap xmls = new HashMap(); + xmls.put("doc1", doc1); + + /* Setting libraries path. */ + HashMap libs = new HashMap(); + libs.put("lib", libdir.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 new file mode 100644 index 000000000..73746de1d --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java @@ -0,0 +1,30 @@ +/* + 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 new file mode 100644 index 000000000..51002d5e6 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java @@ -0,0 +1,221 @@ +/* + 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 dataFileName; + private String templatesPath; + private String outputDirName; + 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(); + dataFileName = page.getDataFileName(); + templatesPath = page.getTemplatesPath(); + outputDirName = page.getOutputDirName(); + 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)); + try { + InputStream stream = openProjectContentStream(templatesPath, + dataFileName, + outputDirName); + 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, creates the XML data file.*/ + final IFile dataFile = container.getFile(new Path(dataFileName)); + 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 (dataFile.exists()) { + dataFile.setContents(stream, true, true, monitor); + } else { + dataFile.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); + } + + /** + * We will initialize file contents with a sample text. + */ + private InputStream openProjectContentStream(String templatesPath, + String dataFileName, + String outputDirName) { + + String contents = "# Automatically generated configuration project file.\n\n" + + "# Templates path in the configuration plugin resources, do not modify.\n" + + "source=" + templatesPath + "\n\n" + + "# XML configuration data file path relative to this configuration file.\n" + + "xmlfile=" + dataFileName + "\n\n" + + "# Output directory path relative to directory containing this configuration\n" + + "# file.\n" + + "output=" + outputDirName + "\n"; + return new ByteArrayInputStream(contents.getBytes()); + } + + 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 new file mode 100644 index 000000000..599c17af0 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java @@ -0,0 +1,371 @@ +/* + 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.resources.IWorkspaceRoot; +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.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 currentTemplatesPath; + private String currentDefaultDataFile; + + private Composite container; + private Combo configurationTemplatesCombo; + private Text confProjectFilenameText; + private Text confDataFilenameText; + private Text confOutputDirectoryText; + + /** + * Constructor for SampleNewWizardPage. + * + * @param pageName + */ + 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) + */ + 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(); + } + }); + + Label lbl3 = new Label(container, SWT.NONE); + lbl3.setText("Configuration data filename:"); + + confDataFilenameText = new Text(container, SWT.BORDER); + confDataFilenameText.setText("config.chxml"); + confDataFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, + false, 1, 1)); + confDataFilenameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + confDataFilenameUpdated(); + } + }); + + Label lbl4 = new Label(container, SWT.NONE); + lbl4.setText("Configuration output directory:"); + + confOutputDirectoryText = new Text(container, SWT.BORDER); + confOutputDirectoryText.setText("."); + confOutputDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, + true, false, 1, 1)); + + /* 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")); + confDataFilenameText.setText(basefilename.concat(".chxml")); + currentTemplatesPath = processor.getChildText("path"); + currentDefaultDataFile = processor.getChildText("default"); + } + }); + confOutputDirectoryText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + confOutputDirectoryUpdated(); + } + }); + + populateWizardPanel(); + initialize(); + setControl(container); + } + + public String getContainerName() { + + return resourceContainer.getFullPath().toString(); + } + + public String getProjectFileName() { + + return confProjectFilenameText.getText(); + } + + public String getDataFileName() { + + return confDataFilenameText.getText(); + } + + public String getOutputDirName() { + + return confOutputDirectoryText.getText(); + } + + public String getTemplatesPath() { + + return currentTemplatesPath; + } + + 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."); + } + } + + /** + * Fills the wizard configuration panel from XML data. + * + * @param configurationTemplateCombo + * the combo box to be populated + */ + private void populateWizardPanel() { + String fpath; + + /* Retrieving the resource path of the processors.xml file. */ + 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); + } + + /** + * Checks the content of the confProjectFilenameText field. + */ + private void confDataFilenameUpdated() { + String fileName = getDataFileName(); + + 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("chxml") == false) { + updateStatus("Configuration project filename extension must be \"chxml\""); + return; + } + } + updateStatus(null); + } + + /** + * Checks the content of the confOutputDirectoryText field. + */ + private void confOutputDirectoryUpdated() { + + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IPath outputPath = resourceContainer.getFullPath().addTrailingSeparator() + .append(getOutputDirName()); + IResource outputContainer = root.findMember(outputPath); + + if (outputContainer == null) { + updateStatus("The directory must exists"); + return; + } + if (!(outputContainer instanceof IContainer)) { + updateStatus("A directory must be specified"); + 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); + } +} -- cgit v1.2.3 From 203ab473817422ec520360a29cb62ba2db6fd7f1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 15:55:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4507 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../config_wizard/bin/config_wizard/Activator.class | Bin 1158 -> 0 bytes .../eclipse/config/handlers/CheckDescription.class | Bin 1217 -> 0 bytes .../tools/eclipse/config/handlers/GenerateFiles.class | Bin 4350 -> 0 bytes .../tools/eclipse/config/utils/TemplateEngine$1.class | Bin 1694 -> 0 bytes .../tools/eclipse/config/utils/TemplateEngine.class | Bin 6309 -> 0 bytes .../tools/eclipse/config/utils/TemplateException.class | Bin 481 -> 0 bytes .../config/wizards/ConfigurationNewWizard$1.class | Bin 1489 -> 0 bytes .../config/wizards/ConfigurationNewWizard$2.class | Bin 1610 -> 0 bytes .../eclipse/config/wizards/ConfigurationNewWizard.class | Bin 7930 -> 0 bytes .../config/wizards/ConfigurationNewWizardPage$1.class | Bin 1008 -> 0 bytes .../config/wizards/ConfigurationNewWizardPage$2.class | Bin 1008 -> 0 bytes .../config/wizards/ConfigurationNewWizardPage$3.class | Bin 1816 -> 0 bytes .../config/wizards/ConfigurationNewWizardPage$4.class | Bin 1008 -> 0 bytes .../config/wizards/ConfigurationNewWizardPage.class | Bin 10577 -> 0 bytes 14 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/config_wizard/bin/config_wizard/Activator.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class delete mode 100644 tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class (limited to 'tools') diff --git a/tools/eclipse/config_wizard/bin/config_wizard/Activator.class b/tools/eclipse/config_wizard/bin/config_wizard/Activator.class deleted file mode 100644 index 4acd9e4d3..000000000 Binary files a/tools/eclipse/config_wizard/bin/config_wizard/Activator.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class deleted file mode 100644 index 649096ab1..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/CheckDescription.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class deleted file mode 100644 index dc686d354..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/handlers/GenerateFiles.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class deleted file mode 100644 index fdd9954c2..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine$1.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class deleted file mode 100644 index c50929ac5..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateEngine.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class deleted file mode 100644 index f374c70da..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/utils/TemplateException.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class deleted file mode 100644 index 52ee47c3a..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$1.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class deleted file mode 100644 index 0f52f0daf..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard$2.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class deleted file mode 100644 index 723ab1ed0..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class deleted file mode 100644 index 58d9625eb..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$1.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class deleted file mode 100644 index e35befef7..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$2.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class deleted file mode 100644 index 50fab6cee..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$3.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class deleted file mode 100644 index 8bac428cc..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage$4.class and /dev/null differ diff --git a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class b/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class deleted file mode 100644 index 09a6fa2c0..000000000 Binary files a/tools/eclipse/config_wizard/bin/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.class and /dev/null differ -- cgit v1.2.3 From 31a2a3fdc6d693dc0be6e166b2809b0399b96865 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 16:13:49 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4510 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../resources/gencfg/processors/boards/stm32f4xx/config.fmpp | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp deleted file mode 100644 index 970d936ca..000000000 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f4xx/config.fmpp +++ /dev/null @@ -1,5 +0,0 @@ -sourceRoot: templates -outputRoot: output -data: { - doc1: xml(../input/stm32f4board.xml) -} -- cgit v1.2.3 From 8f81ae825058519dd5fffa2dab5105ace04c255d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 16:23:27 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4511 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/build.properties | 44 +++++++-------------- .../org.chibios.tools.eclipse.config_1.0.0.jar | Bin 0 -> 1838706 bytes 2 files changed, 15 insertions(+), 29 deletions(-) create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar (limited to 'tools') diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties index cc671117e..832268812 100644 --- a/tools/eclipse/config_wizard/build.properties +++ b/tools/eclipse/config_wizard/build.properties @@ -3,37 +3,23 @@ output.. = bin/ bin.includes = plugin.xml,\ META-INF/,\ .,\ - resources/,\ lib/bsh.jar,\ lib/fmpp.jar,\ lib/freemarker.jar,\ lib/oro.jar,\ lib/resolver.jar,\ - lib/jdom-2.0.2.jar -bin.excludes = resources/.svn/,\ - resources/gencfg/.svn/,\ - resources/gencfg/.project,\ - resources/gencfg/.externalToolBuilders/,\ - resources/gencfg/config.fmpp,\ - resources/gencfg/fmpp.sh,\ - resources/gencfg/run.bat,\ - resources/gencfg/readme.txt,\ - resources/gencfg/schema/.svn/,\ - resources/gencfg/schema/boards/.svn/,\ - resources/gencfg/schema/common/.svn/,\ - resources/gencfg/schema/hal/.svn/,\ - resources/gencfg/schema/hal/stm32f4xx/.svn/,\ - resources/gencfg/schema/common/stm32/.svn/,\ - resources/gencfg/processors/.svn/,\ - resources/gencfg/processors/boards/.svn/,\ - resources/gencfg/processors/hal/.svn/,\ - resources/gencfg/processors/boards/stm32f4xx/.svn/,\ - resources/gencfg/processors/boards/stm32f4xx/input/,\ - resources/gencfg/processors/boards/stm32f4xx/output/,\ - resources/gencfg/processors/boards/stm32f4xx/templates/.svn/,\ - resources/gencfg/processors/boards/stm32f4xx/config.fmpp,\ - resources/gencfg/processors/hal/stm32f4xx/.svn/,\ - resources/gencfg/processors/hal/stm32f4xx/config.fmpp,\ - resources/gencfg/processors/hal/stm32f4xx/input/,\ - resources/gencfg/processors/hal/stm32f4xx/output/,\ - resources/gencfg/processors/hal/stm32f4xx/templates/.svn/ + lib/jdom-2.0.2.jar,\ + resources/gencfg/lib/libcode.ftl,\ + resources/gencfg/lib/liblicense.ftl,\ + resources/gencfg/lib/libstm32f4xx.ftl,\ + resources/gencfg/lib/libutils.ftl,\ + resources/gencfg/processors/processors.xml,\ + resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl,\ + resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl,\ + resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl,\ + resources/gencfg/schema/boards/abstract_board.xsd,\ + resources/gencfg/schema/boards/stm32f4xx_board.xsd,\ + resources/gencfg/schema/common/doc.xsd,\ + resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd,\ + resources/gencfg/xml/stm32f4board.xml,\ + icons/ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar new file mode 100644 index 000000000..93947774a Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar differ -- cgit v1.2.3 From 7c88a3a468c960ae5fb6c2659354429e66820f8b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 18:06:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4512 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../org/chibios/tools/eclipse/config/handlers/GenerateFiles.java | 4 ++++ .../tools/eclipse/config/wizards/ConfigurationNewWizard.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java index e10d4c667..af100f9fb 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -30,7 +30,11 @@ 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.IFolder; +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; 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 index 51002d5e6..e6c309b43 100644 --- 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 @@ -133,7 +133,7 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { throwCoreException("Container \"" + containerName + "\" does not exist."); } IContainer container = (IContainer)resource; - monitor.beginTask("Creating " + projectFileName, 3); + monitor.beginTask("Creating " + projectFileName, 4); /* Step #1, creates the project file.*/ final IFile projectFile = container.getFile(new Path(projectFileName)); @@ -182,6 +182,10 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { } }); monitor.worked(1); + + /* Step #4, refreshing local resources.*/ + container.refreshLocal(IResource.DEPTH_INFINITE, monitor); + monitor.worked(1); } /** -- cgit v1.2.3 From ff7297b3bfd411e48b3134b5c0bf60e51fce6688 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 18:07:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4513 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../config_wizard/src/config_wizard/Activator.java | 88 ----- .../eclipse/config/handlers/CheckDescription.java | 54 --- .../eclipse/config/handlers/GenerateFiles.java | 145 -------- .../tools/eclipse/config/utils/TemplateEngine.java | 213 ------------ .../eclipse/config/utils/TemplateException.java | 30 -- .../config/wizards/ConfigurationNewWizard.java | 225 ------------- .../config/wizards/ConfigurationNewWizardPage.java | 371 --------------------- 7 files changed, 1126 deletions(-) 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/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 (limited to 'tools') 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 f9e8cd6bf..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java +++ /dev/null @@ -1,54 +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 af100f9fb..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ /dev/null @@ -1,145 +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.FileReader; -import java.io.IOException; -import java.util.Properties; - -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.IFolder; -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.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(); - - /* Determines the base path as the parent of the configuration file.*/ - IPath basepath = cfgfilepath.removeLastSegments(1); - - /* Reads the configuration file into a Properties object. */ - Properties cfgfile = new Properties(); - try { - cfgfile.load(new FileReader(cfgfilepath.toFile())); - } catch (IOException e) { - MessageDialog.openInformation(window.getShell(), "I/O Error", - e.getMessage()); - return null; - } - - /* Retrieves source property. */ - String source = cfgfile.getProperty("source"); - if (source == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"source\" not found in configuration file."); - return null; - } - - /* Retrieves xmlfile property. */ - String xmlfile = cfgfile.getProperty("xmlfile"); - if (xmlfile == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"xmlfile\" not found in configuration file."); - return null; - } - - /* Retrieves output property. */ - String output = cfgfile.getProperty("output"); - if (output == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"output\" not found in configuration file."); - return null; - } - - /* Calculating derived paths. */ - IPath sourcepath = new Path(source); - IPath libpath = new Path("resources/gencfg/lib"); - try { - Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - sourcepath = new Path(FileLocator.toFileURL( - FileLocator.find(bundle, sourcepath, null)).getFile()); - libpath = new Path(FileLocator.toFileURL( - FileLocator.find(bundle, libpath, null)).getFile()); - } catch (IOException e) { - MessageDialog.openInformation(window.getShell(), "Path Error", - e.getMessage()); - return null; - } - - /* Templates execution. */ - try { - TemplateEngine.process(basepath.addTrailingSeparator().append(xmlfile) - .toFile(), libpath.toFile(), sourcepath.toFile(), - basepath.toFile(), new File(output)); - } catch (TemplateException e) { - MessageDialog.openInformation(window.getShell(), "Processing Error", - e.getMessage()); - return null; - } - } - return null; - } -} 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 6c2771d9f..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ /dev/null @@ -1,213 +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.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.w3c.dom.Document; -import org.xml.sax.SAXException; - -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 static final String CONSOLE_NAME = "ChibiOS/RT Configuration Tool"; - - private static Settings settings; - private static MessageConsoleStream out; - - /** - * Runs the templates engine. - * - * @param xmldata - * absolute path to XML data file - * @param libdir - * absolute path to libraries directory - * @param sourcedir - * absolute path to templates directory - * @param basedir - * absolute path to project directory - * @param outputdir - * output directory relative to basedir - * - * @throws SettingException - * @throws ProcessingException - */ - public static void process(java.io.File xmldata, java.io.File libdir, - java.io.File sourcedir, java.io.File basedir, - java.io.File outputdir) throws TemplateException { - - /* Finds or creates a named console. */ - MessageConsole console = findConsole(CONSOLE_NAME); - activateConsole(console); - console.clearConsole(); - out = console.newMessageStream(); - - /* - * Instantiates the FMPP Settings engine and associates a listener for - * events to be logged. - */ - try { - settings = new Settings(basedir); - } 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 (pMode == Engine.PMODE_IGNORE) - return; - - switch (event) { - case EVENT_BEGIN_PROCESSING_SESSION: - out.println("Starting session"); - break; - case EVENT_END_PROCESSING_SESSION: - out.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: - out.println("Warning:" + (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; - try { - dom1 = db.parse(xmldata); - } catch (SAXException e) { - throw new TemplateException(e.getMessage()); - } catch (IOException e) { - throw new TemplateException(e.getMessage()); - } - - NodeModel.removeComments(dom1); - NodeModel.mergeAdjacentText(dom1); - TemplateNodeModel doc1 = NodeModel.wrap(dom1); - - HashMap xmls = new HashMap(); - xmls.put("doc1", doc1); - - /* Setting libraries path. */ - HashMap libs = new HashMap(); - libs.put("lib", libdir.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 e6c309b43..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java +++ /dev/null @@ -1,225 +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 dataFileName; - private String templatesPath; - private String outputDirName; - 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(); - dataFileName = page.getDataFileName(); - templatesPath = page.getTemplatesPath(); - outputDirName = page.getOutputDirName(); - 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, 4); - - /* Step #1, creates the project file.*/ - final IFile projectFile = container.getFile(new Path(projectFileName)); - try { - InputStream stream = openProjectContentStream(templatesPath, - dataFileName, - outputDirName); - 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, creates the XML data file.*/ - final IFile dataFile = container.getFile(new Path(dataFileName)); - 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 (dataFile.exists()) { - dataFile.setContents(stream, true, true, monitor); - } else { - dataFile.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 #4, refreshing local resources.*/ - container.refreshLocal(IResource.DEPTH_INFINITE, monitor); - monitor.worked(1); - } - - /** - * We will initialize file contents with a sample text. - */ - private InputStream openProjectContentStream(String templatesPath, - String dataFileName, - String outputDirName) { - - String contents = "# Automatically generated configuration project file.\n\n" + - "# Templates path in the configuration plugin resources, do not modify.\n" + - "source=" + templatesPath + "\n\n" + - "# XML configuration data file path relative to this configuration file.\n" + - "xmlfile=" + dataFileName + "\n\n" + - "# Output directory path relative to directory containing this configuration\n" + - "# file.\n" + - "output=" + outputDirName + "\n"; - return new ByteArrayInputStream(contents.getBytes()); - } - - 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 599c17af0..000000000 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java +++ /dev/null @@ -1,371 +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.resources.IWorkspaceRoot; -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.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 currentTemplatesPath; - private String currentDefaultDataFile; - - private Composite container; - private Combo configurationTemplatesCombo; - private Text confProjectFilenameText; - private Text confDataFilenameText; - private Text confOutputDirectoryText; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - 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) - */ - 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(); - } - }); - - Label lbl3 = new Label(container, SWT.NONE); - lbl3.setText("Configuration data filename:"); - - confDataFilenameText = new Text(container, SWT.BORDER); - confDataFilenameText.setText("config.chxml"); - confDataFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false, 1, 1)); - confDataFilenameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - confDataFilenameUpdated(); - } - }); - - Label lbl4 = new Label(container, SWT.NONE); - lbl4.setText("Configuration output directory:"); - - confOutputDirectoryText = new Text(container, SWT.BORDER); - confOutputDirectoryText.setText("."); - confOutputDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, - true, false, 1, 1)); - - /* 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")); - confDataFilenameText.setText(basefilename.concat(".chxml")); - currentTemplatesPath = processor.getChildText("path"); - currentDefaultDataFile = processor.getChildText("default"); - } - }); - confOutputDirectoryText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - confOutputDirectoryUpdated(); - } - }); - - populateWizardPanel(); - initialize(); - setControl(container); - } - - public String getContainerName() { - - return resourceContainer.getFullPath().toString(); - } - - public String getProjectFileName() { - - return confProjectFilenameText.getText(); - } - - public String getDataFileName() { - - return confDataFilenameText.getText(); - } - - public String getOutputDirName() { - - return confOutputDirectoryText.getText(); - } - - public String getTemplatesPath() { - - return currentTemplatesPath; - } - - 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."); - } - } - - /** - * Fills the wizard configuration panel from XML data. - * - * @param configurationTemplateCombo - * the combo box to be populated - */ - private void populateWizardPanel() { - String fpath; - - /* Retrieving the resource path of the processors.xml file. */ - 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); - } - - /** - * Checks the content of the confProjectFilenameText field. - */ - private void confDataFilenameUpdated() { - String fileName = getDataFileName(); - - 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("chxml") == false) { - updateStatus("Configuration project filename extension must be \"chxml\""); - return; - } - } - updateStatus(null); - } - - /** - * Checks the content of the confOutputDirectoryText field. - */ - private void confOutputDirectoryUpdated() { - - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IPath outputPath = resourceContainer.getFullPath().addTrailingSeparator() - .append(getOutputDirName()); - IResource outputContainer = root.findMember(outputPath); - - if (outputContainer == null) { - updateStatus("The directory must exists"); - return; - } - if (!(outputContainer instanceof IContainer)) { - updateStatus("A directory must be specified"); - 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); - } -} -- cgit v1.2.3 From b68838cc4506002b26d0b6ea5116484deb96bb2d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Aug 2012 18:08:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4514 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 1eb0a3bef..f0d5b2adb 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0.0 +Bundle-Version: 1.0.1 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, -- cgit v1.2.3 From 8aa7ae623e5a1d4f8475cfe9547d1668053867ed Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 07:33:00 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4516 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/xml/stm32f4board.xml | 1449 +++++++++++++++++++++++++++++-------- 1 file changed, 1159 insertions(+), 290 deletions(-) (limited to 'tools') diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml index b1f755a2f..01b836559 100644 --- a/tools/gencfg/xml/stm32f4board.xml +++ b/tools/gencfg/xml/stm32f4board.xml @@ -10,312 +10,1181 @@ MII_KS8721_ID RMII - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - +
-- cgit v1.2.3 From ea549eb7dc51ede8dd4b31ab6abfe44fc5f1c439 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 07:33:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4517 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/xml/stm32f4board.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/gencfg/xml/stm32f4board.xml b/tools/gencfg/xml/stm32f4board.xml index 01b836559..0c6b42106 100644 --- a/tools/gencfg/xml/stm32f4board.xml +++ b/tools/gencfg/xml/stm32f4board.xml @@ -3,7 +3,7 @@ - -----human readable blard name----- + -----human readable board name----- BOARD_IDENTIFIER -- cgit v1.2.3 From ce7b1bed663f62b35962ab0da3846c915d86e490 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 07:42:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4518 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/gencfg/xml/stm32f0board.xml | 665 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 665 insertions(+) create mode 100644 tools/gencfg/xml/stm32f0board.xml (limited to 'tools') diff --git a/tools/gencfg/xml/stm32f0board.xml b/tools/gencfg/xml/stm32f0board.xml new file mode 100644 index 000000000..64420371f --- /dev/null +++ b/tools/gencfg/xml/stm32f0board.xml @@ -0,0 +1,665 @@ + + + + -----human readable board name----- + BOARD_IDENTIFIER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From aee94a40c765c0a97b023eabf856c0f54b2ee775 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 07:46:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4519 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../gencfg/schema/boards/stm32f0xx_board.xsd | 70 + .../resources/gencfg/xml/stm32f0board.xml | 665 +++++++++ .../resources/gencfg/xml/stm32f4board.xml | 1451 ++++++++++++++++---- 3 files changed, 1895 insertions(+), 291 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml (limited to 'tools') 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 new file mode 100644 index 000000000..6fe520699 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml new file mode 100644 index 000000000..64420371f --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -0,0 +1,665 @@ + + + + -----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 index b1f755a2f..0c6b42106 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml @@ -3,319 +3,1188 @@ - -----human readable blard name----- + -----human readable board name----- BOARD_IDENTIFIER MII_KS8721_ID RMII - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + -- cgit v1.2.3 From ee8a302e4c3888cbefefe0c4c303a1e3658a593a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 07:50:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4520 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../config_wizard/src/config_wizard/Activator.java | 88 +++++ .../eclipse/config/handlers/CheckDescription.java | 54 +++ .../eclipse/config/handlers/GenerateFiles.java | 141 ++++++++ .../tools/eclipse/config/utils/TemplateEngine.java | 213 ++++++++++++ .../eclipse/config/utils/TemplateException.java | 30 ++ .../config/wizards/ConfigurationNewWizard.java | 225 +++++++++++++ .../config/wizards/ConfigurationNewWizardPage.java | 371 +++++++++++++++++++++ 7 files changed, 1122 insertions(+) create mode 100644 tools/eclipse/config_wizard/src/config_wizard/Activator.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java (limited to 'tools') diff --git a/tools/eclipse/config_wizard/src/config_wizard/Activator.java b/tools/eclipse/config_wizard/src/config_wizard/Activator.java new file mode 100644 index 000000000..1f62c4f62 --- /dev/null +++ b/tools/eclipse/config_wizard/src/config_wizard/Activator.java @@ -0,0 +1,88 @@ +/* + 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 new file mode 100644 index 000000000..f9e8cd6bf --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java @@ -0,0 +1,54 @@ +/* + 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 new file mode 100644 index 000000000..e10d4c667 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -0,0 +1,141 @@ +/* + 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.FileReader; +import java.io.IOException; +import java.util.Properties; + +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.IFile; +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.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(); + + /* Determines the base path as the parent of the configuration file.*/ + IPath basepath = cfgfilepath.removeLastSegments(1); + + /* Reads the configuration file into a Properties object. */ + Properties cfgfile = new Properties(); + try { + cfgfile.load(new FileReader(cfgfilepath.toFile())); + } catch (IOException e) { + MessageDialog.openInformation(window.getShell(), "I/O Error", + e.getMessage()); + return null; + } + + /* Retrieves source property. */ + String source = cfgfile.getProperty("source"); + if (source == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"source\" not found in configuration file."); + return null; + } + + /* Retrieves xmlfile property. */ + String xmlfile = cfgfile.getProperty("xmlfile"); + if (xmlfile == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"xmlfile\" not found in configuration file."); + return null; + } + + /* Retrieves output property. */ + String output = cfgfile.getProperty("output"); + if (output == null) { + MessageDialog.openInformation(window.getShell(), "Properties Error", + "Property \"output\" not found in configuration file."); + return null; + } + + /* Calculating derived paths. */ + IPath sourcepath = new Path(source); + IPath libpath = new Path("resources/gencfg/lib"); + try { + Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); + sourcepath = new Path(FileLocator.toFileURL( + FileLocator.find(bundle, sourcepath, null)).getFile()); + libpath = new Path(FileLocator.toFileURL( + FileLocator.find(bundle, libpath, null)).getFile()); + } catch (IOException e) { + MessageDialog.openInformation(window.getShell(), "Path Error", + e.getMessage()); + return null; + } + + /* Templates execution. */ + try { + TemplateEngine.process(basepath.addTrailingSeparator().append(xmlfile) + .toFile(), libpath.toFile(), sourcepath.toFile(), + basepath.toFile(), new File(output)); + } catch (TemplateException e) { + MessageDialog.openInformation(window.getShell(), "Processing Error", + e.getMessage()); + return null; + } + } + return null; + } +} 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 new file mode 100644 index 000000000..6c2771d9f --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -0,0 +1,213 @@ +/* + 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.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.w3c.dom.Document; +import org.xml.sax.SAXException; + +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 static final String CONSOLE_NAME = "ChibiOS/RT Configuration Tool"; + + private static Settings settings; + private static MessageConsoleStream out; + + /** + * Runs the templates engine. + * + * @param xmldata + * absolute path to XML data file + * @param libdir + * absolute path to libraries directory + * @param sourcedir + * absolute path to templates directory + * @param basedir + * absolute path to project directory + * @param outputdir + * output directory relative to basedir + * + * @throws SettingException + * @throws ProcessingException + */ + public static void process(java.io.File xmldata, java.io.File libdir, + java.io.File sourcedir, java.io.File basedir, + java.io.File outputdir) throws TemplateException { + + /* Finds or creates a named console. */ + MessageConsole console = findConsole(CONSOLE_NAME); + activateConsole(console); + console.clearConsole(); + out = console.newMessageStream(); + + /* + * Instantiates the FMPP Settings engine and associates a listener for + * events to be logged. + */ + try { + settings = new Settings(basedir); + } 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 (pMode == Engine.PMODE_IGNORE) + return; + + switch (event) { + case EVENT_BEGIN_PROCESSING_SESSION: + out.println("Starting session"); + break; + case EVENT_END_PROCESSING_SESSION: + out.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: + out.println("Warning:" + (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; + try { + dom1 = db.parse(xmldata); + } catch (SAXException e) { + throw new TemplateException(e.getMessage()); + } catch (IOException e) { + throw new TemplateException(e.getMessage()); + } + + NodeModel.removeComments(dom1); + NodeModel.mergeAdjacentText(dom1); + TemplateNodeModel doc1 = NodeModel.wrap(dom1); + + HashMap xmls = new HashMap(); + xmls.put("doc1", doc1); + + /* Setting libraries path. */ + HashMap libs = new HashMap(); + libs.put("lib", libdir.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 new file mode 100644 index 000000000..73746de1d --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateException.java @@ -0,0 +1,30 @@ +/* + 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 new file mode 100644 index 000000000..e6c309b43 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java @@ -0,0 +1,225 @@ +/* + 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 dataFileName; + private String templatesPath; + private String outputDirName; + 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(); + dataFileName = page.getDataFileName(); + templatesPath = page.getTemplatesPath(); + outputDirName = page.getOutputDirName(); + 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, 4); + + /* Step #1, creates the project file.*/ + final IFile projectFile = container.getFile(new Path(projectFileName)); + try { + InputStream stream = openProjectContentStream(templatesPath, + dataFileName, + outputDirName); + 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, creates the XML data file.*/ + final IFile dataFile = container.getFile(new Path(dataFileName)); + 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 (dataFile.exists()) { + dataFile.setContents(stream, true, true, monitor); + } else { + dataFile.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 #4, refreshing local resources.*/ + container.refreshLocal(IResource.DEPTH_INFINITE, monitor); + monitor.worked(1); + } + + /** + * We will initialize file contents with a sample text. + */ + private InputStream openProjectContentStream(String templatesPath, + String dataFileName, + String outputDirName) { + + String contents = "# Automatically generated configuration project file.\n\n" + + "# Templates path in the configuration plugin resources, do not modify.\n" + + "source=" + templatesPath + "\n\n" + + "# XML configuration data file path relative to this configuration file.\n" + + "xmlfile=" + dataFileName + "\n\n" + + "# Output directory path relative to directory containing this configuration\n" + + "# file.\n" + + "output=" + outputDirName + "\n"; + return new ByteArrayInputStream(contents.getBytes()); + } + + 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 new file mode 100644 index 000000000..599c17af0 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java @@ -0,0 +1,371 @@ +/* + 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.resources.IWorkspaceRoot; +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.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 currentTemplatesPath; + private String currentDefaultDataFile; + + private Composite container; + private Combo configurationTemplatesCombo; + private Text confProjectFilenameText; + private Text confDataFilenameText; + private Text confOutputDirectoryText; + + /** + * Constructor for SampleNewWizardPage. + * + * @param pageName + */ + 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) + */ + 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(); + } + }); + + Label lbl3 = new Label(container, SWT.NONE); + lbl3.setText("Configuration data filename:"); + + confDataFilenameText = new Text(container, SWT.BORDER); + confDataFilenameText.setText("config.chxml"); + confDataFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, + false, 1, 1)); + confDataFilenameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + confDataFilenameUpdated(); + } + }); + + Label lbl4 = new Label(container, SWT.NONE); + lbl4.setText("Configuration output directory:"); + + confOutputDirectoryText = new Text(container, SWT.BORDER); + confOutputDirectoryText.setText("."); + confOutputDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, + true, false, 1, 1)); + + /* 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")); + confDataFilenameText.setText(basefilename.concat(".chxml")); + currentTemplatesPath = processor.getChildText("path"); + currentDefaultDataFile = processor.getChildText("default"); + } + }); + confOutputDirectoryText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + confOutputDirectoryUpdated(); + } + }); + + populateWizardPanel(); + initialize(); + setControl(container); + } + + public String getContainerName() { + + return resourceContainer.getFullPath().toString(); + } + + public String getProjectFileName() { + + return confProjectFilenameText.getText(); + } + + public String getDataFileName() { + + return confDataFilenameText.getText(); + } + + public String getOutputDirName() { + + return confOutputDirectoryText.getText(); + } + + public String getTemplatesPath() { + + return currentTemplatesPath; + } + + 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."); + } + } + + /** + * Fills the wizard configuration panel from XML data. + * + * @param configurationTemplateCombo + * the combo box to be populated + */ + private void populateWizardPanel() { + String fpath; + + /* Retrieving the resource path of the processors.xml file. */ + 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); + } + + /** + * Checks the content of the confProjectFilenameText field. + */ + private void confDataFilenameUpdated() { + String fileName = getDataFileName(); + + 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("chxml") == false) { + updateStatus("Configuration project filename extension must be \"chxml\""); + return; + } + } + updateStatus(null); + } + + /** + * Checks the content of the confOutputDirectoryText field. + */ + private void confOutputDirectoryUpdated() { + + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IPath outputPath = resourceContainer.getFullPath().addTrailingSeparator() + .append(getOutputDirName()); + IResource outputContainer = root.findMember(outputPath); + + if (outputContainer == null) { + updateStatus("The directory must exists"); + return; + } + if (!(outputContainer instanceof IContainer)) { + updateStatus("A directory must be specified"); + 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); + } +} -- cgit v1.2.3 From f5f2903d3c617512ada34b589c1b2a6806047817 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:04:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f0xx/templates/board.c.ftl | 101 +++++++ .../boards/stm32f0xx/templates/board.h.ftl | 321 +++++++++++++++++++++ .../boards/stm32f0xx/templates/board.mk.ftl | 28 ++ .../resources/gencfg/processors/processors.xml | 6 + 4 files changed, 456 insertions(+) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl (limited to 'tools') 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 new file mode 100644 index 000000000..4cb9adaab --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl @@ -0,0 +1,101 @@ +[#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 new file mode 100644 index 000000000..b4b4007a7 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl @@ -0,0 +1,321 @@ +[#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 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_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/stm32f0xx/templates/board.mk.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl new file mode 100644 index 000000000..c88471ac3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl @@ -0,0 +1,28 @@ +[#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 index e044f903d..e93a6f94c 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml @@ -1,4 +1,10 @@ + + STM32F0xx Board Configuration + resources/gencfg/processors/boards/stm32f0xx/templates + resources/gencfg/xml/stm32f0board.xml + board + STM32F4xx Board Configuration resources/gencfg/processors/boards/stm32f4xx/templates -- cgit v1.2.3 From 90f948e7a5d6603f7a4563445d2184fc3e465c68 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:05:45 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4522 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/build.properties | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties index 832268812..ae3f83672 100644 --- a/tools/eclipse/config_wizard/build.properties +++ b/tools/eclipse/config_wizard/build.properties @@ -22,4 +22,9 @@ bin.includes = plugin.xml,\ resources/gencfg/schema/common/doc.xsd,\ resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd,\ resources/gencfg/xml/stm32f4board.xml,\ - icons/ + icons/,\ + resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl,\ + resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl,\ + resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl,\ + resources/gencfg/schema/boards/stm32f0xx_board.xsd,\ + resources/gencfg/xml/stm32f0board.xml -- cgit v1.2.3 From 35ccde88619a948f62885261817972c433d91019 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:16:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4523 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../resources/gencfg/xml/stm32f0board.xml | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index 64420371f..c13904c90 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -117,7 +117,7 @@ Mode="Input" Alternate="0" /> @@ -159,28 +159,28 @@ Mode="Input" Alternate="0" /> Date: Sun, 5 Aug 2012 08:21:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4524 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index c13904c90..7d564e3a8 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -1,5 +1,5 @@ - + -- cgit v1.2.3 From 6d7f9128b8c15298047e931b6a9feb6af8b46b64 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:26:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4525 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../config_wizard/resources/gencfg/xml/stm32f0board.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index 7d564e3a8..6659dfdd0 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -533,18 +533,18 @@ + Alternate="0" >OOSOSCOSC_OSC_IOSC_INOSC_IOSC_OSCOSO -- cgit v1.2.3 From f31f92ef94e6ef39d4eb0d2745ac8573439417d1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:36:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4526 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index 6659dfdd0..57ec5f9e5 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -539,7 +539,7 @@ Resistor="Floating" Level="High" Mode="Input" - Alternate="0" >OOSOSCOSC_OSC_IOSC_INOSC_IOSC_OSCOSO + Alternate="0" /> Date: Sun, 5 Aug 2012 08:51:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4527 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index f0d5b2adb..8d3f5f45a 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0.1 +Bundle-Version: 1.0.2 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.ui.ide Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: CHIBIOS +Bundle-Vendor: chibios-org Bundle-ClassPath: ., lib/jdom-2.0.2.jar, lib/freemarker.jar, -- cgit v1.2.3 From 52801d1c7601049db55ad94704ebb84aaf3887ac Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 08:52:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4528 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../org.chibios.tools.eclipse.config_1.0.0.jar | Bin 1838706 -> 0 bytes .../org.chibios.tools.eclipse.config_1.0.2.jar | Bin 0 -> 1845778 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar deleted file mode 100644 index 93947774a..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.0.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar new file mode 100644 index 000000000..056b9d545 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar differ -- cgit v1.2.3 From 8ebf06da5d7a974ed189362046ca76b07bf4b8d2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 09:02:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4529 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f0xx/templates/board.h.ftl | 16 ++++++++-------- .../org.chibios.tools.eclipse.config_1.0.2.jar | Bin 1845778 -> 1845778 bytes 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tools') 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 index b4b4007a7..798161f83 100644 --- 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 @@ -103,10 +103,10 @@ #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_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)) @@ -208,13 +208,13 @@ ${line + ")"} [/#if] [#assign speed = pin.@Speed[0] /] [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_OSPEED_400K(" + port_name + "_" + name + ")" /] [#elseif speed == "Low"] - [#assign out = "PIN_OSPEED_25M(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] [#elseif speed == "High"] - [#assign out = "PIN_OSPEED_50M(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_OSPEED_10M(" + port_name + "_" + name + ")" /] [#else] - [#assign out = "PIN_OSPEED_100M(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_OSPEED_40M(" + port_name + "_" + name + ")" /] [/#if] [#if pin_index == 0] [#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /] diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar index 056b9d545..6da515a9a 100644 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar differ -- cgit v1.2.3 From 9cf7536bf3e942e65d82952e44c3e903d51696b8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 09:30:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4530 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- .../boards/stm32f0xx/templates/board.h.ftl | 7 +++---- .../resources/gencfg/xml/stm32f0board.xml | 2 +- .../org.chibios.tools.eclipse.config_1.0.2.jar | Bin 1845778 -> 1845764 bytes 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 8d3f5f45a..96de4cd14 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.ui.ide Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: chibios-org +Bundle-Vendor: chibios.org Bundle-ClassPath: ., lib/jdom-2.0.2.jar, lib/freemarker.jar, 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 index 798161f83..30fda47df 100644 --- 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 @@ -103,9 +103,8 @@ #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_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)) @@ -208,7 +207,7 @@ ${line + ")"} [/#if] [#assign speed = pin.@Speed[0] /] [#if speed == "Minimum"] - [#assign out = "PIN_OSPEED_400K(" + port_name + "_" + name + ")" /] + [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] [#elseif speed == "Low"] [#assign out = "PIN_OSPEED_2M(" + port_name + "_" + name + ")" /] [#elseif speed == "High"] diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index 57ec5f9e5..7e4dd5459 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -120,7 +120,7 @@ ID="SWDAT" Type="PushPull" Speed="Maximum" - Resistor="Floating" + Resistor="PullUp" Level="High" Mode="Alternate" Alternate="0" /> diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar index 6da515a9a..3ecd62c5d 100644 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar differ -- cgit v1.2.3 From 6c5b81567039a0b1c22499311c1301e7f1155dc9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 12:20:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4532 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- .../boards/stm32l1xx/templates/board.c.ftl | 139 ++++ .../boards/stm32l1xx/templates/board.h.ftl | 327 +++++++++ .../boards/stm32l1xx/templates/board.mk.ftl | 28 + .../resources/gencfg/processors/processors.xml | 6 + .../gencfg/schema/boards/stm32l1xx_board.xsd | 71 ++ .../resources/gencfg/xml/stm32f4board.xml | 4 +- .../resources/gencfg/xml/stm32l1board.xml | 795 +++++++++++++++++++++ 8 files changed, 1369 insertions(+), 3 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 96de4cd14..b1ef0b0ea 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0.2 +Bundle-Version: 1.0.3 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, 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 new file mode 100644 index 000000000..f38fd106a --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl @@ -0,0 +1,139 @@ +[#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/stm32l1xx/templates/board.h.ftl b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl new file mode 100644 index 000000000..8d61438a7 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl @@ -0,0 +1,327 @@ +[#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 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 new file mode 100644 index 000000000..c88471ac3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl @@ -0,0 +1,28 @@ +[#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 index e93a6f94c..6dba55fcd 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml @@ -11,4 +11,10 @@ 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/stm32l1xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd new file mode 100644 index 000000000..448a51a9c --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml index 0c6b42106..7becd89df 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml @@ -125,7 +125,7 @@ ID="JTAG_TMS" Type="PushPull" Speed="Maximum" - Resistor="Floating" + Resistor="PullUp" Level="High" Mode="Alternate" Alternate="0" /> @@ -141,7 +141,7 @@ ID="JTAG_TDI" Type="PushPull" Speed="Maximum" - Resistor="Floating" + Resistor="PullUp" Level="High" Mode="Alternate" Alternate="0" /> diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml new file mode 100644 index 000000000..1f6554026 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml @@ -0,0 +1,795 @@ + + + + -----human readable board name----- + BOARD_IDENTIFIER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 0775f8a0dfbaef3516555e02fbca2c0d8379c06e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 12:31:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4533 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/build.properties | 7 ++++++- .../processors/boards/stm32l1xx/templates/board.h.ftl | 6 ------ .../org.chibios.tools.eclipse.config_1.0.2.jar | Bin 1845764 -> 0 bytes .../org.chibios.tools.eclipse.config_1.0.3.jar | Bin 0 -> 1852693 bytes 4 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar (limited to 'tools') diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties index ae3f83672..05b402447 100644 --- a/tools/eclipse/config_wizard/build.properties +++ b/tools/eclipse/config_wizard/build.properties @@ -27,4 +27,9 @@ bin.includes = plugin.xml,\ resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl,\ resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl,\ resources/gencfg/schema/boards/stm32f0xx_board.xsd,\ - resources/gencfg/xml/stm32f0board.xml + resources/gencfg/xml/stm32f0board.xml,\ + resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl,\ + resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl,\ + resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl,\ + resources/gencfg/schema/boards/stm32l1xx_board.xsd,\ + resources/gencfg/xml/stm32l1board.xml 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 index 8d61438a7..76db7eb27 100644 --- 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 @@ -70,12 +70,6 @@ #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 stm32l1xx.h. */ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar deleted file mode 100644 index 3ecd62c5d..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.2.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar new file mode 100644 index 000000000..76a03b3c3 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar differ -- cgit v1.2.3 From b736858c5bbed206d2f40dcdf8052646b096db86 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Aug 2012 12:40:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4534 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../boards/stm32f0xx/templates/board.c.ftl | 2 +- .../boards/stm32l1xx/templates/board.c.ftl | 8 +------- .../org.chibios.tools.eclipse.config_1.0.3.jar | Bin 1852693 -> 1852636 bytes 3 files changed, 2 insertions(+), 8 deletions(-) (limited to 'tools') 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 index 4cb9adaab..22510cb2b 100644 --- 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 @@ -46,7 +46,7 @@ const PALConfig pal_default_config = {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}, + VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH} }; #endif 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 index f38fd106a..b46be86a2 100644 --- 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 @@ -47,14 +47,8 @@ const PALConfig pal_default_config = 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} + VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH} }; #endif diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar index 76a03b3c3..966ffbc5d 100644 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar differ -- cgit v1.2.3 From 52dc5338772fa93dc6ad1c4bd0b8245a9db59405 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 6 Aug 2012 10:15:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4536 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- .../tools/eclipse/config/utils/TemplateEngine.java | 39 ++++++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index b1ef0b0ea..fb3d848cd 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0.3 +Bundle-Version: 1.0.4 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java index 6c2771d9f..892c9c99b 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -27,6 +27,9 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +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; @@ -55,10 +58,18 @@ import freemarker.template.TemplateNodeModel; */ public class TemplateEngine { - private static final String CONSOLE_NAME = "ChibiOS/RT Configuration Tool"; + 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. @@ -85,7 +96,14 @@ public class TemplateEngine { 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); /* * Instantiates the FMPP Settings engine and associates a listener for @@ -103,29 +121,36 @@ public class TemplateEngine { 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: - out.println("Starting session"); + msg.println("Starting session"); + msg.println(); break; case EVENT_END_PROCESSING_SESSION: - out.println("Finished"); + msg.println(); + msg.println("Finished"); break; case EVENT_BEGIN_FILE_PROCESSING: - out.println("Processing " + src.getName()); + out.println("> Processing " + src.getName()); break; case EVENT_END_FILE_PROCESSING: break; case EVENT_IGNORING_DIR: - out.println("Ignoring directory " + src.getName()); + out.println("> Ignoring directory " + src.getName()); break; case EVENT_SOURCE_NOT_MODIFIED: - out.println("Skipping " + src.getName()); + out.println("> Skipping " + src.getName()); break; case EVENT_WARNING: - out.println("Warning:" + (String) param); + warn.println(": " + (String)param); break; } } -- cgit v1.2.3 From a072b394a2ea71c424cd80c2541492724448b6d2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 6 Aug 2012 14:57:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4537 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- tools/eclipse/config_wizard/build.properties | 3 +- tools/eclipse/config_wizard/plugin.xml | 19 +++- .../gencfg/schema/boards/abstract_board.xsd | 37 +++++--- .../gencfg/schema/boards/stm32f4xx_board.xsd | 102 ++++++++++----------- .../gencfg/schema/common/config_settings.xsd | 36 ++++++++ .../resources/gencfg/xml/stm32f0board.xml | 4 + .../resources/gencfg/xml/stm32f4board.xml | 4 + .../resources/gencfg/xml/stm32l1board.xml | 4 + .../eclipse/config/handlers/GenerateFiles.java | 62 +++++-------- .../tools/eclipse/config/utils/TemplateEngine.java | 11 +-- .../config/wizards/ConfigurationNewWizard.java | 50 +--------- .../config/wizards/ConfigurationNewWizardPage.java | 94 ------------------- 13 files changed, 175 insertions(+), 253 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index fb3d848cd..6b14e432e 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0.4 +Bundle-Version: 1.1.0 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties index 05b402447..81715159f 100644 --- a/tools/eclipse/config_wizard/build.properties +++ b/tools/eclipse/config_wizard/build.properties @@ -32,4 +32,5 @@ bin.includes = plugin.xml,\ resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl,\ resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl,\ resources/gencfg/schema/boards/stm32l1xx_board.xsd,\ - resources/gencfg/xml/stm32l1board.xml + resources/gencfg/xml/stm32l1board.xml,\ + resources/gencfg/schema/common/config_settings.xsd diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml index e2163c8fb..84ca332e5 100644 --- a/tools/eclipse/config_wizard/plugin.xml +++ b/tools/eclipse/config_wizard/plugin.xml @@ -17,14 +17,29 @@ - + + file-extensions="chcfg"> + + + + + + + + + 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 index c4c953240..a1c696339 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd @@ -3,10 +3,12 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema"> + - + + @@ -21,25 +23,36 @@ - + - - - - + - + - + + + + + + - + - - + + - + + 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 index ace3b5acb..072880711 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd @@ -1,63 +1,61 @@ + xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - - - - - - - + + + + + + + + + - + 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 new file mode 100644 index 000000000..45d228142 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd @@ -0,0 +1,36 @@ + + + + + + + + Templates resources associated to the configuration. + + + + + + + + + + + + Output directory relative to the configuration file. + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml index 7e4dd5459..843dfe925 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml @@ -3,6 +3,10 @@ + + resources/gencfg/processors/boards/stm32f0xx/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 index 7becd89df..66a09d0d6 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml @@ -3,6 +3,10 @@ + + resources/gencfg/processors/boards/stm32f4xx/templates + . + -----human readable board name----- BOARD_IDENTIFIER diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml index 1f6554026..00e5b5319 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml @@ -3,6 +3,10 @@ + + resources/gencfg/processors/boards/stm32l1xx/templates + . + -----human readable board name----- BOARD_IDENTIFIER diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java index e10d4c667..e6e9b3790 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -21,9 +21,7 @@ package org.chibios.tools.eclipse.config.handlers; import java.io.File; -import java.io.FileReader; import java.io.IOException; -import java.util.Properties; import org.chibios.tools.eclipse.config.utils.TemplateEngine; import org.chibios.tools.eclipse.config.utils.TemplateException; @@ -40,6 +38,10 @@ 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; @@ -70,53 +72,32 @@ public class GenerateFiles extends AbstractHandler { if (selection instanceof IStructuredSelection) { /* Retrieves the full path of the configuration file. */ - IPath cfgfilepath = ((IFile) ((IStructuredSelection) selection) + IPath cfgfilepath = ((IFile)((IStructuredSelection)selection) .getFirstElement()).getLocation(); - - /* Determines the base path as the parent of the configuration file.*/ - IPath basepath = cfgfilepath.removeLastSegments(1); - /* Reads the configuration file into a Properties object. */ - Properties cfgfile = new Properties(); + /* DOM tree creation. */ + SAXBuilder builder = new SAXBuilder(); + Document document; try { - cfgfile.load(new FileReader(cfgfilepath.toFile())); - } catch (IOException e) { - MessageDialog.openInformation(window.getShell(), "I/O Error", - e.getMessage()); - return null; - } - - /* Retrieves source property. */ - String source = cfgfile.getProperty("source"); - if (source == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"source\" not found in configuration file."); + document = builder.build(cfgfilepath.toFile()); + } catch (JDOMException e) { return null; - } - - /* Retrieves xmlfile property. */ - String xmlfile = cfgfile.getProperty("xmlfile"); - if (xmlfile == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"xmlfile\" not found in configuration file."); + } catch (IOException e) { return null; } - /* Retrieves output property. */ - String output = cfgfile.getProperty("output"); - if (output == null) { - MessageDialog.openInformation(window.getShell(), "Properties Error", - "Property \"output\" not found in configuration file."); - 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 sourcepath = new Path(source); + IPath tpath = new Path(templates_path); IPath libpath = new Path("resources/gencfg/lib"); try { Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - sourcepath = new Path(FileLocator.toFileURL( - FileLocator.find(bundle, sourcepath, null)).getFile()); + tpath = new Path(FileLocator.toFileURL( + FileLocator.find(bundle, tpath, null)).getFile()); libpath = new Path(FileLocator.toFileURL( FileLocator.find(bundle, libpath, null)).getFile()); } catch (IOException e) { @@ -127,9 +108,10 @@ public class GenerateFiles extends AbstractHandler { /* Templates execution. */ try { - TemplateEngine.process(basepath.addTrailingSeparator().append(xmlfile) - .toFile(), libpath.toFile(), sourcepath.toFile(), - basepath.toFile(), new File(output)); + TemplateEngine.process(cfgfilepath.toFile(), + libpath.toFile(), + tpath.toFile(), + new File(output_path)); } catch (TemplateException e) { MessageDialog.openInformation(window.getShell(), "Processing Error", e.getMessage()); diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java index 892c9c99b..272d6a5c2 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -80,16 +80,15 @@ public class TemplateEngine { * absolute path to libraries directory * @param sourcedir * absolute path to templates directory - * @param basedir - * absolute path to project directory * @param outputdir - * output directory relative to basedir + * output directory relative to xmldata * * @throws SettingException * @throws ProcessingException */ - public static void process(java.io.File xmldata, java.io.File libdir, - java.io.File sourcedir, java.io.File basedir, + public static void process(java.io.File xmldata, + java.io.File libdir, + java.io.File sourcedir, java.io.File outputdir) throws TemplateException { /* Finds or creates a named console. */ @@ -110,7 +109,7 @@ public class TemplateEngine { * events to be logged. */ try { - settings = new Settings(basedir); + settings = new Settings(xmldata.getParentFile()); } catch (SettingException e) { e.printStackTrace(); return; 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 index e6c309b43..28ee7e6e7 100644 --- 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 @@ -54,9 +54,6 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { private String containerName; private String projectFileName; - private String dataFileName; - private String templatesPath; - private String outputDirName; private String defaultDataFile; /** @@ -91,9 +88,6 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { containerName = page.getContainerName(); projectFileName = page.getProjectFileName(); - dataFileName = page.getDataFileName(); - templatesPath = page.getTemplatesPath(); - outputDirName = page.getOutputDirName(); defaultDataFile = page.getDefaultDataFile(); IRunnableWithProgress op = new IRunnableWithProgress() { @@ -133,36 +127,20 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { throwCoreException("Container \"" + containerName + "\" does not exist."); } IContainer container = (IContainer)resource; - monitor.beginTask("Creating " + projectFileName, 4); + monitor.beginTask("Creating " + projectFileName, 3); /* Step #1, creates the project file.*/ final IFile projectFile = container.getFile(new Path(projectFileName)); - try { - InputStream stream = openProjectContentStream(templatesPath, - dataFileName, - outputDirName); - 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, creates the XML data file.*/ - final IFile dataFile = container.getFile(new Path(dataFileName)); 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 (dataFile.exists()) { - dataFile.setContents(stream, true, true, monitor); + if (projectFile.exists()) { + projectFile.setContents(stream, true, true, monitor); } else { - dataFile.create(stream, true, monitor); + projectFile.create(stream, true, monitor); } stream.close(); } catch (IOException e) { @@ -183,29 +161,11 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard { }); monitor.worked(1); - /* Step #4, refreshing local resources.*/ + /* Step #3, refreshing local resources.*/ container.refreshLocal(IResource.DEPTH_INFINITE, monitor); monitor.worked(1); } - /** - * We will initialize file contents with a sample text. - */ - private InputStream openProjectContentStream(String templatesPath, - String dataFileName, - String outputDirName) { - - String contents = "# Automatically generated configuration project file.\n\n" + - "# Templates path in the configuration plugin resources, do not modify.\n" + - "source=" + templatesPath + "\n\n" + - "# XML configuration data file path relative to this configuration file.\n" + - "xmlfile=" + dataFileName + "\n\n" + - "# Output directory path relative to directory containing this configuration\n" + - "# file.\n" + - "output=" + outputDirName + "\n"; - return new ByteArrayInputStream(contents.getBytes()); - } - private void throwCoreException(String message) throws CoreException { IStatus status = new Status(IStatus.ERROR, "org.chibios.tools.eclipse.config", IStatus.OK, 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 index 599c17af0..dde12645b 100644 --- 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 @@ -24,8 +24,6 @@ import java.io.IOException; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -65,14 +63,11 @@ public class ConfigurationNewWizardPage extends WizardPage { private IContainer resourceContainer; private Document processorsDocument; - private String currentTemplatesPath; private String currentDefaultDataFile; private Composite container; private Combo configurationTemplatesCombo; private Text confProjectFilenameText; - private Text confDataFilenameText; - private Text confOutputDirectoryText; /** * Constructor for SampleNewWizardPage. @@ -118,43 +113,15 @@ public class ConfigurationNewWizardPage extends WizardPage { } }); - Label lbl3 = new Label(container, SWT.NONE); - lbl3.setText("Configuration data filename:"); - - confDataFilenameText = new Text(container, SWT.BORDER); - confDataFilenameText.setText("config.chxml"); - confDataFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false, 1, 1)); - confDataFilenameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - confDataFilenameUpdated(); - } - }); - - Label lbl4 = new Label(container, SWT.NONE); - lbl4.setText("Configuration output directory:"); - - confOutputDirectoryText = new Text(container, SWT.BORDER); - confOutputDirectoryText.setText("."); - confOutputDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, - true, false, 1, 1)); - /* 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")); - confDataFilenameText.setText(basefilename.concat(".chxml")); - currentTemplatesPath = processor.getChildText("path"); currentDefaultDataFile = processor.getChildText("default"); } }); - confOutputDirectoryText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - confOutputDirectoryUpdated(); - } - }); populateWizardPanel(); initialize(); @@ -171,21 +138,6 @@ public class ConfigurationNewWizardPage extends WizardPage { return confProjectFilenameText.getText(); } - public String getDataFileName() { - - return confDataFilenameText.getText(); - } - - public String getOutputDirName() { - - return confOutputDirectoryText.getText(); - } - - public String getTemplatesPath() { - - return currentTemplatesPath; - } - public String getDefaultDataFile() { return currentDefaultDataFile; @@ -291,52 +243,6 @@ public class ConfigurationNewWizardPage extends WizardPage { updateStatus(null); } - /** - * Checks the content of the confProjectFilenameText field. - */ - private void confDataFilenameUpdated() { - String fileName = getDataFileName(); - - 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("chxml") == false) { - updateStatus("Configuration project filename extension must be \"chxml\""); - return; - } - } - updateStatus(null); - } - - /** - * Checks the content of the confOutputDirectoryText field. - */ - private void confOutputDirectoryUpdated() { - - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IPath outputPath = resourceContainer.getFullPath().addTrailingSeparator() - .append(getOutputDirName()); - IResource outputContainer = root.findMember(outputPath); - - if (outputContainer == null) { - updateStatus("The directory must exists"); - return; - } - if (!(outputContainer instanceof IContainer)) { - updateStatus("A directory must be specified"); - return; - } - updateStatus(null); - } - /** * Returns the XML Element associated to the current selection in the combo * box. -- cgit v1.2.3 From 6725393d74ce0b69465e52703544b888e1f7ac59 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 6 Aug 2012 17:22:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4538 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../org.chibios.tools.eclipse.config_1.0.3.jar | Bin 1852636 -> 0 bytes .../org.chibios.tools.eclipse.config_1.1.0.jar | Bin 0 -> 1851193 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar (limited to 'tools') diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar deleted file mode 100644 index 966ffbc5d..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.0.3.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar new file mode 100644 index 000000000..31587f214 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar differ -- cgit v1.2.3 From ecc767386f69585107ce4678c2cb0ab01bd4145a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 7 Aug 2012 15:12:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4542 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/plugin.xml | 7 + .../config/wizards/ConfigurationNewWizardPage.java | 3 +- .../wizards/NewApplicationProjectWizard.java | 42 +++++ .../wizards/NewApplicationProjectWizardPage.java | 210 +++++++++++++++++++++ 4 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java (limited to 'tools') diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml index 84ca332e5..7098032c8 100644 --- a/tools/eclipse/config_wizard/plugin.xml +++ b/tools/eclipse/config_wizard/plugin.xml @@ -15,6 +15,13 @@ id="org.chibios.tools.eclipse.config.wizards.ConfigurationNewWizard" name="ChibiOS/RT Configuration Wizard"> + + 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 index dde12645b..2cc7b830b 100644 --- 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 @@ -71,8 +71,6 @@ public class ConfigurationNewWizardPage extends WizardPage { /** * Constructor for SampleNewWizardPage. - * - * @param pageName */ public ConfigurationNewWizardPage(ISelection selection) { @@ -85,6 +83,7 @@ public class ConfigurationNewWizardPage extends WizardPage { /** * @see IDialogPage#createControl(Composite) */ + @Override public void createControl(Composite parent) { container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); 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 new file mode 100644 index 000000000..c5e10de81 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java @@ -0,0 +1,42 @@ +package org.chibios.tools.eclipse.config.wizards; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +public class NewApplicationProjectWizard extends Wizard implements INewWizard { + + private ISelection selection; + private IWizardPage page; + + /** + * 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() { + + return true; + } + +} 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 new file mode 100644 index 000000000..d771b68e8 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java @@ -0,0 +1,210 @@ +package org.chibios.tools.eclipse.config.wizards; + +import java.io.File; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +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.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; + +public class NewApplicationProjectWizardPage extends WizardPage { + + private ISelection selection; + private Composite container; + private Text projectParentPathText; + private Button btnBrowse; + private Label lblProjectName; + private Text projectNameText; + private Button useCustomPathButton; + private Label lblFinalProjectPath; + private Text projectFinalPathText; + + /** + * 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."); + 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 = 3; + layout.verticalSpacing = 9; + + lblProjectName = new Label(container, SWT.NONE); + lblProjectName.setText("Project name:"); + + projectNameText = new Text(container, SWT.BORDER); + projectNameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + projectNameUpdated(); + } + }); + projectNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(container, SWT.NONE); + + 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); + updateFinalProjectPathText(); + } + else { + projectParentPathText.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()); + projectParentPathText.setEnabled(true); + updateFinalProjectPathText(); + } + } + }); + useCustomPathButton.setText("Use default location"); + new Label(container, SWT.NONE); + new Label(container, SWT.NONE); + + Label lbl1 = new Label(container, SWT.NULL); + lbl1.setText("Project parent path:"); + + projectParentPathText = new Text(container, SWT.BORDER | SWT.SINGLE); + projectParentPathText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + projectPathUpdated(); + } + }); + projectParentPathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnBrowse = new Button(container, SWT.NONE); + btnBrowse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + } + }); + btnBrowse.setText("Browse..."); + + lblFinalProjectPath = new Label(container, SWT.NONE); + lblFinalProjectPath.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)); + + populateWizardPanel(); + 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); + + /* Update checks on the fields.*/ + projectNameUpdated(); + } + + /** + * Fills the wizard configuration panel from XML data. + * + * @param configurationTemplateCombo + * the combo box to be populated + */ + private void populateWizardPanel() { + + } + + private void projectNameUpdated() { + String name = projectNameText.getText(); + + updateFinalProjectPathText(); + + if (!isValidFilename(name)) { + updateStatus("Invalid project name."); + return; + } + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); + if (project.exists()) { + updateStatus("Project exists."); + return; + } + updateStatus(null); + } + + private void projectPathUpdated() { + File path = new File(projectParentPathText.getText()); + + updateFinalProjectPathText(); + + if (!path.exists()) { + updateStatus("Project path is not valid."); + return; + } + if (!path.isDirectory()) { + updateStatus("Project path is a directory."); + 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; + } +} -- cgit v1.2.3 From 4bdc2322a82279051981716284f145965321ba07 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 8 Aug 2012 16:45:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4543 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- .../resources/gencfg/lib/code_snippets.xml | 50 +++++++ .../resources/gencfg/lib/libsnippets.ftl | 33 +++++ .../resources/gencfg/processors/processors.xml | 24 +++- .../gencfg/schema/common/code_snippets.xsd | 59 +++++++++ .../eclipse/config/handlers/GenerateFiles.java | 1 + .../tools/eclipse/config/utils/TemplateEngine.java | 10 +- .../config/wizards/ConfigurationNewWizardPage.java | 18 +-- .../wizards/NewApplicationProjectWizardPage.java | 146 +++++++++++++++------ 9 files changed, 280 insertions(+), 63 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml create mode 100644 tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 6b14e432e..b7cea1ead 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.1.0 +Bundle-Version: 1.2.0 Bundle-Activator: config_wizard.Activator Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml b/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml new file mode 100644 index 000000000..2d0e5959a --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/code_snippets.xml @@ -0,0 +1,50 @@ + + + + + + thread_body + Empty + + + + + thread_body + Checks for Termination + + + + + thread_body + Message Server + + + + + diff --git a/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl b/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl new file mode 100644 index 000000000..a0680af04 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/lib/libsnippets.ftl @@ -0,0 +1,33 @@ +[#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/processors/processors.xml b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml index 6dba55fcd..30a70c069 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml @@ -1,20 +1,38 @@ - + STM32F0xx Board Configuration resources/gencfg/processors/boards/stm32f0xx/templates resources/gencfg/xml/stm32f0board.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 + + STM32F0xx Build Environment Configuration + resources/gencfg/processors/builds/stm32f0xx/templates + resources/gencfg/xml/stm32f0build.xml + build + + + STM32F4xx Build Environment Configuration + resources/gencfg/processors/builds/stm32f4xx/templates + resources/gencfg/xml/stm32f4build.xml + build + + + STM32L1xx Build Environment Configuration + resources/gencfg/processors/builds/stm32l1xx/templates + resources/gencfg/xml/stm32l1build.xml + build + 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 new file mode 100644 index 000000000..ad0bad11a --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/common/code_snippets.xsd @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java index e6e9b3790..c742d9072 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -118,6 +118,7 @@ public class GenerateFiles extends AbstractHandler { return null; } } + /* TODO: refresh output path.*/ return null; } } diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java index 272d6a5c2..60a33f0e2 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -20,6 +20,7 @@ package org.chibios.tools.eclipse.config.utils; +import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -165,9 +166,12 @@ public class TemplateEngine { } catch (ParserConfigurationException e) { throw new TemplateException(e.getMessage()); } - Document dom1; + Document dom1, dom_snippets; try { dom1 = db.parse(xmldata); + java.io.File xmlsnippets = new File(libdir.toString() + + "/code_snippets.xml"); + dom_snippets = db.parse(xmlsnippets); } catch (SAXException e) { throw new TemplateException(e.getMessage()); } catch (IOException e) { @@ -176,10 +180,14 @@ public class TemplateEngine { 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(); 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 index 2cc7b830b..d503d9748 100644 --- 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 @@ -122,7 +122,6 @@ public class ConfigurationNewWizardPage extends WizardPage { } }); - populateWizardPanel(); initialize(); setControl(container); } @@ -171,18 +170,9 @@ public class ConfigurationNewWizardPage extends WizardPage { container.setEnabled(false); updateStatus("Container for the resource not selected."); } - } - - /** - * Fills the wizard configuration panel from XML data. - * - * @param configurationTemplateCombo - * the combo box to be populated - */ - private void populateWizardPanel() { - String fpath; /* 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"); @@ -205,10 +195,8 @@ public class ConfigurationNewWizardPage extends WizardPage { return; } - /* - * Parsing the content of the processors.xml file in order to populate the - * panel objects. - */ + /* 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"); diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java index d771b68e8..efc377014 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java @@ -1,17 +1,21 @@ 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; @@ -19,6 +23,15 @@ 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 { @@ -26,11 +39,13 @@ public class NewApplicationProjectWizardPage extends WizardPage { private Composite container; private Text projectParentPathText; private Button btnBrowse; - private Label lblProjectName; + private Label lbl1; private Text projectNameText; private Button useCustomPathButton; - private Label lblFinalProjectPath; + private Label lbl3; private Text projectFinalPathText; + private Label lbl4; + private Combo platformCombo; /** * Constructor for SampleNewWizardPage. @@ -53,19 +68,20 @@ public class NewApplicationProjectWizardPage extends WizardPage { container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; - - lblProjectName = new Label(container, SWT.NONE); - lblProjectName.setText("Project name:"); + /* 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) { - projectNameUpdated(); + 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 @@ -73,11 +89,13 @@ public class NewApplicationProjectWizardPage extends WizardPage { 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(); } } @@ -86,33 +104,49 @@ public class NewApplicationProjectWizardPage extends WizardPage { new Label(container, SWT.NONE); new Label(container, SWT.NONE); - Label lbl1 = new Label(container, SWT.NULL); - lbl1.setText("Project parent path:"); - + /* 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) { - projectPathUpdated(); + 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..."); - lblFinalProjectPath = new Label(container, SWT.NONE); - lblFinalProjectPath.setText("Final project path:"); - + /* 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); - populateWizardPanel(); initialize(); setControl(container); } @@ -121,49 +155,60 @@ public class NewApplicationProjectWizardPage extends WizardPage { * 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); - /* Update checks on the fields.*/ - projectNameUpdated(); - } - /** - * Fills the wizard configuration panel from XML data. - * - * @param configurationTemplateCombo - * the combo box to be populated - */ - private void populateWizardPanel() { - - } - - private void projectNameUpdated() { - String name = projectNameText.getText(); - - updateFinalProjectPathText(); - - if (!isValidFilename(name)) { - updateStatus("Invalid project name."); + /* 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; } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (project.exists()) { - updateStatus("Project exists."); + /* 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; } - updateStatus(null); + + /* 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(); } - private void projectPathUpdated() { - File path = new File(projectParentPathText.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; @@ -172,6 +217,21 @@ public class NewApplicationProjectWizardPage extends WizardPage { 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); } -- cgit v1.2.3 From 18da3cc76dc7753dbb53f2ecd4cd59c81f96905a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 8 Aug 2012 19:14:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4546 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../tools/eclipse/config/handlers/GenerateFiles.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java index c742d9072..b29237fb0 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -28,7 +28,12 @@ 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.IWorkspaceRoot; +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; @@ -117,8 +122,15 @@ public class GenerateFiles extends AbstractHandler { 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(); + } } - /* TODO: refresh output path.*/ return null; } } -- cgit v1.2.3 From c772b5d61e22486616a97e962cb2173c2a536b7d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 9 Aug 2012 12:50:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4547 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 4 +- .../wizards/NewApplicationProjectWizard.java | 127 ++++++++++++++++++++- .../wizards/NewApplicationProjectWizardPage.java | 22 ++++ 3 files changed, 149 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index b7cea1ead..09eb9fe72 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -8,7 +8,9 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, org.eclipse.ui, org.eclipse.ui.console;bundle-version="3.5.100", - org.eclipse.ui.ide + org.eclipse.ui.ide, + org.eclipse.cdt.core;bundle-version="5.4.0", + org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: chibios.org diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java index c5e10de81..7df459b3b 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java @@ -1,16 +1,38 @@ package org.chibios.tools.eclipse.config.wizards; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.cdt.core.CProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.managedbuilder.core.BuildException; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.IManagedProject; +import org.eclipse.cdt.managedbuilder.core.IProjectType; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; +import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +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.IWizardPage; import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; public class NewApplicationProjectWizard extends Wizard implements INewWizard { - private ISelection selection; - private IWizardPage page; + private NewApplicationProjectWizardPage page; + private ISelection selection; + + private String projectName; + private String finalProjectPath; + private String platform; /** * Constructor for ConfigurationNewWizard. @@ -36,7 +58,106 @@ public class NewApplicationProjectWizard extends Wizard implements INewWizard { @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 { + + monitor.beginTask("Creating " + projectName, 3); + + /* Step #1, creates the project file.*/ + IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (newProject.exists()) { + monitor.done(); + MessageDialog.openError(getShell(), "Error", "Project " + projectName + + " already exists in workspace"); + return; + } + + IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName()); + if (finalProjectPath != null) + desc.setLocation(new Path(finalProjectPath)); + CCorePlugin corePlugin = CCorePlugin.getDefault(); + newProject = corePlugin.createCProject(desc, newProject, null, + ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID); + IManagedBuildInfo managedBuildInfo = ManagedBuildManager.createBuildInfo(newProject); + ManagedCProjectNature.addManagedNature(newProject, null); + ManagedCProjectNature.addManagedBuilder(newProject, null); + + IProjectType parentProjectType; + try { + IManagedProject newManagedProject = ManagedBuildManager + .createManagedProject(newProject, ManagedBuildManager.getProjectType("")); + } + catch (BuildException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return; + + +/* + IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName()); + if (finalProjectPath != null) + desc.setLocation(new Path(finalProjectPath)); + try { + newProject.create(desc, null); + if (!newProject.isOpen()) { + newProject.open(null); + } + } catch (CoreException e) { + monitor.done(); + MessageDialog.openError(getShell(), "Error", "Project " + projectName + + " creation failed: " + e.getMessage()); + return; + } + monitor.worked(1);*/ + + /* Step #2, adding builders.*/ +/* desc = newProject.getDescription(); + String[] build_configs = new String[] {ManagedCProjectNature.BUILDER_ID, + "org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder"}; + desc.setBuildConfigs(build_configs); + newProject.setDescription(desc, null);*/ +// CProjectNature.addCNature(newProject, null); +// ManagedCProjectNature.addNature(newProject, ManagedCProjectNature.MNG_NATURE_ID, null); +// ManagedCProjectNature.addNature(newProject, "org.eclipse.cdt.managedbuilder.core.ScannerConfigNature", null); +// ManagedCProjectNature.addManagedBuilder(newProject, null); +// 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 index efc377014..ca22d46c2 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java @@ -203,6 +203,28 @@ public class NewApplicationProjectWizardPage extends WizardPage { projectPageUpdated(); } + 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(); -- cgit v1.2.3 From 06057a5a8124dcbc3ea4430bafdd91f9f12ce96c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 9 Aug 2012 14:47:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4548 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../wizards/NewApplicationProjectWizard.java | 92 ++++++++-------------- 1 file changed, 34 insertions(+), 58 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java index 7df459b3b..8f0ff5471 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java @@ -2,20 +2,23 @@ package org.chibios.tools.eclipse.config.wizards; import java.lang.reflect.InvocationTargetException; -import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.managedbuilder.core.BuildException; -import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; -import org.eclipse.cdt.managedbuilder.core.IManagedProject; -import org.eclipse.cdt.managedbuilder.core.IProjectType; +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.core.ManagedBuilderCorePlugin; -import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; +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.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -25,6 +28,7 @@ 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; @@ -97,67 +101,39 @@ public class NewApplicationProjectWizard extends Wizard implements INewWizard { */ 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 newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (newProject.exists()) { + IProject project = root.getProject(projectName); + if (project.exists()) { monitor.done(); MessageDialog.openError(getShell(), "Error", "Project " + projectName + " already exists in workspace"); return; } - - IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName()); - if (finalProjectPath != null) - desc.setLocation(new Path(finalProjectPath)); - CCorePlugin corePlugin = CCorePlugin.getDefault(); - newProject = corePlugin.createCProject(desc, newProject, null, - ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID); - IManagedBuildInfo managedBuildInfo = ManagedBuildManager.createBuildInfo(newProject); - ManagedCProjectNature.addManagedNature(newProject, null); - ManagedCProjectNature.addManagedBuilder(newProject, null); - - IProjectType parentProjectType; - try { - IManagedProject newManagedProject = ManagedBuildManager - .createManagedProject(newProject, ManagedBuildManager.getProjectType("")); - } - catch (BuildException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return; - - -/* - IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName()); + IProjectDescription desc = project.getWorkspace().newProjectDescription(projectName); if (finalProjectPath != null) desc.setLocation(new Path(finalProjectPath)); - try { - newProject.create(desc, null); - if (!newProject.isOpen()) { - newProject.open(null); - } - } catch (CoreException e) { - monitor.done(); - MessageDialog.openError(getShell(), "Error", "Project " + projectName + - " creation failed: " + e.getMessage()); - return; - } - monitor.worked(1);*/ - - /* Step #2, adding builders.*/ -/* desc = newProject.getDescription(); - String[] build_configs = new String[] {ManagedCProjectNature.BUILDER_ID, - "org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder"}; - desc.setBuildConfigs(build_configs); - newProject.setDescription(desc, null);*/ -// CProjectNature.addCNature(newProject, null); -// ManagedCProjectNature.addNature(newProject, ManagedCProjectNature.MNG_NATURE_ID, null); -// ManagedCProjectNature.addNature(newProject, "org.eclipse.cdt.managedbuilder.core.ScannerConfigNature", null); -// ManagedCProjectNature.addManagedBuilder(newProject, null); -// monitor.worked(1); + project.create(desc, null); + + /* Step #2, makes it a CDT project.*/ + desc = workspace.newProjectDescription(projectName); + project = CCorePlugin.getDefault().createCDTProject(desc, project, new NullProgressMonitor()); + + 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); } } -- cgit v1.2.3 From d768fddeebe413f488a3c177cbc0145e08600a34 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 9 Aug 2012 14:51:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4549 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../tools/eclipse/config/wizards/NewApplicationProjectWizard.java | 3 +-- .../tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java index 8f0ff5471..f2488b74b 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java @@ -18,7 +18,6 @@ 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.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -122,7 +121,7 @@ public class NewApplicationProjectWizard extends Wizard implements INewWizard { /* Step #2, makes it a CDT project.*/ desc = workspace.newProjectDescription(projectName); - project = CCorePlugin.getDefault().createCDTProject(desc, project, new NullProgressMonitor()); + project = CCorePlugin.getDefault().createCDTProject(desc, project, null); ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); ICProjectDescription cdesc = mngr.createProjectDescription(project, false); diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java index ca22d46c2..5513bc5bf 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java @@ -162,7 +162,6 @@ public class NewApplicationProjectWizardPage extends WizardPage { projectParentPathText.setEnabled(false); btnBrowse.setEnabled(false); - /* Retrieving the resource path of the processors.xml file. */ String fpath; try { @@ -201,6 +200,9 @@ public class NewApplicationProjectWizardPage extends WizardPage { /* Update checks on the fields.*/ projectPageUpdated(); + + /* Focus on the first editable field.*/ + projectNameText.setFocus(); } public String getProjectName() { -- cgit v1.2.3 From 733166973d4dc88521555e14d4bb118f62989bbc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 10 Aug 2012 14:01:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4551 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 3 +- tools/eclipse/config_wizard/plugin.xml | 33 ++++++++- .../resources/app_templates/c/template.xml | 82 ++++++++++++++++++++++ .../eclipse/config/handlers/CheckDescription.java | 1 + .../eclipse/config/handlers/GenerateFiles.java | 5 -- .../process/ApplicationGeneratorProcessRunner.java | 37 ++++++++++ .../tools/eclipse/config/utils/TemplateEngine.java | 29 ++++++-- .../wizards/NewApplicationProjectWizard.java | 20 ++++++ .../wizards/NewApplicationProjectWizardPage.java | 24 ++++++- 9 files changed, 216 insertions(+), 18 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/app_templates/c/template.xml create mode 100644 tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 09eb9fe72..c65afaa46 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.ui.console;bundle-version="3.5.100", org.eclipse.ui.ide, org.eclipse.cdt.core;bundle-version="5.4.0", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0" + org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0", + org.eclipse.cdt.ui;bundle-version="5.4.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: chibios.org diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml index 7098032c8..5e8e23e7d 100644 --- a/tools/eclipse/config_wizard/plugin.xml +++ b/tools/eclipse/config_wizard/plugin.xml @@ -25,7 +25,8 @@ - + @@ -33,7 +34,8 @@ - + + + + + + + + + + + + + + + diff --git a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml new file mode 100644 index 000000000..0bcf782ec --- /dev/null +++ b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml @@ -0,0 +1,82 @@ + + diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java index f9e8cd6bf..0d7e7e292 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/CheckDescription.java @@ -33,6 +33,7 @@ import org.eclipse.jface.dialogs.MessageDialog; * @see org.eclipse.core.commands.AbstractHandler */ public class CheckDescription extends AbstractHandler { + /** * The constructor. */ diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java index b29237fb0..aad5adfce 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java @@ -31,7 +31,6 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.FileLocator; @@ -98,13 +97,10 @@ public class GenerateFiles extends AbstractHandler { /* Calculating derived paths. */ IPath tpath = new Path(templates_path); - IPath libpath = new Path("resources/gencfg/lib"); try { Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); tpath = new Path(FileLocator.toFileURL( FileLocator.find(bundle, tpath, null)).getFile()); - libpath = new Path(FileLocator.toFileURL( - FileLocator.find(bundle, libpath, null)).getFile()); } catch (IOException e) { MessageDialog.openInformation(window.getShell(), "Path Error", e.getMessage()); @@ -114,7 +110,6 @@ public class GenerateFiles extends AbstractHandler { /* Templates execution. */ try { TemplateEngine.process(cfgfilepath.toFile(), - libpath.toFile(), tpath.toFile(), new File(output_path)); } catch (TemplateException e) { diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java new file mode 100644 index 000000000..e85442d81 --- /dev/null +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/process/ApplicationGeneratorProcessRunner.java @@ -0,0 +1,37 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +package org.chibios.tools.eclipse.config.process; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.core.runtime.IProgressMonitor; + +public class ApplicationGeneratorProcessRunner extends ProcessRunner { + + @Override + public void process(TemplateCore template, ProcessArgument[] args, + String processId, IProgressMonitor monitor) + throws ProcessFailureException { + + } +} diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java index 60a33f0e2..ce1e5325a 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java @@ -20,7 +20,6 @@ package org.chibios.tools.eclipse.config.utils; -import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -28,6 +27,10 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; @@ -43,9 +46,12 @@ import org.eclipse.ui.console.IConsoleManager; import org.eclipse.ui.console.IConsoleView; import org.eclipse.ui.console.MessageConsole; import org.eclipse.ui.console.MessageConsoleStream; +import org.osgi.framework.Bundle; import org.w3c.dom.Document; import org.xml.sax.SAXException; +import config_wizard.Activator; + import fmpp.Engine; import fmpp.ProcessingException; import fmpp.ProgressListener; @@ -77,8 +83,6 @@ public class TemplateEngine { * * @param xmldata * absolute path to XML data file - * @param libdir - * absolute path to libraries directory * @param sourcedir * absolute path to templates directory * @param outputdir @@ -88,7 +92,6 @@ public class TemplateEngine { * @throws ProcessingException */ public static void process(java.io.File xmldata, - java.io.File libdir, java.io.File sourcedir, java.io.File outputdir) throws TemplateException { @@ -105,6 +108,19 @@ public class TemplateEngine { 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. @@ -169,8 +185,7 @@ public class TemplateEngine { Document dom1, dom_snippets; try { dom1 = db.parse(xmldata); - java.io.File xmlsnippets = new File(libdir.toString() + - "/code_snippets.xml"); + java.io.File xmlsnippets = libpath.addTrailingSeparator().append("code_snippets.xml").toFile(); dom_snippets = db.parse(xmlsnippets); } catch (SAXException e) { throw new TemplateException(e.getMessage()); @@ -191,7 +206,7 @@ public class TemplateEngine { /* Setting libraries path. */ HashMap libs = new HashMap(); - libs.put("lib", libdir.toString()); + libs.put("lib", libpath.toString()); /* Other settings. */ try { diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java index f2488b74b..b94df01cc 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizard.java @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.config.wizards; import java.lang.reflect.InvocationTargetException; diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java index 5513bc5bf..b2daabeac 100644 --- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java +++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/NewApplicationProjectWizardPage.java @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.config.wizards; import java.io.File; @@ -35,7 +55,6 @@ import config_wizard.Activator; public class NewApplicationProjectWizardPage extends WizardPage { - private ISelection selection; private Composite container; private Text projectParentPathText; private Button btnBrowse; @@ -55,7 +74,6 @@ public class NewApplicationProjectWizardPage extends WizardPage { super("wizardPage"); setTitle("ChibiOS/RT New Application Project Wizard"); setDescription("This wizard creates a new ChibiOS/RT application project."); - this.selection = selection; } /** @@ -200,7 +218,7 @@ public class NewApplicationProjectWizardPage extends WizardPage { /* Update checks on the fields.*/ projectPageUpdated(); - + /* Focus on the first editable field.*/ projectNameText.setFocus(); } -- cgit v1.2.3 From 4b29805c33d4352672086ab44e861c6818195d15 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 10 Aug 2012 17:28:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4552 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index c65afaa46..30e998e6f 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -4,14 +4,14 @@ Bundle-Name: ChibiOS-RT_Configuration_Support Bundle-SymbolicName: org.chibios.tools.eclipse.config;singleton:=true Bundle-Version: 1.2.0 Bundle-Activator: config_wizard.Activator -Require-Bundle: org.eclipse.core.resources, - org.eclipse.core.runtime, - org.eclipse.ui, +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, - org.eclipse.cdt.core;bundle-version="5.4.0", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0", - org.eclipse.cdt.ui;bundle-version="5.4.0" + 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 -- cgit v1.2.3 From 023c9515e432b94ec4a71b563729f03cc3e1d381 Mon Sep 17 00:00:00 2001 From: barthess Date: Tue, 14 Aug 2012 18:10:06 +0000 Subject: Added simple script for massive file changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4571 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/edit_aid/rebalance_prio.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 tools/edit_aid/rebalance_prio.sh (limited to 'tools') diff --git a/tools/edit_aid/rebalance_prio.sh b/tools/edit_aid/rebalance_prio.sh new file mode 100755 index 000000000..c831684b8 --- /dev/null +++ b/tools/edit_aid/rebalance_prio.sh @@ -0,0 +1,13 @@ +#!/bin/bash +FILES=`find -name 'mcuconf.h'` +for i in $FILES +do + cp $i ${i}_backup + cat ${i}_backup | \ + sed -e 's/\(#define STM32_I2C_I2C[0-9]_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\25/' | \ + sed -e 's/\(#define STM32_I2C_I2C[0-9]_DMA_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\23/' | \ + sed -e 's/\(#define STM32_ADC_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' | \ + sed -e 's/\(#define STM32_ADC_ADC[0-9]_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' | \ + sed -e 's/\(#define STM32_ADC_ADC[0-9]_DMA_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' > $i + rm ${i}_backup +done -- cgit v1.2.3 From 5e4b039d56d93520f36f0c775e3cdc95c2f03e04 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 24 Aug 2012 09:19:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4621 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- 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 0 -> 983 bytes tools/eclipse/debug_support/plugin.xml | 38 ++ .../tools/eclipse/debug/activator/Activator.java | 68 +++ .../tools/eclipse/debug/utils/DebugProxy.java | 562 ++++++++++++++++++++ .../eclipse/debug/utils/DebugProxyException.java | 14 + .../tools/eclipse/debug/utils/HexUtils.java | 94 ++++ .../tools/eclipse/debug/views/ChibiView.java | 565 +++++++++++++++++++++ .../src/org/eclipse/wb/swt/ResourceManager.java | 415 +++++++++++++++ .../src/org/eclipse/wb/swt/SWTResourceManager.java | 447 ++++++++++++++++ 15 files changed, 2279 insertions(+) create mode 100644 tools/eclipse/debug_support/.classpath create mode 100644 tools/eclipse/debug_support/.project create mode 100644 tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs create mode 100644 tools/eclipse/debug_support/META-INF/MANIFEST.MF create mode 100644 tools/eclipse/debug_support/build.properties create mode 100644 tools/eclipse/debug_support/contexts.xml create mode 100644 tools/eclipse/debug_support/icons/sample.gif create mode 100644 tools/eclipse/debug_support/plugin.xml create mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java create mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java create mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java create mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java create mode 100644 tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java create mode 100644 tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java create mode 100644 tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java (limited to 'tools') diff --git a/tools/eclipse/debug_support/.classpath b/tools/eclipse/debug_support/.classpath new file mode 100644 index 000000000..8a8f1668c --- /dev/null +++ b/tools/eclipse/debug_support/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tools/eclipse/debug_support/.project b/tools/eclipse/debug_support/.project new file mode 100644 index 000000000..eb8a22dc0 --- /dev/null +++ b/tools/eclipse/debug_support/.project @@ -0,0 +1,28 @@ + + + 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 new file mode 100644 index 000000000..c63fde790 --- /dev/null +++ b/tools/eclipse/debug_support/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 000000000..2908664cf --- /dev/null +++ b/tools/eclipse/debug_support/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +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 new file mode 100644 index 000000000..255e23b61 --- /dev/null +++ b/tools/eclipse/debug_support/build.properties @@ -0,0 +1,7 @@ +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 new file mode 100644 index 000000000..02e26e45c --- /dev/null +++ b/tools/eclipse/debug_support/contexts.xml @@ -0,0 +1,12 @@ + + + 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 new file mode 100644 index 000000000..34fb3c9d8 Binary files /dev/null and b/tools/eclipse/debug_support/icons/sample.gif differ diff --git a/tools/eclipse/debug_support/plugin.xml b/tools/eclipse/debug_support/plugin.xml new file mode 100644 index 000000000..b6102196c --- /dev/null +++ b/tools/eclipse/debug_support/plugin.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000..0e3b8d1e9 --- /dev/null +++ b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/activator/Activator.java @@ -0,0 +1,68 @@ +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 new file mode 100644 index 000000000..b673d9610 --- /dev/null +++ b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxy.java @@ -0,0 +1,562 @@ +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 new file mode 100644 index 000000000..ce4a0331f --- /dev/null +++ b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/DebugProxyException.java @@ -0,0 +1,14 @@ +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 new file mode 100644 index 000000000..54727e573 --- /dev/null +++ b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/utils/HexUtils.java @@ -0,0 +1,94 @@ +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 new file mode 100644 index 000000000..4cc7fd48e --- /dev/null +++ b/tools/eclipse/debug_support/src/org/chibios/tools/eclipse/debug/views/ChibiView.java @@ -0,0 +1,565 @@ +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 new file mode 100644 index 000000000..4bfbc6b6e --- /dev/null +++ b/tools/eclipse/debug_support/src/org/eclipse/wb/swt/ResourceManager.java @@ -0,0 +1,415 @@ +/******************************************************************************* + * 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 new file mode 100644 index 000000000..8b6d4cc3f --- /dev/null +++ b/tools/eclipse/debug_support/src/org/eclipse/wb/swt/SWTResourceManager.java @@ -0,0 +1,447 @@ +/******************************************************************************* + * 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 -- cgit v1.2.3 From e28ed2cd55f4facd6639e540316481ec99e5f6e1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 24 Aug 2012 09:29:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4622 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/.project | 2 +- .../tools/eclipse/debug/activator/Activator.java | 20 ++++++++++++++++++++ .../tools/eclipse/debug/utils/DebugProxy.java | 20 ++++++++++++++++++++ .../eclipse/debug/utils/DebugProxyException.java | 20 ++++++++++++++++++++ .../chibios/tools/eclipse/debug/utils/HexUtils.java | 20 ++++++++++++++++++++ .../chibios/tools/eclipse/debug/views/ChibiView.java | 20 ++++++++++++++++++++ 6 files changed, 101 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/.project b/tools/eclipse/config_wizard/.project index 7df6fc0f9..6611705c5 100644 --- a/tools/eclipse/config_wizard/.project +++ b/tools/eclipse/config_wizard/.project @@ -1,6 +1,6 @@ - config_wizard + Tool Config Wizard 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 index 0e3b8d1e9..b2cfc6098 100644 --- 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 @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.debug.activator; import org.eclipse.jface.resource.ImageDescriptor; 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 index b673d9610..6104b840b 100644 --- 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 @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.debug.utils; import java.util.HashMap; 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 index ce4a0331f..62b791732 100644 --- 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 @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.debug.utils; public class DebugProxyException extends Exception { 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 index 54727e573..983561cb0 100644 --- 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 @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.debug.utils; public class HexUtils { 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 index 4cc7fd48e..597a837c2 100644 --- 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 @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + package org.chibios.tools.eclipse.debug.views; import java.util.HashMap; -- cgit v1.2.3 From 980fa49caf3343cb3bc098ab97bff184a83c82d7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 8 Oct 2012 12:55:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4739 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/resources/app_templates/c/template.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml index 0bcf782ec..9b2b51fdd 100644 --- a/tools/eclipse/config_wizard/resources/app_templates/c/template.xml +++ b/tools/eclipse/config_wizard/resources/app_templates/c/template.xml @@ -5,7 +5,7 @@ supplier="chibios.org" revision="1.0" author="Giovanni Di Sirio" - id="xxx" + id="org.chibios.tools.eclipse.newchibiproject" label="ChibiOS/RT C Application" description="Template of a ChibiOS/RT C application based on makefiles." preview-icon="icons/chibios.gif"> -- cgit v1.2.3 From a5de0f57f49d16166069905927df1422e53d4c1f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 25 Oct 2012 13:09:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4779 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/plugin.xml | 3 + .../boards/stm32f3xx/templates/board.c.ftl | 133 ++++ .../boards/stm32f3xx/templates/board.h.ftl | 327 +++++++++ .../boards/stm32f3xx/templates/board.mk.ftl | 28 + .../resources/gencfg/processors/processors.xml | 24 +- .../gencfg/schema/boards/stm32f0xx_board.xsd | 11 + .../gencfg/schema/boards/stm32f3xx_board.xsd | 100 +++ .../gencfg/schema/boards/stm32f4xx_board.xsd | 49 +- .../gencfg/schema/boards/stm32l1xx_board.xsd | 16 +- .../resources/gencfg/xml/stm32f3board.xml | 797 +++++++++++++++++++++ 10 files changed, 1453 insertions(+), 35 deletions(-) create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl create mode 100644 tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd create mode 100644 tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml (limited to 'tools') diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml index 5e8e23e7d..d8c660eea 100644 --- a/tools/eclipse/config_wizard/plugin.xml +++ b/tools/eclipse/config_wizard/plugin.xml @@ -40,6 +40,9 @@ + 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 new file mode 100644 index 000000000..03a4df8c3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.c.ftl @@ -0,0 +1,133 @@ +[#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 new file mode 100644 index 000000000..da8169026 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.h.ftl @@ -0,0 +1,327 @@ +[#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 new file mode 100644 index 000000000..c88471ac3 --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/boards/stm32f3xx/templates/board.mk.ftl @@ -0,0 +1,28 @@ +[#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 index 30a70c069..b4998fd9a 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/processors/processors.xml @@ -5,6 +5,12 @@ 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 @@ -17,22 +23,4 @@ resources/gencfg/xml/stm32l1board.xml board - - STM32F0xx Build Environment Configuration - resources/gencfg/processors/builds/stm32f0xx/templates - resources/gencfg/xml/stm32f0build.xml - build - - - STM32F4xx Build Environment Configuration - resources/gencfg/processors/builds/stm32f4xx/templates - resources/gencfg/xml/stm32f4build.xml - build - - - STM32L1xx Build Environment Configuration - resources/gencfg/processors/builds/stm32l1xx/templates - resources/gencfg/xml/stm32l1build.xml - build - 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 index 6fe520699..59b6e3d68 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd @@ -30,6 +30,17 @@ + + + + + + + + + + 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 new file mode 100644 index 000000000..74ad4d7ba --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f3xx_board.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 index 072880711..f0d5a0a87 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd @@ -12,27 +12,46 @@ - - - - - - - - + + + + + + + + + - + - + + - + + + + + + + + + + + - + + @@ -41,14 +60,16 @@ - + + - + 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 index 448a51a9c..01350cc7c 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32l1xx_board.xsd @@ -30,19 +30,29 @@ + + + + + + + + + + - - + + minOccurs="1"> diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml new file mode 100644 index 000000000..4213e137b --- /dev/null +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml @@ -0,0 +1,797 @@ + + + + + resources/gencfg/processors/boards/stm32f3xx/templates + . + + -----human readable board name----- + BOARD_IDENTIFIER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From a581d62ddbb1afe3fe904614633a9bfe0efa9804 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 Dec 2012 09:40:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4865 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/.classpath | 2 +- tools/eclipse/config_wizard/build.properties | 32 ++-------------------------- 2 files changed, 3 insertions(+), 31 deletions(-) (limited to 'tools') diff --git a/tools/eclipse/config_wizard/.classpath b/tools/eclipse/config_wizard/.classpath index 232d040e3..724303fa9 100644 --- a/tools/eclipse/config_wizard/.classpath +++ b/tools/eclipse/config_wizard/.classpath @@ -2,7 +2,7 @@ - + diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties index 81715159f..008ba6d91 100644 --- a/tools/eclipse/config_wizard/build.properties +++ b/tools/eclipse/config_wizard/build.properties @@ -3,34 +3,6 @@ output.. = bin/ bin.includes = plugin.xml,\ META-INF/,\ .,\ - lib/bsh.jar,\ - lib/fmpp.jar,\ - lib/freemarker.jar,\ - lib/oro.jar,\ - lib/resolver.jar,\ - lib/jdom-2.0.2.jar,\ - resources/gencfg/lib/libcode.ftl,\ - resources/gencfg/lib/liblicense.ftl,\ - resources/gencfg/lib/libstm32f4xx.ftl,\ - resources/gencfg/lib/libutils.ftl,\ - resources/gencfg/processors/processors.xml,\ - resources/gencfg/processors/boards/stm32f4xx/templates/board.c.ftl,\ - resources/gencfg/processors/boards/stm32f4xx/templates/board.h.ftl,\ - resources/gencfg/processors/boards/stm32f4xx/templates/board.mk.ftl,\ - resources/gencfg/schema/boards/abstract_board.xsd,\ - resources/gencfg/schema/boards/stm32f4xx_board.xsd,\ - resources/gencfg/schema/common/doc.xsd,\ - resources/gencfg/schema/common/stm32/stm32_gpiov2_port.xsd,\ - resources/gencfg/xml/stm32f4board.xml,\ icons/,\ - resources/gencfg/processors/boards/stm32f0xx/templates/board.c.ftl,\ - resources/gencfg/processors/boards/stm32f0xx/templates/board.h.ftl,\ - resources/gencfg/processors/boards/stm32f0xx/templates/board.mk.ftl,\ - resources/gencfg/schema/boards/stm32f0xx_board.xsd,\ - resources/gencfg/xml/stm32f0board.xml,\ - resources/gencfg/processors/boards/stm32l1xx/templates/board.c.ftl,\ - resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl,\ - resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl,\ - resources/gencfg/schema/boards/stm32l1xx_board.xsd,\ - resources/gencfg/xml/stm32l1board.xml,\ - resources/gencfg/schema/common/config_settings.xsd + lib/,\ + resources/ -- cgit v1.2.3 From 247b5f5fc88eab8724d5c199c57aa9c005f4ffc6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 Dec 2012 10:20:21 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4866 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../resources/gencfg/xml/stm32f3board.xml | 2 +- .../org.chibios.tools.eclipse.config_1.1.0.jar | Bin 1851193 -> 0 bytes .../org.chibios.tools.eclipse.config_1.2.0.jar | Bin 0 -> 1875314 bytes 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar (limited to 'tools') diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml index 4213e137b..a552903be 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml +++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f3board.xml @@ -1,5 +1,5 @@ - + diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar deleted file mode 100644 index 31587f214..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.1.0.jar and /dev/null differ diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar new file mode 100644 index 000000000..dfe509154 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar differ -- cgit v1.2.3 From 633098ebcd87d2a654deede6feff0d93fdabaebc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 6 Dec 2012 10:53:16 +0000 Subject: STM32F3 SPI working, STM32F0 support update. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4879 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- tools/eclipse/config_wizard/META-INF/MANIFEST.MF | 2 +- .../processors/boards/stm32f0xx/templates/board.h.ftl | 10 ++++++++-- .../gencfg/schema/boards/stm32f0xx_board.xsd | 13 +++++++++++++ .../org.chibios.tools.eclipse.config_1.2.0.jar | Bin 1875314 -> 0 bytes .../org.chibios.tools.eclipse.config_1.2.1.jar | Bin 0 -> 1875433 bytes 5 files changed, 22 insertions(+), 3 deletions(-) delete mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar create mode 100644 tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar (limited to 'tools') diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF index 30e998e6f..37f4f5b08 100644 --- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF +++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ 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.0 +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", 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 index 30fda47df..6eb360b6c 100644 --- 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 @@ -47,8 +47,8 @@ [#if doc1.board.ethernet_phy.bus_type[0]?string == "RMII"] #define BOARD_PHY_RMII [/#if] -[/#if] +[/#if] /* * Board oscillators-related settings. [#if doc1.board.clocks.@LSEFrequency[0]?number == 0] @@ -62,14 +62,20 @@ #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] +[/#if] /* * MCU type as defined in the ST header file stm32f0xx.h. */ 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 index 59b6e3d68..fb41cf6ea 100644 --- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd +++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f0xx_board.xsd @@ -41,6 +41,19 @@ + + + + + + + + + + + + diff --git a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar deleted file mode 100644 index dfe509154..000000000 Binary files a/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.0.jar and /dev/null differ 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 new file mode 100644 index 000000000..e29e8a946 Binary files /dev/null and b/tools/eclipse/plugins/org.chibios.tools.eclipse.config_1.2.1.jar differ -- cgit v1.2.3 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 - tools/edit_aid/rebalance_prio.sh | 13 - 78 files changed, 11305 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 delete mode 100755 tools/edit_aid/rebalance_prio.sh (limited to 'tools') 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. diff --git a/tools/edit_aid/rebalance_prio.sh b/tools/edit_aid/rebalance_prio.sh deleted file mode 100755 index c831684b8..000000000 --- a/tools/edit_aid/rebalance_prio.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -FILES=`find -name 'mcuconf.h'` -for i in $FILES -do - cp $i ${i}_backup - cat ${i}_backup | \ - sed -e 's/\(#define STM32_I2C_I2C[0-9]_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\25/' | \ - sed -e 's/\(#define STM32_I2C_I2C[0-9]_DMA_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\23/' | \ - sed -e 's/\(#define STM32_ADC_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' | \ - sed -e 's/\(#define STM32_ADC_ADC[0-9]_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' | \ - sed -e 's/\(#define STM32_ADC_ADC[0-9]_DMA_IRQ_PRIORITY\)\([ ]*\)\([0-9]*\)/\1\26/' > $i - rm ${i}_backup -done -- cgit v1.2.3