aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-04-25 18:14:43 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-04-25 18:14:43 -0400
commit4ccbeb08e64b6bc7cee1f54a04001eff778b4282 (patch)
tree05f71e01c98ac341c029b2a050b796f1be3de8b5 /libmaple
parentb41eb846ca60559cff242d0c550699eb8f309909 (diff)
parent62552a6f3f93223682f9df2df2614411f7e3d54c (diff)
downloadlibrambutan-4ccbeb08e64b6bc7cee1f54a04001eff778b4282.tar.gz
librambutan-4ccbeb08e64b6bc7cee1f54a04001eff778b4282.zip
Merge branch 'master' into spi
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/exc.c34
-rw-r--r--libmaple/nvic.c15
-rw-r--r--libmaple/nvic.h6
3 files changed, 46 insertions, 9 deletions
diff --git a/libmaple/exc.c b/libmaple/exc.c
index ebf4b90..dd02476 100644
--- a/libmaple/exc.c
+++ b/libmaple/exc.c
@@ -1,3 +1,4 @@
+
/* *****************************************************************************
* The MIT License
*
@@ -22,24 +23,41 @@
* THE SOFTWARE.
* ****************************************************************************/
+/**
+ * @brief libmaple exception handlers. If MAPLE_DEBUG is set, then these
+ * exceptions will ASSERT fail and call into the default _fail() light
+ * blinking.
+ */
+
+#include "util.h"
+
void NMIException(void) {
+ ASSERT(0);
+ while(1)
+ ;
}
+
void HardFaultException(void) {
- while (1) {
- }
+ ASSERT(0);
+ while(1)
+ ;
}
void MemManageException(void) {
- while (1) {
- }
+ ASSERT(0);
+ while(1)
+ ;
}
void BusFaultException(void) {
- while (1) {
- }
+ ASSERT(0);
+ while(1)
+ ;
}
void UsageFaultException(void) {
- while (1) {
- }
+ ASSERT(0);
+ while(1)
+ ;
}
+
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index 91e572e..6603d42 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -64,3 +64,18 @@ void nvic_enable_interrupt(uint32 n) {
}
+
+/**
+ * @brief Initialice the NVIC at address addr
+ * @param addr Address to set the vector table at
+ */
+void nvic_init(void) {
+#ifdef VECT_TAB_ROM
+ nvic_set_vector_table(USER_ADDR_ROM, 0x0);
+#elif defined VECT_TAB_RAM
+ nvic_set_vector_table(USER_ADDR_RAM, 0x0);
+#else // VECT_TAB_BASE
+ /* Set the Vector Table base location at 0x08000000 */
+ nvic_set_vector_table(((uint32)0x08000000), 0x0);
+#endif
+}
diff --git a/libmaple/nvic.h b/libmaple/nvic.h
index e785018..a9f32d6 100644
--- a/libmaple/nvic.h
+++ b/libmaple/nvic.h
@@ -54,10 +54,15 @@
#define NVIC_NR_INTERRUPTS 60
+/* Where to put code */
+#define USER_ADDR_ROM 0x08005000
+#define USER_ADDR_RAM 0x20000C00
+
#ifdef __cplusplus
extern "C"{
#endif
+void nvic_init(void);
void nvic_disable_interrupts(void);
void nvic_enable_interrupt(uint32);
@@ -65,6 +70,5 @@ void nvic_enable_interrupt(uint32);
}
#endif
-
#endif