aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt
diff options
context:
space:
mode:
Diffstat (limited to 'cortex-m-rt')
-rw-r--r--cortex-m-rt/examples/device.rs1
-rw-r--r--cortex-m-rt/examples/warnings.rs1
-rw-r--r--cortex-m-rt/link.x.in13
-rw-r--r--cortex-m-rt/src/lib.rs1
4 files changed, 12 insertions, 4 deletions
diff --git a/cortex-m-rt/examples/device.rs b/cortex-m-rt/examples/device.rs
index c18b569..02a60c8 100644
--- a/cortex-m-rt/examples/device.rs
+++ b/cortex-m-rt/examples/device.rs
@@ -16,6 +16,7 @@ fn main() -> ! {
}
// interrupts portion of the vector table
+#[repr(C)]
pub union Vector {
handler: unsafe extern "C" fn(),
reserved: usize,
diff --git a/cortex-m-rt/examples/warnings.rs b/cortex-m-rt/examples/warnings.rs
index 3372003..abf4a2f 100644
--- a/cortex-m-rt/examples/warnings.rs
+++ b/cortex-m-rt/examples/warnings.rs
@@ -22,6 +22,7 @@ extern "C" {
fn INT();
}
+#[repr(C)]
union Vector {
#[allow(dead_code)]
handler: unsafe extern "C" fn(),
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index 01bef98..5b13bef 100644
--- a/cortex-m-rt/link.x.in
+++ b/cortex-m-rt/link.x.in
@@ -79,11 +79,11 @@ SECTIONS
/* Reset vector */
KEEP(*(.vector_table.reset_vector)); /* this is the `__RESET_VECTOR` symbol */
- __reset_vector = .;
/* Exceptions */
+ __exceptions = .; /* start of exceptions */
KEEP(*(.vector_table.exceptions)); /* this is the `__EXCEPTIONS` symbol */
- __eexceptions = .;
+ __eexceptions = .; /* end of exceptions */
/* Device specific interrupts */
KEEP(*(.vector_table.interrupts)); /* this is the `__INTERRUPTS` symbol */
@@ -231,8 +231,13 @@ origin and length are set to multiples of 8 in the `memory.x` file.");
/* # Position checks */
-/* ## .vector_table */
-ASSERT(__reset_vector == ADDR(.vector_table) + 0x8, "
+/* ## .vector_table
+ *
+ * If the *start* of exception vectors is not 8 bytes past the start of the
+ * vector table, then we somehow did not place the reset vector, which should
+ * live 4 bytes past the start of the vector table.
+ */
+ASSERT(__exceptions == ADDR(.vector_table) + 0x8, "
BUG(cortex-m-rt): the reset vector is missing");
ASSERT(__eexceptions == ADDR(.vector_table) + 0x40, "
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index 920c989..27bb1bd 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -1128,6 +1128,7 @@ extern "C" {
}
#[doc(hidden)]
+#[repr(C)]
pub union Vector {
handler: unsafe extern "C" fn(),
reserved: usize,