1616//!
1717//! This crate also provides the following attributes:
1818//!
19- //! - `#[entry]` to declare the entry point of the program
20- //! - `#[exception]` to override an exception handler. If not overridden all exception handlers
21- //! default to an infinite loop.
22- //! - `#[pre_init]` to run code *before* `static` variables are initialized
19+ //! - [ `#[entry]`][attr-entry] to declare the entry point of the program
20+ //! - [ `#[exception]`][attr-exception] to override an exception handler. If not overridden all
21+ //! exception handlers default to an infinite loop.
22+ //! - [ `#[pre_init]`][attr-pre_init] to run code *before* `static` variables are initialized
2323//!
2424//! This crate also implements a related attribute called `#[interrupt]`, which allows you
2525//! to define interrupt handlers. However, since which interrupts are available depends on the
2626//! microcontroller in use, this attribute should be re-exported and used from a device crate.
2727//!
28- //! The documentation for these attributes can be found in the [Reexports](#reexports) section.
28+ //! The documentation for these attributes can be found in the [Attribute Macros](#attributes)
29+ //! section.
2930//!
3031//! # Requirements
3132//!
194195//! One will always find the following (unmangled) symbols in `cortex-m-rt` applications:
195196//!
196197//! - `Reset`. This is the reset handler. The microcontroller will executed this function upon
197- //! booting. This function will call the user program entry point (cf. [`#[entry]`]) using the `main`
198- //! symbol so you may also find that symbol in your program; if you do, `main` will contain your
199- //! application code. Some other times `main` gets inlined into `Reset` so you won't find it.
200- //!
201- //! [`#[entry]`]: https://docs.rs/cortex-m-rt-macros/0.1.5/cortex_m_rt_macros/attr.entry.html
198+ //! booting. This function will call the user program entry point (cf. [`#[entry]`][attr-entry])
199+ //! using the `main` symbol so you may also find that symbol in your program; if you do, `main`
200+ //! will contain your application code. Some other times `main` gets inlined into `Reset` so you
201+ //! won't find it.
202202//!
203203//! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn
204204//! DefaultHandler(..` this will be an infinite loop.
227227//! `__EXCEPTIONS` in the `.vector_table` section.
228228//!
229229//! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults to an empty
230- //! function. The function called can be changed by calling the ` pre_init!` macro. The empty
231- //! function is not optimized out by default, but if an empty function is passed to `pre_init!` the
232- //! function call will be optimized out.
230+ //! function. The function called can be changed by applying the [`#[ pre_init]`][attr-pre_init]
231+ //! attribute to a function. The empty function is not optimized out by default, but if an empty
232+ //! function is passed to [`#[pre_init]`][attr-pre_init] the function call will be optimized out.
233233//!
234234//! If you override any exception handler you'll find it as an unmangled symbol, e.g. `SysTick` or
235235//! `SVCall`, in the output of `objdump`,
245245//!
246246//! ## Setting the program entry point
247247//!
248- //! This section describes how `#[entry]` is implemented. This information is useful to developers who
249- //! want to provide an alternative to `#[entry]` that provides extra guarantees.
248+ //! This section describes how [`#[entry]`][attr-entry] is implemented. This information is useful
249+ //! to developers who want to provide an alternative to [`#[entry]`][attr-entry] that provides extra
250+ //! guarantees.
250251//!
251252//! The `Reset` handler will call a symbol named `main` (unmangled) *after* initializing `.bss` and
252253//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). A function with the
253254//! `entry` attribute will be set to have the export name "`main`"; in addition, its mutable
254- //! statics are turned into safe mutable references (see [`#[entry]`] for details).
255+ //! statics are turned into safe mutable references (see [`#[entry]`][attr-entry] for details).
255256//!
256257//! The unmangled `main` symbol must have signature `extern "C" fn() -> !` or its invocation from
257258//! `Reset` will result in undefined behavior.
385386//! Be very careful with the `link_section` attribute because it's easy to misuse in ways that cause
386387//! undefined behavior. At some point in the future we may add an attribute to safely place static
387388//! variables in this section.
389+ //!
390+ //! [attr-entry]: attr.entry.html
391+ //! [attr-exception]: attr.exception.html
392+ //! [attr-pre_init]: attr.pre_init.html
388393
389394// # Developer notes
390395//
@@ -402,7 +407,9 @@ use core::fmt;
402407use core:: sync:: atomic:: { self , Ordering } ;
403408
404409#[ cfg( feature = "device" ) ]
410+ #[ doc( inline) ]
405411pub use macros:: interrupt;
412+ #[ doc( inline) ]
406413pub use macros:: { entry, exception, pre_init} ;
407414
408415#[ export_name = "error: cortex-m-rt appears more than once in the dependency graph" ]
0 commit comments