|
8 | 8 | //! This crates takes care of: |
9 | 9 | //! |
10 | 10 | //! - The memory layout of the program. In particular, it populates the vector table so the device |
11 | | -//! can boot correctly, and properly dispatch exceptions and interrupts. |
| 11 | +//! can boot correctly, and properly dispatch exceptions and interrupts. |
12 | 12 | //! |
13 | 13 | //! - Initializing `static` variables before the program entry point. |
14 | 14 | //! |
|
188 | 188 | //! ## `paint-stack` |
189 | 189 | //! |
190 | 190 | //! Everywhere between `__sheap` and `___stack_start` is painted with the fixed value `STACK_PAINT_VALUE`. |
191 | | -//! You can then inspect memory during debugging to determine how much of the stack has been used |
192 | | -//! - where the stack has been used the 'paint' will have been 'scrubbed off' and the memory will |
| 191 | +//! You can then inspect memory during debugging to determine how much of the stack has been used - |
| 192 | +//! where the stack has been used the 'paint' will have been 'scrubbed off' and the memory will |
193 | 193 | //! have a value other than `STACK_PAINT_VALUE`. |
194 | 194 | //! |
195 | 195 | //! # Inspection |
|
228 | 228 | //! One will always find the following (unmangled) symbols in `cortex-m-rt` applications: |
229 | 229 | //! |
230 | 230 | //! - `Reset`. This is the reset handler. The microcontroller will execute this function upon |
231 | | -//! booting. This function will call the user program entry point (cf. [`#[entry]`][attr-entry]) |
232 | | -//! using the `main` symbol so you will also find that symbol in your program. |
| 231 | +//! booting. This function will call the user program entry point (cf. [`#[entry]`][attr-entry]) |
| 232 | +//! using the `main` symbol so you will also find that symbol in your program. |
233 | 233 | //! |
234 | 234 | //! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn |
235 | | -//! DefaultHandler(..` this will be an infinite loop. |
| 235 | +//! DefaultHandler(..` this will be an infinite loop. |
236 | 236 | //! |
237 | 237 | //! - `HardFault` and `_HardFault`. These function handle the hard fault handling and what they |
238 | | -//! do depends on whether the hard fault is overridden and whether the trampoline is enabled (which it is by default). |
| 238 | +//! do depends on whether the hard fault is overridden and whether the trampoline is enabled (which it is by default). |
239 | 239 | //! - No override: Both are the same function. The function is an infinite loop defined in the cortex-m-rt crate. |
240 | 240 | //! - Trampoline enabled: `HardFault` is the real hard fault handler defined in assembly. This function is simply a |
241 | | -//! trampoline that jumps into the rust defined `_HardFault` function. This second function jumps to the user-defined |
242 | | -//! handler with the exception frame as parameter. This second jump is usually optimised away with inlining. |
| 241 | +//! trampoline that jumps into the rust defined `_HardFault` function. This second function jumps to the user-defined |
| 242 | +//! handler with the exception frame as parameter. This second jump is usually optimised away with inlining. |
243 | 243 | //! - Trampoline disabled: `HardFault` is the user defined function. This means the user function is called directly |
244 | | -//! from the vector table. `_HardFault` still exists, but is an empty function that is purely there for compiler |
245 | | -//! diagnostics. |
| 244 | +//! from the vector table. `_HardFault` still exists, but is an empty function that is purely there for compiler |
| 245 | +//! diagnostics. |
246 | 246 | //! |
247 | 247 | //! - `__STACK_START`. This is the first entry in the `.vector_table` section. This symbol contains |
248 | | -//! the initial value of the stack pointer; this is where the stack will be located -- the stack |
249 | | -//! grows downwards towards smaller addresses. |
| 248 | +//! the initial value of the stack pointer; this is where the stack will be located -- the stack |
| 249 | +//! grows downwards towards smaller addresses. |
250 | 250 | //! |
251 | 251 | //! - `__RESET_VECTOR`. This is the reset vector, a pointer to the `Reset` function. This vector |
252 | | -//! is located in the `.vector_table` section after `__STACK_START`. |
| 252 | +//! is located in the `.vector_table` section after `__STACK_START`. |
253 | 253 | //! |
254 | 254 | //! - `__EXCEPTIONS`. This is the core exceptions portion of the vector table; it's an array of 14 |
255 | | -//! exception vectors, which includes exceptions like `HardFault` and `SysTick`. This array is |
256 | | -//! located after `__RESET_VECTOR` in the `.vector_table` section. |
| 255 | +//! exception vectors, which includes exceptions like `HardFault` and `SysTick`. This array is |
| 256 | +//! located after `__RESET_VECTOR` in the `.vector_table` section. |
257 | 257 | //! |
258 | 258 | //! - `__INTERRUPTS`. This is the device specific interrupt portion of the vector table; its exact |
259 | | -//! size depends on the target device but if the `"device"` feature has not been enabled it will |
260 | | -//! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after |
261 | | -//! `__EXCEPTIONS` in the `.vector_table` section. |
| 259 | +//! size depends on the target device but if the `"device"` feature has not been enabled it will |
| 260 | +//! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after |
| 261 | +//! `__EXCEPTIONS` in the `.vector_table` section. |
262 | 262 | //! |
263 | 263 | //! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults to an empty |
264 | | -//! function. As this runs before RAM is initialised, it is not sound to use a Rust function for |
265 | | -//! `pre_init`, and instead it should typically be written in assembly using `global_asm` or an |
266 | | -//! external assembly file. |
| 264 | +//! function. As this runs before RAM is initialised, it is not sound to use a Rust function for |
| 265 | +//! `pre_init`, and instead it should typically be written in assembly using `global_asm` or an |
| 266 | +//! external assembly file. |
267 | 267 | //! |
268 | 268 | //! If you override any exception handler you'll find it as an unmangled symbol, e.g. `SysTick` or |
269 | 269 | //! `SVCall`, in the output of `objdump`, |
@@ -899,6 +899,7 @@ pub static __ONCE__: () = (); |
899 | 899 | /// Registers stacked (pushed onto the stack) during an exception. |
900 | 900 | #[derive(Clone, Copy)] |
901 | 901 | #[repr(C)] |
| 902 | +#[allow(dead_code)] |
902 | 903 | pub struct ExceptionFrame { |
903 | 904 | r0: u32, |
904 | 905 | r1: u32, |
|
0 commit comments