µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
exception-handlers.c
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2015 Liviu Ionescu.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28#if defined(__clang__)
29#pragma clang diagnostic ignored "-Wempty-translation-unit"
30#endif
31
32// ----------------------------------------------------------------------------
33
34#if defined(__ARM_EABI__)
35
36// ----------------------------------------------------------------------------
37
38#include <cmsis-plus/os-app-config.h>
39#include <cmsis-plus/rtos/port/os-c-decls.h>
40
41#include <cmsis_device.h>
45
46#include <string.h>
47
48// ----------------------------------------------------------------------------
49
50extern void __attribute__((noreturn,weak))
51_start (void);
52
53extern unsigned int _Heap_Limit;
54extern unsigned int __stack;
55
56// ----------------------------------------------------------------------------
57
58// Default exception handlers.
59// Weak definitions, override them with similar
60// handler routines defined in the application code.
61//
62// The ARCH_7M exception handlers are:
63// 0x00 stack
64// 0x04 Reset
65// 0x08 NMI
66// 0x0C HardFault
67// 0x10 MemManage
68// 0x14 BusFault
69// 0x18 UsageFault
70// 0x1C 0
71// 0x20 0
72// 0x24 0
73// 0x28 0
74// 0x2C SVC
75// 0x30 DebugMon
76// 0x34 0
77// 0x38 PendSV
78// 0x3C SysTick
79
80// ----------------------------------------------------------------------------
81
82// This function is not naked, and has a proper stack frame,
83// to allow setting breakpoints at Reset_Handler.
84void __attribute__ ((section(".after_vectors"),noreturn,weak))
86{
87 // Fill the main stack with a pattern, to detect usage and underflow.
88 for (unsigned int* p = &_Heap_Limit; p < &__stack;)
89 {
90 *p++ = OS_INTEGER_RTOS_STACK_FILL_MAGIC; // DEADBEEF
91 }
92
93 _start ();
94}
95
96void __attribute__ ((section(".after_vectors"),weak))
98{
99#if defined(DEBUG)
100#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
101 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
102 {
103 __BKPT(0);
104 }
105#else
106 __BKPT (0);
107#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
108#endif /* defined(DEBUG) */
109
110 while (true)
111 {
112 __NOP ();
113 }
114}
115
116// ----------------------------------------------------------------------------
117
118#if defined(TRACE)
119
120#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
121
122// The values of BFAR and MMFAR remain unchanged if the BFARVALID or
123// MMARVALID is set. However, if a new fault occurs during the
124// execution of this fault handler, the value of the BFAR and MMFAR
125// could potentially be erased. In order to ensure the fault addresses
126// accessed are valid, the following procedure should be used:
127// 1. Read BFAR/MMFAR.
128// 2. Read CFSR to get BFARVALID or MMARVALID. If the value is 0, the
129// value of BFAR or MMFAR accessed can be invalid and can be discarded.
130// 3. Optionally clear BFARVALID or MMARVALID.
131// (See Joseph Yiu's book).
132
133void
134dump_exception_stack (exception_stack_frame_t* frame, uint32_t cfsr,
135 uint32_t mmfar, uint32_t bfar, uint32_t lr)
136{
137 trace_printf ("Stack frame:\n");
138 trace_printf (" R0 = %08X\n", frame->r0);
139 trace_printf (" R1 = %08X\n", frame->r1);
140 trace_printf (" R2 = %08X\n", frame->r2);
141 trace_printf (" R3 = %08X\n", frame->r3);
142 trace_printf (" R12 = %08X\n", frame->r12);
143 trace_printf (" LR = %08X\n", frame->lr);
144 trace_printf (" PC = %08X\n", frame->pc);
145 trace_printf (" PSR = %08X\n", frame->psr);
146 trace_printf ("FSR/FAR:\n");
147 trace_printf (" CFSR = %08X\n", cfsr);
148 trace_printf (" HFSR = %08X\n", SCB->HFSR);
149 trace_printf (" DFSR = %08X\n", SCB->DFSR);
150 trace_printf (" AFSR = %08X\n", SCB->AFSR);
151
152 if (cfsr & (1UL << 7))
153 {
154 trace_printf (" MMFAR= %08X\n", mmfar);
155 }
156 if (cfsr & (1UL << 15))
157 {
158 trace_printf (" BFAR = %08X\n", bfar);
159 }
160 trace_printf ("Misc\n");
161 trace_printf (" LR/EXC_RETURN = %08X\n", lr);
162}
163
164#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
165
166#if defined(__ARM_ARCH_6M__)
167
168void
169dump_exception_stack (exception_stack_frame_t* frame, uint32_t lr)
170 {
171 trace_printf ("Stack frame:\n");
172 trace_printf (" R0 = %08X\n", frame->r0);
173 trace_printf (" R1 = %08X\n", frame->r1);
174 trace_printf (" R2 = %08X\n", frame->r2);
175 trace_printf (" R3 = %08X\n", frame->r3);
176 trace_printf (" R12 = %08X\n", frame->r12);
177 trace_printf (" LR = %08X\n", frame->lr);
178 trace_printf (" PC = %08X\n", frame->pc);
179 trace_printf (" PSR = %08X\n", frame->psr);
180 trace_printf ("Misc\n");
181 trace_printf (" LR/EXC_RETURN = %08X\n", lr);
182 }
183
184#endif /* defined(__ARM_ARCH_6M__) */
185
186#endif /* defined(TRACE) */
187
188// ----------------------------------------------------------------------------
189
190#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
191
192#if defined(OS_USE_SEMIHOSTING_SYSCALLS) \
193 || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) \
194 || defined(OS_USE_TRACE_SEMIHOSTING_DEBUG)
195
196int
197is_semihosting (exception_stack_frame_t* frame, uint16_t opCode);
198
205int
206is_semihosting (exception_stack_frame_t* frame, uint16_t opCode)
207{
208 uint16_t* pw = (uint16_t*) frame->pc;
209 if (*pw == opCode)
210 {
211 uint32_t r0 = frame->r0;
212#if defined(OS_DEBUG_SEMIHOSTING_FAULTS) \
213 || defined(OS_USE_SEMIHOSTING_SYSCALLS) \
214 || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT)
215 uint32_t r1 = frame->r1;
216#endif
217#if defined(OS_USE_SEMIHOSTING_SYSCALLS) || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT)
218 uint32_t* blk = (uint32_t*) r1;
219#endif
220
221#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
222 // trace_printf ("sh r0=%d\n", r0);
223#endif
224
225 switch (r0)
226 {
227
228#if defined(OS_USE_SEMIHOSTING_SYSCALLS)
229
241 // The call is not successful or not supported.
242 frame->r0 = (uint32_t) -1;
243 break;
244
246 // The call is successful.
247 frame->r0 = 0;
248 break;
249
251 // Should be the value of the C library errno variable.
252 frame->r0 = 0;
253 break;
254
256 blk[0] = 0; // heap_base
257 blk[1] = 0; // heap_limit
258 blk[2] = 0; // stack_base
259 blk[3] = 0; // stack_limit
260 break;
261
263 // 0 if the status word is not an error indication.
264 frame->r0 = 0;
265 break;
266
268 // If R0 contains the same value as word 3, the call has
269 // failed and EOF is assumed.
270 frame->r0 = blk[2];
271 break;
272
274 // The byte read from the console.
275 frame->r0 = '\0';
276 break;
277
279 // The number of seconds since 00:00 January 1, 1970.
280 frame->r0 = 0;
281 break;
282
284
286 // Should not reach here
287 return 0;
288
289#endif /* defined(OS_USE_SEMIHOSTING_SYSCALLS) */
290
291#if defined(OS_USE_SEMIHOSTING_SYSCALLS) || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT)
292
293#define HANDLER_STDIN (1)
294#define HANDLER_STDOUT (2)
295#define HANDLER_STDERR (3)
296
298 // Process only standard io/out/err and return 1/2/3
299 if (strcmp ((char*) blk[0], ":tt") == 0)
300 {
301 if ((blk[1] == 0))
302 {
303 frame->r0 = HANDLER_STDIN;
304 break;
305 }
306 else if (blk[1] == 4)
307 {
308 frame->r0 = HANDLER_STDOUT;
309 break;
310 }
311 else if (blk[1] == 8)
312 {
313 frame->r0 = HANDLER_STDERR;
314 break;
315 }
316 }
317 // The call is not successful or not supported.
318 frame->r0 = (uint32_t) -1;
319 break;
320
322 // Silently ignore writes to stdout/stderr, fail on all other handler.
323 if ((blk[0] == HANDLER_STDOUT) || (blk[0] == HANDLER_STDERR))
324 {
325#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
326 frame->r0 = (uint32_t) blk[2]
327 - trace_write ((char*) blk[1], blk[2]);
328#else
329 frame->r0 = 0; // all sent, no more.
330#endif /* defined(OS_DEBUG_SEMIHOSTING_FAULTS) */
331 }
332 else
333 {
334 // If other handler, return the total number of bytes
335 // as the number of bytes that are not written.
336 frame->r0 = blk[2];
337 }
338 break;
339
340#endif /* defined(OS_USE_SEMIHOSTING_SYSCALLS) || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) */
341
342#if defined(OS_USE_SEMIHOSTING_SYSCALLS) \
343 || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) \
344 || defined(OS_USE_TRACE_SEMIHOSTING_DEBUG)
345
347#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
348 {
349 char ch = *((char*) r1);
350 trace_write (&ch, 1);
351 }
352#endif
353 // Register R0 is corrupted.
354 break;
355
357#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
358 {
359 char* p = ((char*) r1);
360 trace_write (p, strlen (p));
361 }
362#endif
363 // Register R0 is corrupted.
364 break;
365
366#endif /* semihosting */
367
368 default:
369 return 0;
370 }
371
372 // Alter the PC to make the exception returns to
373 // the instruction after the faulty BKPT.
374 frame->pc += 2;
375 return 1;
376 }
377 return 0;
378}
379
380#endif
381
382// Hard Fault handler wrapper in assembly.
383// Extract the location of the stack frame and pass it to the C
384// handler as a pointer. Also pass the LR value as second
385// parameter.
386// (Based on Joseph Yiu's, The Definitive Guide to ARM Cortex-M3 and
387// Cortex-M4 Processors, Third Edition, Chap. 12.8, page 402).
388
389void __attribute__ ((section(".after_vectors"),weak,naked))
391{
392 asm volatile(
393 " tst lr,#4 \n"
394 " ite eq \n"
395 " mrseq r0,msp \n"
396 " mrsne r0,psp \n"
397 " mov r1,lr \n"
398 " ldr r2,=HardFault_Handler_C \n"
399 " bx r2"
400
401 : /* Outputs */
402 : /* Inputs */
403 : /* Clobbers */
404 );
405}
406
407void __attribute__ ((section(".after_vectors"),weak,used))
408HardFault_Handler_C (exception_stack_frame_t* frame __attribute__((unused)),
409 uint32_t lr __attribute__((unused)))
410{
411#if defined(TRACE)
412 uint32_t mmfar = SCB->MMFAR; // MemManage Fault Address
413 uint32_t bfar = SCB->BFAR; // Bus Fault Address
414 uint32_t cfsr = SCB->CFSR; // Configurable Fault Status Registers
415#endif /* defined(TRACE) */
416
417#if defined(OS_USE_SEMIHOSTING_SYSCALLS) \
418 || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) \
419 || defined(OS_USE_TRACE_SEMIHOSTING_DEBUG)
420
421 // If the BKPT instruction is executed with C_DEBUGEN == 0 and MON_EN == 0,
422 // it will cause the processor to enter a HardFault exception, with DEBUGEVT
423 // in the Hard Fault Status register (HFSR) set to 1, and BKPT in the
424 // Debug Fault Status register (DFSR) also set to 1.
425
426 if (((SCB->DFSR & SCB_DFSR_BKPT_Msk) != 0)
427 && ((SCB->HFSR & SCB_HFSR_DEBUGEVT_Msk) != 0))
428 {
429 if (is_semihosting (frame, 0xBE00 + (AngelSWI & 0xFF)))
430 {
431 // Clear the exception cause in exception status.
432 SCB->HFSR = SCB_HFSR_DEBUGEVT_Msk;
433
434 // Continue after the BKPT
435 return;
436 }
437 }
438
439#endif /* semihosting */
440
441#if defined(TRACE)
442 trace_printf ("[HardFault]\n");
443 dump_exception_stack (frame, cfsr, mmfar, bfar, lr);
444#endif /* defined(TRACE) */
445
446#if defined(DEBUG)
447#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
448 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
449 {
450 __BKPT(0);
451 }
452#else
453 __BKPT (0);
454#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
455#endif /* defined(DEBUG) */
456
457 while (true)
458 {
459 __NOP ();
460 }
461}
462
463#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
464
465#if defined(__ARM_ARCH_6M__)
466
467// Hard Fault handler wrapper in assembly.
468// It extracts the location of stack frame and passes it to handler
469// in C as a pointer. We also pass the LR value as second
470// parameter.
471// (Based on Joseph Yiu's, The Definitive Guide to ARM Cortex-M0
472// First Edition, Chap. 12.8, page 402).
473
474void __attribute__ ((section(".after_vectors"),weak,naked))
476 {
477 asm volatile(
478 " movs r0,#4 \n"
479 " mov r1,lr \n"
480 " tst r0,r1 \n"
481 " beq 1f \n"
482 " mrs r0,psp \n"
483 " b 2f \n"
484 "1: \n"
485 " mrs r0,msp \n"
486 "2:"
487 " mov r1,lr \n"
488 " ldr r2,=HardFault_Handler_C \n"
489 " bx r2"
490
491 : /* Outputs */
492 : /* Inputs */
493 : /* Clobbers */
494 );
495 }
496
497void __attribute__ ((section(".after_vectors"),weak,used))
498HardFault_Handler_C (exception_stack_frame_t* frame __attribute__((unused)),
499 uint32_t lr __attribute__((unused)))
500 {
501 // There is no semihosting support for Cortex-M0, since on ARMv6-M
502 // faults are fatal and it is not possible to return from the handler.
503
504#if defined(TRACE)
505 trace_printf ("[HardFault]\n");
506 dump_exception_stack (frame, lr);
507#endif /* defined(TRACE) */
508
509#if defined(DEBUG)
510#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
511 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
512 {
513 __BKPT (0);
514 }
515#else
516 __BKPT (0);
517#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
518#endif /* defined(DEBUG) */
519
520 while (true)
521 {
522 __NOP();
523 }
524 }
525
526#endif /* defined(__ARM_ARCH_6M__) */
527
528#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
529
530void __attribute__ ((section(".after_vectors"),weak))
531MemManage_Handler (void)
532{
533#if defined(DEBUG)
534#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
535 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
536 {
537 __BKPT(0);
538 }
539#else
540 __BKPT (0);
541#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
542#endif /* defined(DEBUG) */
543
544 while (true)
545 {
546 __NOP ();
547 }
548}
549
550void __attribute__ ((section(".after_vectors"),weak,naked))
551BusFault_Handler (void)
552{
553 asm volatile(
554 " tst lr,#4 \n"
555 " ite eq \n"
556 " mrseq r0,msp \n"
557 " mrsne r0,psp \n"
558 " mov r1,lr \n"
559 " ldr r2,=BusFault_Handler_C \n"
560 " bx r2"
561
562 : /* Outputs */
563 : /* Inputs */
564 : /* Clobbers */
565 );
566}
567
568void __attribute__ ((section(".after_vectors"),weak,used))
569BusFault_Handler_C (exception_stack_frame_t* frame __attribute__((unused)),
570 uint32_t lr __attribute__((unused)))
571{
572#if defined(TRACE)
573 uint32_t mmfar = SCB->MMFAR; // MemManage Fault Address
574 uint32_t bfar = SCB->BFAR; // Bus Fault Address
575 uint32_t cfsr = SCB->CFSR; // Configurable Fault Status Registers
576
577 trace_printf ("[BusFault]\n");
578 dump_exception_stack (frame, cfsr, mmfar, bfar, lr);
579#endif /* defined(TRACE) */
580
581#if defined(DEBUG)
582#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
583 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
584 {
585 __BKPT(0);
586 }
587#else
588 __BKPT (0);
589#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
590#endif /* defined(DEBUG) */
591
592 while (true)
593 {
594 __NOP ();
595 }
596}
597
598void __attribute__ ((section(".after_vectors"),weak,naked))
599UsageFault_Handler (void)
600{
601 asm volatile(
602 " tst lr,#4 \n"
603 " ite eq \n"
604 " mrseq r0,msp \n"
605 " mrsne r0,psp \n"
606 " mov r1,lr \n"
607 " ldr r2,=UsageFault_Handler_C \n"
608 " bx r2"
609
610 : /* Outputs */
611 : /* Inputs */
612 : /* Clobbers */
613 );
614}
615
616void __attribute__ ((section(".after_vectors"),weak,used))
617UsageFault_Handler_C (exception_stack_frame_t* frame __attribute__((unused)),
618 uint32_t lr __attribute__((unused)))
619{
620#if defined(TRACE)
621 uint32_t mmfar = SCB->MMFAR; // MemManage Fault Address
622 uint32_t bfar = SCB->BFAR; // Bus Fault Address
623 uint32_t cfsr = SCB->CFSR; // Configurable Fault Status Registers
624#endif /* defined(TRACE) */
625
626#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
627
628 if ((cfsr & (1UL << 16)) != 0) // UNDEFINSTR
629 {
630 // For testing purposes, instead of BKPT use 'setend be'.
631 if (is_semihosting (frame, AngelSWITestFaultOpCode))
632 {
633 return;
634 }
635 }
636
637#endif /* defined(OS_DEBUG_SEMIHOSTING_FAULTS) */
638
639#if defined(TRACE)
640 trace_printf ("[UsageFault]\n");
641 dump_exception_stack (frame, cfsr, mmfar, bfar, lr);
642#endif /* defined(TRACE) */
643
644#if defined(DEBUG)
645#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
646 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
647 {
648 __BKPT(0);
649 }
650#else
651 __BKPT (0);
652#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
653#endif /* defined(DEBUG) */
654
655 while (true)
656 {
657 __NOP ();
658 }
659}
660
661#endif
662
663void __attribute__ ((section(".after_vectors"),weak))
665{
666#if defined(DEBUG)
667#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
668 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
669 {
670 __BKPT(0);
671 }
672#else
673 __BKPT (0);
674#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
675#endif /* defined(DEBUG) */
676
677 while (true)
678 {
679 __NOP ();
680 }
681}
682
683#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
684
685void __attribute__ ((section(".after_vectors"),weak))
686DebugMon_Handler (void)
687{
688#if defined(DEBUG)
689 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
690 {
691 __BKPT(0);
692 }
693#endif /* defined(DEBUG) */
694
695 while (true)
696 {
697 __NOP ();
698 }
699}
700
701#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
702
703void __attribute__ ((section(".after_vectors"),weak))
705{
706#if defined(DEBUG)
707#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
708 if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0)
709 {
710 __BKPT(0);
711 }
712#else
713 __BKPT (0);
714#endif /* defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) */
715#endif /* defined(DEBUG) */
716
717 while (true)
718 {
719 __NOP ();
720 }
721}
722
723void __attribute__ ((section(".after_vectors"),weak))
725{
726 // DO NOT loop, just return.
727 // Useful in case someone (like STM HAL) always enables SysTick.
728}
729
730// ----------------------------------------------------------------------------
731
732#endif /* defined(__ARM_EABI__) */
unsigned int __stack
void SVC_Handler(void)
unsigned int _Heap_Limit
void PendSV_Handler(void)
void NMI_Handler(void)
void SysTick_Handler(void)
void Reset_Handler(void)
void HardFault_Handler(void)
void HardFault_Handler_C(exception_stack_frame_t *frame, uint32_t lr)
void _start(void)
The standard C application entry point.
Definition startup.cpp:264
void NVIC_SystemReset(void)
@ SEMIHOSTING_SYS_TICKFREQ
Definition semihosting.h:55
@ SEMIHOSTING_ReportException
Definition semihosting.h:38
@ SEMIHOSTING_SYS_ISERROR
Definition semihosting.h:46
@ SEMIHOSTING_SYS_WRITE
Definition semihosting.h:58
@ SEMIHOSTING_SYS_FLEN
Definition semihosting.h:43
@ SEMIHOSTING_SYS_GET_CMDLINE
Definition semihosting.h:44
@ SEMIHOSTING_SYS_REMOVE
Definition semihosting.h:51
@ SEMIHOSTING_SYS_SEEK
Definition semihosting.h:53
@ SEMIHOSTING_SYS_TMPNAM
Definition semihosting.h:57
@ SEMIHOSTING_SYS_TIME
Definition semihosting.h:56
@ SEMIHOSTING_SYS_CLOCK
Definition semihosting.h:40
@ SEMIHOSTING_SYS_WRITEC
Definition semihosting.h:59
@ SEMIHOSTING_SYS_ERRNO
Definition semihosting.h:42
@ SEMIHOSTING_SYS_ISTTY
Definition semihosting.h:47
@ SEMIHOSTING_SYS_HEAPINFO
Definition semihosting.h:45
@ SEMIHOSTING_SYS_WRITE0
Definition semihosting.h:60
@ SEMIHOSTING_SYS_ELAPSED
Definition semihosting.h:41
@ SEMIHOSTING_SYS_READ
Definition semihosting.h:49
@ SEMIHOSTING_SYS_SYSTEM
Definition semihosting.h:54
@ SEMIHOSTING_SYS_CLOSE
Definition semihosting.h:39
@ SEMIHOSTING_SYS_READC
Definition semihosting.h:50
@ SEMIHOSTING_SYS_OPEN
Definition semihosting.h:48
@ SEMIHOSTING_SYS_RENAME
Definition semihosting.h:52
#define AngelSWI
Definition semihosting.h:75
int trace_printf(const char *format,...)
ssize_t trace_write(const void *buf, size_t nbyte)