aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan McIntyre <ianpmcintyre@gmail.com>2022-11-27 21:23:56 -0500
committerIan McIntyre <ianpmcintyre@gmail.com>2022-12-01 20:21:05 -0500
commit2b3e933a71da3e00817b18d0481d3bea382f2949 (patch)
tree1c6404951c91d79dcd619c2ed3b121558a671a13 /src
parent8ba6242484308959bc24e84a8a77a28101679e1e (diff)
Update to cmrt 0.7.2, and use new features
No need for us to set VTOR and the stack pointer anymore.
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs2
-rw-r--r--src/target.rs33
2 files changed, 10 insertions, 25 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 76ba2fc..63d22d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -122,7 +122,7 @@
//!
//! # Feature flags
//!
-//! `imxrt-rt` supports the features available in `cortex-m-rt` version 0.7.1. If you enable a feature,
+//! `imxrt-rt` supports the features available in `cortex-m-rt` version 0.7.2. If you enable a feature,
//! you must enable it in both the `[dependencies]` and `[build-dependencies]` section of your package
//! manifest. For example, if the `cortex-m-rt` `"device"` feature were needed, then enable this crate's
//! `"device"` feature in both places.
diff --git a/src/target.rs b/src/target.rs
index 163fd8e..3a61584 100644
--- a/src/target.rs
+++ b/src/target.rs
@@ -17,6 +17,15 @@
//! on the 1170 chips. It's also OK to keep the POR value, since it represents the maximum-possible
//! TCM size. This means that users have finer control over xTCM memory sizes, but invalid xTCM accesses
//! won't cause a bus fault. See 3.1.3.2. in AN12077 for more discussion.
+//!
+//! Other notes:
+//!
+//! It's important that something sets the stack pointer. On the 10xx, the boot ROM sets the stack
+//! pointer. But on the 11xx, the boot ROM doesn't set the stack pointer. See the link below for
+//! more information. This implementation relies on the cortex-m-rt 0.7.2 "set-sp" feature to always
+//! set the stack pointer, no matter the target chip.
+//!
+//! <https://community.nxp.com/t5/i-MX-RT/RT1176-ROM-code-does-not-set-stack-pointer-correctly/td-p/1388830>
use core::{arch::global_asm, ffi::c_void};
@@ -58,22 +67,6 @@ __pre_init:
orr r1, r1, #1<<2 @ r1 |= 1 << 2
str r1, [r0, #64] @ *(IMXRT_IOMUXC_GPR + 16) = r1
- # Set the stack pointer.
- #
- # This is particularly important for the 11xx. Its boot ROM
- # doesn't take this step before it calls into our reset
- # handler. The 10xx boot ROM handles this differently.
- # Also noted in
- # https://community.nxp.com/t5/i-MX-RT/RT1176-ROM-code-does-not-set-stack-pointer-correctly/td-p/1388830
- #
- # If this feature is published in a future cortex-m-rt version,
- # we could remove this. See below for VTOR, too.
- #
- # Shouldn't matter where we perform this within this function.
- # We're assuming that the caller isn't using the stack.
- ldr r0, =__sstack
- msr msp, r0
-
# Conditionally copy text.
ldr r0, =__stext
ldr r2, =__sitext
@@ -104,14 +97,6 @@ __pre_init:
b 53b
52:
- # Set VTOR. If this feature is published in a future cortex-m-rt version,
- # we could remove this.
- ldr r0, =0xE000ED08
- ldr r1, =__svector_table
- str r1, [r0]
- dsb
- isb
-
# Conditionally copy read-only data.
ldr r0, =__srodata
ldr r2, =__sirodata