Skip to content

Commit b493320

Browse files
Merge pull request #27 from rust-embedded/fix-undef-handler
Fix the exception handlers.
2 parents d20623c + 55bc8ad commit b493320

37 files changed

+1420
-458
lines changed

cortex-a-rt/link.x

+18-18
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ SECTIONS {
1717
.text : {
1818
/* The vector table must come first */
1919
*(.vector_table)
20-
/* Our exception handling routines */
21-
*(.text.handlers)
2220
/* Now the rest of the code */
2321
*(.text .text*)
2422
} > CODE
@@ -72,36 +70,38 @@ SECTIONS {
7270
}
7371

7472
/*
75-
We reserve some space at the top of the RAM for our stacks. We have an IRQ stack
76-
and a FIQ stack, plus the remainder is our system stack.
73+
We reserve some space at the top of the RAM for our exception stacks. The
74+
remainder is our system mode stack.
7775

7876
You must keep _stack_top and the stack sizes aligned to eight byte boundaries.
7977
*/
8078
PROVIDE(_stack_top = ORIGIN(DATA) + LENGTH(DATA));
81-
PROVIDE(_fiq_stack_size = 0x400);
82-
PROVIDE(_irq_stack_size = 0x1000);
83-
PROVIDE(_abt_stack_size = 0x400);
8479
PROVIDE(_und_stack_size = 0x400);
85-
PROVIDE(_svc_stack_size = 0x1000);
80+
PROVIDE(_svc_stack_size = 0x400);
81+
PROVIDE(_abt_stack_size = 0x400);
82+
PROVIDE(_irq_stack_size = 0x400);
83+
PROVIDE(_fiq_stack_size = 0x400);
8684

87-
ASSERT(_stack_top % 8 == 0, "ERROR(cortex-a-rt): top of stack is not 8-byte aligned");
88-
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of FIQ stack is not 8-byte aligned");
89-
ASSERT(_irq_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of IRQ stack is not 8-byte aligned");
90-
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of FIQ stack is not 8-byte aligned");
91-
ASSERT(_abt_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of ABT stack is not 8-byte aligned");
92-
ASSERT(_und_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of UND stack is not 8-byte aligned");
93-
ASSERT(_svc_stack_size % 8 == 0, "ERROR(cortex-a-rt): size of SVC stack is not 8-byte aligned");
85+
ASSERT(_stack_top % 8 == 0, "ERROR(cortex-r-rt): top of stack is not 8-byte aligned");
86+
ASSERT(_und_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of UND stack is not 8-byte aligned");
87+
ASSERT(_svc_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of SVC stack is not 8-byte aligned");
88+
ASSERT(_abt_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of ABT stack is not 8-byte aligned");
89+
ASSERT(_irq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of IRQ stack is not 8-byte aligned");
90+
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of FIQ stack is not 8-byte aligned");
9491

9592
/* Weak aliases for ASM default handlers */
93+
PROVIDE(_start =_default_start);
9694
PROVIDE(_asm_undefined_handler =_asm_default_undefined_handler);
95+
PROVIDE(_asm_svc_handler =_asm_default_svc_handler);
9796
PROVIDE(_asm_prefetch_handler =_asm_default_prefetch_handler);
9897
PROVIDE(_asm_abort_handler =_asm_default_abort_handler);
98+
PROVIDE(_asm_irq_handler =_asm_default_irq_handler);
9999
PROVIDE(_asm_fiq_handler =_asm_default_fiq_handler);
100100

101101
/* Weak aliases for C default handlers */
102102
PROVIDE(_undefined_handler =_default_handler);
103-
PROVIDE(_abort_handler =_default_handler);
103+
PROVIDE(_svc_handler =_default_handler);
104104
PROVIDE(_prefetch_handler =_default_handler);
105+
PROVIDE(_abort_handler =_default_handler);
105106
PROVIDE(_irq_handler =_default_handler);
106-
PROVIDE(_svc_handler =_default_handler);
107-
PROVIDE(_start =_default_start);
107+
/* There is no default C-language FIQ handler */

cortex-a-rt/src/lib.rs

+226-153
Large diffs are not rendered by default.

cortex-r-rt/link.x

+20-18
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ SECTIONS {
1717
.text : {
1818
/* The vector table must come first */
1919
*(.vector_table)
20-
/* Our exception handling routines */
21-
*(.text.handlers)
2220
/* Now the rest of the code */
2321
*(.text .text*)
2422
} > CODE
@@ -72,34 +70,38 @@ SECTIONS {
7270
}
7371

7472
/*
75-
We reserve some space at the top of the RAM for our stacks. We have an IRQ stack
76-
and a FIQ stack, plus the remainder is our system stack.
73+
We reserve some space at the top of the RAM for our exception stacks. The
74+
remainder is our system mode stack.
7775

7876
You must keep _stack_top and the stack sizes aligned to eight byte boundaries.
7977
*/
8078
PROVIDE(_stack_top = ORIGIN(DATA) + LENGTH(DATA));
81-
PROVIDE(_fiq_stack_size = 0x400);
82-
PROVIDE(_irq_stack_size = 0x1000);
83-
PROVIDE(_abt_stack_size = 0x400);
8479
PROVIDE(_und_stack_size = 0x400);
85-
PROVIDE(_svc_stack_size = 0x1000);
80+
PROVIDE(_svc_stack_size = 0x400);
81+
PROVIDE(_abt_stack_size = 0x400);
82+
PROVIDE(_irq_stack_size = 0x400);
83+
PROVIDE(_fiq_stack_size = 0x400);
8684

8785
ASSERT(_stack_top % 8 == 0, "ERROR(cortex-r-rt): top of stack is not 8-byte aligned");
88-
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of FIQ stack is not 8-byte aligned");
89-
ASSERT(_irq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of IRQ stack is not 8-byte aligned");
90-
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of FIQ stack is not 8-byte aligned");
91-
ASSERT(_abt_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of ABT stack is not 8-byte aligned");
9286
ASSERT(_und_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of UND stack is not 8-byte aligned");
9387
ASSERT(_svc_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of SVC stack is not 8-byte aligned");
88+
ASSERT(_abt_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of ABT stack is not 8-byte aligned");
89+
ASSERT(_irq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of IRQ stack is not 8-byte aligned");
90+
ASSERT(_fiq_stack_size % 8 == 0, "ERROR(cortex-r-rt): size of FIQ stack is not 8-byte aligned");
9491

95-
PROVIDE(_asm_undefined_handler =_asm_default_handler);
96-
PROVIDE(_asm_prefetch_handler =_asm_default_handler);
97-
PROVIDE(_asm_abort_handler =_asm_default_handler);
92+
/* Weak aliases for ASM default handlers */
93+
PROVIDE(_start =_default_start);
94+
PROVIDE(_asm_undefined_handler =_asm_default_undefined_handler);
95+
PROVIDE(_asm_svc_handler =_asm_default_svc_handler);
96+
PROVIDE(_asm_prefetch_handler =_asm_default_prefetch_handler);
97+
PROVIDE(_asm_abort_handler =_asm_default_abort_handler);
98+
PROVIDE(_asm_irq_handler =_asm_default_irq_handler);
9899
PROVIDE(_asm_fiq_handler =_asm_default_fiq_handler);
99100

101+
/* Weak aliases for C default handlers */
100102
PROVIDE(_undefined_handler =_default_handler);
101-
PROVIDE(_abort_handler =_default_handler);
103+
PROVIDE(_svc_handler =_default_handler);
102104
PROVIDE(_prefetch_handler =_default_handler);
105+
PROVIDE(_abort_handler =_default_handler);
103106
PROVIDE(_irq_handler =_default_handler);
104-
PROVIDE(_svc_handler =_default_handler);
105-
PROVIDE(_start =_default_start);
107+
/* There is no default C-language FIQ handler */

0 commit comments

Comments
 (0)