22
22
means that you won't see "Address (..) is out of bounds" in the disassembly produced by `objdump`.
23
23
*/
24
24
25
- PROVIDE(_stext = ORIGIN(REGION_TEXT));
26
- PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
27
- PROVIDE(_max_hart_id = 0);
28
- PROVIDE(_hart_stack_size = 2K);
29
- PROVIDE(_heap_size = 0);
30
-
31
- /** TRAP ENTRY POINTS **/
32
-
33
25
/* Default abort entry point. If no abort symbol is provided, then abort maps to _abort. */
34
26
EXTERN(_abort);
35
27
PROVIDE(abort = _abort);
@@ -39,57 +31,28 @@ PROVIDE(abort = _abort);
39
31
and then returns. Users can override this alias by defining the symbol themselves */
40
32
EXTERN(_start_trap);
41
33
34
+ /* Default exception handler. By default, the exception handler is abort.
35
+ Users can override this alias by defining the symbol themselves */
36
+ PROVIDE(ExceptionHandler = abort);
37
+
38
+ /* Default interrupt handler. By default, the interrupt handler is abort.
39
+ Users can override this alias by defining the symbol themselves */
40
+ PROVIDE(DefaultHandler = abort);
41
+
42
42
/* Default interrupt trap entry point. When vectored trap mode is enabled,
43
43
the riscv-rt crate provides an implementation of this function, which saves caller saved
44
- registers, calls the the DefaultHandler ISR, restores caller saved registers and returns. */
44
+ registers, calls the the DefaultHandler ISR, restores caller saved registers and returns.
45
+ Note, however, that this provided implementation cannot be overwritten. We use PROVIDE
46
+ to avoid compilation errors in direct mode, not to allow users to overwrite the symbol. */
45
47
PROVIDE(_start_DefaultHandler_trap = _start_trap);
46
48
47
- /* When vectored trap mode is enabled, each interrupt source must implement its own
48
- trap entry point. By default, all interrupts start in _start_trap. However, users can
49
- override these alias by defining the symbol themselves */
50
- PROVIDE(_start_SupervisorSoft_trap = _start_DefaultHandler_trap);
51
- PROVIDE(_start_MachineSoft_trap = _start_DefaultHandler_trap);
52
- PROVIDE(_start_SupervisorTimer_trap = _start_DefaultHandler_trap);
53
- PROVIDE(_start_MachineTimer_trap = _start_DefaultHandler_trap);
54
- PROVIDE(_start_SupervisorExternal_trap = _start_DefaultHandler_trap);
55
- PROVIDE(_start_MachineExternal_trap = _start_DefaultHandler_trap);
56
-
57
- /** EXCEPTION HANDLERS **/
49
+ ${INCLUDE_LINKER_FILES}
58
50
59
- /* Default exception handler. The riscv-rt crate provides a weak alias of this function,
60
- which is a busy loop. Users can override this alias by defining the symbol themselves */
61
- PROVIDE(ExceptionHandler = abort);
62
-
63
- /* It is possible to define a special handler for each exception type.
64
- By default, all exceptions are handled by ExceptionHandler. However, users can
65
- override these alias by defining the symbol themselves */
66
- PROVIDE(InstructionMisaligned = ExceptionHandler);
67
- PROVIDE(InstructionFault = ExceptionHandler);
68
- PROVIDE(IllegalInstruction = ExceptionHandler);
69
- PROVIDE(Breakpoint = ExceptionHandler);
70
- PROVIDE(LoadMisaligned = ExceptionHandler);
71
- PROVIDE(LoadFault = ExceptionHandler);
72
- PROVIDE(StoreMisaligned = ExceptionHandler);
73
- PROVIDE(StoreFault = ExceptionHandler);
74
- PROVIDE(UserEnvCall = ExceptionHandler);
75
- PROVIDE(SupervisorEnvCall = ExceptionHandler);
76
- PROVIDE(MachineEnvCall = ExceptionHandler);
77
- PROVIDE(InstructionPageFault = ExceptionHandler);
78
- PROVIDE(LoadPageFault = ExceptionHandler);
79
- PROVIDE(StorePageFault = ExceptionHandler);
80
-
81
- /** INTERRUPT HANDLERS **/
82
-
83
- /* It is possible to define a special handler for each interrupt type.
84
- By default, all interrupts are handled by DefaultHandler. However, users can
85
- override these alias by defining the symbol themselves */
86
- PROVIDE(DefaultHandler = abort);
87
- PROVIDE(SupervisorSoft = DefaultHandler);
88
- PROVIDE(MachineSoft = DefaultHandler);
89
- PROVIDE(SupervisorTimer = DefaultHandler);
90
- PROVIDE(MachineTimer = DefaultHandler);
91
- PROVIDE(SupervisorExternal = DefaultHandler);
92
- PROVIDE(MachineExternal = DefaultHandler);
51
+ PROVIDE(_stext = ORIGIN(REGION_TEXT));
52
+ PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
53
+ PROVIDE(_max_hart_id = 0);
54
+ PROVIDE(_hart_stack_size = 2K);
55
+ PROVIDE(_heap_size = 0);
93
56
94
57
SECTIONS
95
58
{
0 commit comments