aboutsummaryrefslogtreecommitdiff
path: root/include/libopencm3/efm32
diff options
context:
space:
mode:
authorchrysn2012-10-18 18:00:28 +0200
committerchrysn2012-10-18 18:00:28 +0200
commit771f504757e0ac5553c95308ce66412b417fa8d1 (patch)
treea46efc5067f2bec546514cdfccaddd0587cc6268 /include/libopencm3/efm32
parent172ce56e3cbc7e64fd3e6a3dc564eb10e0ca766a (diff)
parentc69916ffb6d515b1dd644830ba27daef4fc75b58 (diff)
vector.c unification
this makes the previous hackish vector.c assemblies into dispatched files (using the same mechanism as for nvic, just this time in lib). the old irq.h files that were generated manually from the old vector.c files were dropped in the process, as were the nvic.h files, and replaced with very simple yaml lists that generate the headers. file generation takes place both in the include/ and the lib/ part, as some of it is definitely header stuff (the NVIC_name_IRQ defines), and some of it needs to be included in specific compilation units (the weak pragmas).
Diffstat (limited to 'include/libopencm3/efm32')
-rw-r--r--include/libopencm3/efm32/tinygecko/Makefile2
-rw-r--r--include/libopencm3/efm32/tinygecko/irq.yaml2
-rwxr-xr-xinclude/libopencm3/efm32/tinygecko/irq2nvic_h92
3 files changed, 1 insertions, 95 deletions
diff --git a/include/libopencm3/efm32/tinygecko/Makefile b/include/libopencm3/efm32/tinygecko/Makefile
deleted file mode 100644
index 4ac5347..0000000
--- a/include/libopencm3/efm32/tinygecko/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-nvic.h: irq.yaml
- ./irq2nvic_h
diff --git a/include/libopencm3/efm32/tinygecko/irq.yaml b/include/libopencm3/efm32/tinygecko/irq.yaml
index 16fa69c..da954f6 100644
--- a/include/libopencm3/efm32/tinygecko/irq.yaml
+++ b/include/libopencm3/efm32/tinygecko/irq.yaml
@@ -1,4 +1,4 @@
-includeguard: LIBOPENCM3_EFM32_TINYGECKO_VECTOR_H
+includeguard: LIBOPENCM3_EFM32_TINYGECKO_NVIC_H
partname_humanreadable: EFM32 Tiny Gecko series
partname_doxygen: EFM32TG
# The names and sequence are taken from d0034_efm32tg_reference_manual.pdf table 4.1.
diff --git a/include/libopencm3/efm32/tinygecko/irq2nvic_h b/include/libopencm3/efm32/tinygecko/irq2nvic_h
deleted file mode 100755
index a7df16e..0000000
--- a/include/libopencm3/efm32/tinygecko/irq2nvic_h
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of the libopencm3 project.
-#
-# Copyright (C) 2012 chrysn <chrysn@fsfe.org>
-#
-# This library is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This library 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 Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library. If not, see <http://www.gnu.org/licenses/>.
-
-import sys
-import yaml
-
-template = '''\
-/* This file is part of the libopencm3 project.
- *
- * It was generated by the irq2nvic_h script.
- */
-
-#ifndef {includeguard}
-#define {includeguard}
-
-/** @defgroup CM3_nvic_defines_{partname_doxygen} User interrupts for {partname_humanreadable}
- @ingroup CM3_nvic_defines
-
- @{{*/
-
-{irqdefinitions}
-
-#define NVIC_IRQ_COUNT {irqcount}
-
-/**@}}*/
-
-#define WEAK __attribute__ ((weak))
-
-/** @defgroup CM3_nvic_isrprototypes_{partname_doxygen} User interrupt service routines (ISR) prototypes for {partname_humanreadable}
- @ingroup CM3_nvic_isrprototypes
-
- @{{*/
-
-{isrprototypes}
-
-/**@}}*/
-
-/** @defgroup CM3_nvic_isrpragmas_{partname_doxygen} User interrupt service routines (ISR) defaults for {partname_humanreadable}
- @ingroup CM3_nvic_isrpragmas
-
- @{{*/
-
-{isrpragmas}
-
-/**@}}*/
-
-/* Initialization template for the interrupt vector table. This definition is
- * used by the startup code generator (vector.c) to set the initial values for
- * the interrupt handling routines to the chip family specific _isr weak
- * symbols. */
-
-#define IRQ_HANDLERS \\
- {vectortableinitialization}
-
-#endif /* {includeguard} */
-'''
-
-def convert(infile, outfile):
- data = yaml.load(infile)
-
- irq2name = list(enumerate(data['irqs']) if isinstance(data['irqs'], list) else data['irqs'].items())
- irqnames = [v for (k,v) in irq2name]
-
- data['irqdefinitions'] = "\n".join('#define NVIC_%s_IRQ %d'%(v.upper(),k) for (k,v) in irq2name)
- data['irqcount'] = len(irq2name) # FIXME: what if it's a sparse dictionary?
- data['isrprototypes'] = "\n".join('void WEAK %s_isr(void);'%name.lower() for name in irqnames)
- data['isrpragmas'] = "\n".join('#pragma weak %s_isr = blocking_handler'%name.lower() for name in irqnames)
- data['vectortableinitialization'] = ', \\\n '.join('[NVIC_%s_IRQ] = %s_isr'%(name.upper(), name.lower()) for name in irqnames)
-
- outfile.write(template.format(**data))
-
-def main():
- convert(open('irq.yaml'), open('nvic.h', 'w'))
-
-if __name__ == "__main__":
- main()