|
322 | 322 | //!
|
323 | 323 | //! We want to provide a default handler for all the interrupts while still letting the user
|
324 | 324 | //! individually override each interrupt handler. In C projects, this is usually accomplished using
|
325 |
| -//! weak aliases declared in external assembly files. In Rust, we could achieve something similar |
326 |
| -//! using `global_asm!`, but that's an unstable feature. |
327 |
| -//! |
328 |
| -//! A solution that doesn't require `global_asm!` or external assembly files is to use the `PROVIDE` |
329 |
| -//! command in a linker script to create the weak aliases. This is the approach that `cortex-m-rt` |
330 |
| -//! uses; when the `"device"` feature is enabled `cortex-m-rt`'s linker script (`link.x`) depends on |
331 |
| -//! a linker script named `device.x`. The crate that provides `__INTERRUPTS` must also provide this |
332 |
| -//! file. |
| 325 | +//! weak aliases declared in external assembly files. We use a similar solution via the `PROVIDE` |
| 326 | +//! command in the linker script: when the `"device"` feature is enabled, `cortex-m-rt`'s linker |
| 327 | +//! script (`link.x`) includes a linker script named `device.x`, which must be provided by |
| 328 | +//! whichever crate provides `__INTERRUPTS`. |
333 | 329 | //!
|
334 | 330 | //! For our running example the `device.x` linker script looks like this:
|
335 | 331 | //!
|
|
343 | 339 | //! that the core exceptions use unless overridden.
|
344 | 340 | //!
|
345 | 341 | //! Because this linker script is provided by a dependency of the final application the dependency
|
346 |
| -//! must contain build script that puts `device.x` somewhere the linker can find. An example of such |
347 |
| -//! build script is shown below: |
| 342 | +//! must contain a build script that puts `device.x` somewhere the linker can find. An example of |
| 343 | +//! such build script is shown below: |
348 | 344 | //!
|
349 | 345 | //! ```ignore
|
350 | 346 | //! use std::env;
|
@@ -586,11 +582,6 @@ cfg_global_asm! {
|
586 | 582 |
|
587 | 583 | /// Attribute to declare an interrupt (AKA device-specific exception) handler
|
588 | 584 | ///
|
589 |
| -/// **IMPORTANT**: If you are using Rust 1.30 this attribute must be used on reachable items (i.e. |
590 |
| -/// there must be no private modules between the item and the root of the crate); if the item is in |
591 |
| -/// the root of the crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 |
592 |
| -/// and newer releases. |
593 |
| -/// |
594 | 585 | /// **NOTE**: This attribute is exposed by `cortex-m-rt` only when the `device` feature is enabled.
|
595 | 586 | /// However, that export is not meant to be used directly -- using it will result in a compilation
|
596 | 587 | /// error. You should instead use the device crate (usually generated using `svd2rust`) re-export of
|
@@ -657,11 +648,6 @@ pub use macros::interrupt;
|
657 | 648 |
|
658 | 649 | /// Attribute to declare the entry point of the program
|
659 | 650 | ///
|
660 |
| -/// **IMPORTANT**: This attribute must appear exactly *once* in the dependency graph. Also, if you |
661 |
| -/// are using Rust 1.30 the attribute must be used on a reachable item (i.e. there must be no |
662 |
| -/// private modules between the item and the root of the crate); if the item is in the root of the |
663 |
| -/// crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 and newer releases. |
664 |
| -/// |
665 | 651 | /// The specified function will be called by the reset handler *after* RAM has been initialized. In
|
666 | 652 | /// the case of the `thumbv7em-none-eabihf` target the FPU will also be enabled before the function
|
667 | 653 | /// is called.
|
@@ -716,11 +702,6 @@ pub use macros::entry;
|
716 | 702 |
|
717 | 703 | /// Attribute to declare an exception handler
|
718 | 704 | ///
|
719 |
| -/// **IMPORTANT**: If you are using Rust 1.30 this attribute must be used on reachable items (i.e. |
720 |
| -/// there must be no private modules between the item and the root of the crate); if the item is in |
721 |
| -/// the root of the crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 |
722 |
| -/// and newer releases. |
723 |
| -/// |
724 | 705 | /// # Syntax
|
725 | 706 | ///
|
726 | 707 | /// ```
|
@@ -832,11 +813,7 @@ pub use macros::exception;
|
832 | 813 |
|
833 | 814 | /// Attribute to mark which function will be called at the beginning of the reset handler.
|
834 | 815 | ///
|
835 |
| -/// **IMPORTANT**: This attribute can appear at most *once* in the dependency graph. Also, if you |
836 |
| -/// are using Rust 1.30 the attribute must be used on a reachable item (i.e. there must be no |
837 |
| -/// private modules between the item and the root of the crate); if the item is in the root of the |
838 |
| -/// crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 and newer |
839 |
| -/// releases. |
| 816 | +/// **IMPORTANT**: This attribute can appear at most *once* in the dependency graph. |
840 | 817 | ///
|
841 | 818 | /// The function must have the signature of `unsafe fn()`.
|
842 | 819 | ///
|
@@ -1071,21 +1048,13 @@ pub static __RESET_VECTOR: unsafe extern "C" fn() -> ! = Reset;
|
1071 | 1048 | #[cfg_attr(cortex_m, link_section = ".HardFault.default")]
|
1072 | 1049 | #[no_mangle]
|
1073 | 1050 | pub unsafe extern "C" fn HardFault_(ef: &ExceptionFrame) -> ! {
|
1074 |
| - loop { |
1075 |
| - // add some side effect to prevent this from turning into a UDF instruction |
1076 |
| - // see rust-lang/rust#28728 for details |
1077 |
| - atomic::compiler_fence(Ordering::SeqCst); |
1078 |
| - } |
| 1051 | + loop {} |
1079 | 1052 | }
|
1080 | 1053 |
|
1081 | 1054 | #[doc(hidden)]
|
1082 | 1055 | #[no_mangle]
|
1083 | 1056 | pub unsafe extern "C" fn DefaultHandler_() -> ! {
|
1084 |
| - loop { |
1085 |
| - // add some side effect to prevent this from turning into a UDF instruction |
1086 |
| - // see rust-lang/rust#28728 for details |
1087 |
| - atomic::compiler_fence(Ordering::SeqCst); |
1088 |
| - } |
| 1057 | + loop {} |
1089 | 1058 | }
|
1090 | 1059 |
|
1091 | 1060 | #[doc(hidden)]
|
|
0 commit comments