aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorchrysn2012-10-18 18:00:28 +0200
committerchrysn2012-10-18 18:00:28 +0200
commit771f504757e0ac5553c95308ce66412b417fa8d1 (patch)
treea46efc5067f2bec546514cdfccaddd0587cc6268 /lib
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 'lib')
-rw-r--r--lib/cm3/vector.c8
-rw-r--r--lib/dispatch/vector.c11
-rw-r--r--lib/dispatch/vector_nvic.c19
-rw-r--r--lib/efm32/tinygecko/vector.c2
-rw-r--r--lib/lm3s/vector.c2
-rw-r--r--lib/lpc17xx/vector.c2
-rw-r--r--lib/lpc43xx/vector.c8
-rw-r--r--lib/stm32/f1/vector.c2
-rw-r--r--lib/stm32/f2/vector.c2
-rw-r--r--lib/stm32/f4/vector.c8
10 files changed, 40 insertions, 24 deletions
diff --git a/lib/cm3/vector.c b/lib/cm3/vector.c
index 200e8e5..a6d2e93 100644
--- a/lib/cm3/vector.c
+++ b/lib/cm3/vector.c
@@ -20,6 +20,11 @@
#include <libopencm3/cm3/vector.h>
+/* load optional platform dependent initialization routines */
+#include "../dispatch/vector.c"
+/* load the weak symbols for IRQ_HANDLERS */
+#include "../dispatch/vector_nvic.c"
+
#define WEAK __attribute__ ((weak))
/* Symbols exported by the linker script(s): */
@@ -70,6 +75,9 @@ void WEAK reset_handler(void)
while (dest < &_ebss)
*dest++ = 0;
+ /* might be provided by platform specific vector.c */
+ pre_main();
+
/* Call the application's entry point. */
main();
}
diff --git a/lib/dispatch/vector.c b/lib/dispatch/vector.c
new file mode 100644
index 0000000..baab436
--- /dev/null
+++ b/lib/dispatch/vector.c
@@ -0,0 +1,11 @@
+#if defined(STM32F4)
+# include "../stm32/f4/vector.c"
+
+#elif defined(LPC43XX)
+# include "../lpc43xx/vector.c"
+
+#else
+
+static void pre_main(void) {}
+
+#endif
diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c
new file mode 100644
index 0000000..fc5fdd2
--- /dev/null
+++ b/lib/dispatch/vector_nvic.c
@@ -0,0 +1,19 @@
+#if defined(STM32F1)
+# include "../stm32/f1/vector_nvic.c"
+#elif defined(STM32F2)
+# include "../stm32/f2/vector_nvic.c"
+#elif defined(STM32F4)
+# include "../stm32/f4/vector_nvic.c"
+
+#elif defined(TINYGECKO)
+# include "../efm32/tinygecko/vector_nvic.c"
+
+#elif defined(LPC43XX)
+# include "../lpc43xx/vector_nvic.c"
+
+#else
+# warning"no chipset defined; user interrupts are disabled"
+
+#define IRQ_HANDLERS
+
+#endif
diff --git a/lib/efm32/tinygecko/vector.c b/lib/efm32/tinygecko/vector.c
deleted file mode 100644
index d6da5a2..0000000
--- a/lib/efm32/tinygecko/vector.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <libopencm3/efm32/tinygecko/irq.h>
-#include "../../cm3/vector.c"
diff --git a/lib/lm3s/vector.c b/lib/lm3s/vector.c
deleted file mode 100644
index e9e7e06..0000000
--- a/lib/lm3s/vector.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <libopencm3/lm3s/irq.h>
-#include "../cm3/vector.c"
diff --git a/lib/lpc17xx/vector.c b/lib/lpc17xx/vector.c
deleted file mode 100644
index 61342f4..0000000
--- a/lib/lpc17xx/vector.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <libopencm3/lpc17xx/irq.h>
-#include "../cm3/vector.c"
diff --git a/lib/lpc43xx/vector.c b/lib/lpc43xx/vector.c
index 66e9b63..0463a65 100644
--- a/lib/lpc43xx/vector.c
+++ b/lib/lpc43xx/vector.c
@@ -18,17 +18,13 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <libopencm3/lpc43xx/irq.h>
-#define reset_handler original_reset_handler
-#include "../cm3/vector.c"
-#undef reset_handler
#include <libopencm3/cm3/common.h>
extern unsigned _etext_ram, _text_ram, _etext_rom;
#define CREG_M4MEMMAP MMIO32( (0x40043000 + 0x100) )
-void WEAK reset_handler(void)
+static void pre_main(void)
{
volatile unsigned *src, *dest;
@@ -49,6 +45,4 @@ void WEAK reset_handler(void)
/* Continue Execution in RAM */
}
-
- original_reset_handler();
}
diff --git a/lib/stm32/f1/vector.c b/lib/stm32/f1/vector.c
deleted file mode 100644
index 795773b..0000000
--- a/lib/stm32/f1/vector.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <libopencm3/stm32/f1/irq.h>
-#include "../../cm3/vector.c"
diff --git a/lib/stm32/f2/vector.c b/lib/stm32/f2/vector.c
deleted file mode 100644
index 24d1185..0000000
--- a/lib/stm32/f2/vector.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <libopencm3/stm32/f2/irq.h>
-#include "../../cm3/vector.c"
diff --git a/lib/stm32/f4/vector.c b/lib/stm32/f4/vector.c
index a5017b3..5304299 100644
--- a/lib/stm32/f4/vector.c
+++ b/lib/stm32/f4/vector.c
@@ -18,16 +18,10 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <libopencm3/stm32/f4/irq.h>
-#define reset_handler original_reset_handler
-#include "../../cm3/vector.c"
-#undef reset_handler
#include <libopencm3/stm32/f4/scb.h>
-void WEAK reset_handler(void)
+static void pre_main(void)
{
/* Enable access to Floating-Point coprocessor. */
SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11);
-
- original_reset_handler();
}