Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit 761e675

Browse files
committed
new exception / interrupt override mechanism
check rust-embedded/cortex-m#51 for details
1 parent 29e590b commit 761e675

File tree

3 files changed

+314
-25
lines changed

3 files changed

+314
-25
lines changed

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ version = "0.3.0"
1111

1212
[dependencies]
1313
r0 = "0.2.1"
14-
15-
[dependencies.cortex-m]
16-
version = "0.2.7"
14+
cortex-m = "0.3.0"
1715

1816
[features]
19-
default = ["exceptions", "linker-script"]
20-
# service all exceptions using the default handler
21-
exceptions = []
17+
default = ["linker-script"]
2218
# generic linker script
2319
linker-script = []
2420
# provides a panic_fmt implementation that calls the abort instruction (`udf 0xfe`)

link.x

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ SECTIONS
88
_svector_table = .;
99
LONG(_stack_start);
1010

11-
KEEP(*(.vector_table.reset_handler));
11+
KEEP(*(.vector_table.reset_vector));
1212

13-
KEEP(*(.rodata.exceptions));
13+
KEEP(*(.vector_table.exceptions));
1414
_eexceptions = .;
1515

16-
KEEP(*(.rodata.interrupts));
16+
KEEP(*(.vector_table.interrupts));
1717
_einterrupts = .;
1818
} > FLASH
1919

@@ -98,23 +98,23 @@ ASSERT(_eexceptions - ORIGIN(FLASH) > 8, "
9898
You must specify the exception handlers.
9999
Create a non `pub` static variable with type
100100
`cortex_m::exception::Handlers` and place it in the
101-
'.rodata.exceptions' section. (cf. #[link_section]). Apply the
101+
'.vector_table.exceptions' section. (cf. #[link_section]). Apply the
102102
`#[used]` attribute to the variable to make it reach the linker.");
103103

104104
ASSERT(_eexceptions - ORIGIN(FLASH) == 0x40, "
105-
Invalid '.rodata.exceptions' section.
105+
Invalid '.vector_table.exceptions' section.
106106
Make sure to place a static with type `cortex_m::exception::Handlers`
107107
in that section (cf. #[link_section]) ONLY ONCE.");
108108

109109
ASSERT(_einterrupts - _eexceptions > 0, "
110110
You must specify the interrupt handlers.
111111
Create a non `pub` static variable and place it in the
112-
'.rodata.interrupts' section. (cf. #[link_section]). Apply the
112+
'.vector_table.interrupts' section. (cf. #[link_section]). Apply the
113113
`#[used]` attribute to the variable to help it reach the linker.");
114114

115115
ASSERT(_einterrupts - _eexceptions <= 0x3c0, "
116116
There can't be more than 240 interrupt handlers.
117-
Fix the '.rodata.interrupts' section. (cf. #[link_section])");
117+
Fix the '.vector_table.interrupts' section. (cf. #[link_section])");
118118

119119
ASSERT(_einterrupts <= _stext, "
120120
The '.text' section can't be placed inside '.vector_table' section.

0 commit comments

Comments
 (0)