summaryrefslogtreecommitdiff
path: root/firmware/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/system.c')
-rw-r--r--firmware/system.c58
1 files changed, 1 insertions, 57 deletions
diff --git a/firmware/system.c b/firmware/system.c
index ada99e0b56..befc785823 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -18,16 +18,11 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include <stdio.h>
22#include "config.h" 21#include "config.h"
23#include <stdbool.h>
24#include "lcd.h"
25#include "font.h"
26#include "system.h" 22#include "system.h"
23#include <stdio.h>
27#include "kernel.h" 24#include "kernel.h"
28#include "thread.h" 25#include "thread.h"
29#include "timer.h"
30#include "inttypes.h"
31#include "string.h" 26#include "string.h"
32 27
33#ifndef SIMULATOR 28#ifndef SIMULATOR
@@ -226,54 +221,3 @@ bool detect_original_firmware(void)
226 return !(detect_flashed_ramimage() || detect_flashed_romimage()); 221 return !(detect_flashed_ramimage() || detect_flashed_romimage());
227} 222}
228 223
229#if defined(CPU_ARM)
230
231static const char* const uiename[] = {
232 "Undefined instruction",
233 "Prefetch abort",
234 "Data abort",
235 "Divide by zero"
236};
237
238/* Unexpected Interrupt or Exception handler. Currently only deals with
239 exceptions, but will deal with interrupts later.
240 */
241void UIE(unsigned int pc, unsigned int num) __attribute__((noreturn));
242void UIE(unsigned int pc, unsigned int num)
243{
244 char str[32];
245
246 lcd_clear_display();
247#ifdef HAVE_LCD_BITMAP
248 lcd_setfont(FONT_SYSFIXED);
249#endif
250 lcd_puts(0, 0, uiename[num]);
251 snprintf(str, sizeof(str), "at %08x" IF_COP(" (%d)"), pc
252 IF_COP(, CURRENT_CORE));
253 lcd_puts(0, 1, str);
254 lcd_update();
255
256 while (1)
257 {
258 /* TODO: perhaps add button handling in here when we get a polling
259 driver some day.
260 */
261 core_idle();
262 }
263}
264
265#ifndef STUB
266/* Needs to be here or gcc won't find it */
267void __div0(void) __attribute__((naked));
268void __div0(void)
269{
270 asm volatile (
271 "ldr r0, [sp] \r\n"
272 "mov r1, #3 \r\n"
273 "b UIE \r\n"
274 );
275}
276#endif
277
278#endif /* CPU_ARM */
279