aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32l4xx_it.c
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-02-27 23:55:46 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-02-27 23:55:46 -0500
commit4614429f5751e14e37ceedb7130b7a829c89476a (patch)
tree42fdfab4b64c3f71b5e13c537b1d0de7538278ca /src/stm32l4xx_it.c
parent9f61013faf98f8909e0853954218ec10c3b3c6fb (diff)
cleaner main, random nums, perfect script run
Diffstat (limited to 'src/stm32l4xx_it.c')
-rw-r--r--src/stm32l4xx_it.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/stm32l4xx_it.c b/src/stm32l4xx_it.c
index ef10406..f643db3 100644
--- a/src/stm32l4xx_it.c
+++ b/src/stm32l4xx_it.c
@@ -1,20 +1,37 @@
#include <stm32l476xx.h>
-#include <lcd.h>
+#include <serial.h>
+#include <stdlib.h>
+#include <task.h>
+
+void serial_puts(const char *s)
+{
+ int i = 0;
+ while (s[i] != 0)
+ serial_put(s[i++]);
+}
void perror(const char *s)
{
- (void)s;//lcd_puts(s);
+ extern task_t *current;
+ serial_puts(s);
+ char buf[200];
+ snprintf(buf, 200, "xPSR: %x\r\nPC: %x\r\nLR: %x\r\n", current->sp[0],
+ current->sp[1], current->sp[2]);
+ serial_puts(buf);
}
+__attribute__ ((naked))
void NMI_Handler(void) {}
+__attribute__ ((naked))
void HardFault_Handler(void)
{
GPIOA->BSRR |= (1 << 5);
- perror("Hard Fault!");
+ //perror("Hard Fault!");
while (1);
}
+__attribute__ ((naked))
void MemManage_Handler(void)
{
GPIOA->BSRR |= (1 << 5);
@@ -22,6 +39,7 @@ void MemManage_Handler(void)
while (1);
}
+__attribute__ ((naked))
void BusFault_Handler(void)
{
GPIOA->BSRR |= (1 << 5);
@@ -29,6 +47,7 @@ void BusFault_Handler(void)
while (1);
}
+__attribute__ ((naked))
void UsageFault_Handler(void)
{
GPIOA->BSRR |= (1 << 5);
@@ -36,5 +55,6 @@ void UsageFault_Handler(void)
while (1);
}
+__attribute__ ((naked))
void DebugMon_Handler(void) {}