16
16
//!
17
17
//! This crate also provides the following attributes:
18
18
//!
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
23
23
//!
24
24
//! This crate also implements a related attribute called `#[interrupt]`, which allows you
25
25
//! to define interrupt handlers. However, since which interrupts are available depends on the
26
26
//! microcontroller in use, this attribute should be re-exported and used from a device crate.
27
27
//!
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.
29
30
//!
30
31
//! # Requirements
31
32
//!
194
195
//! One will always find the following (unmangled) symbols in `cortex-m-rt` applications:
195
196
//!
196
197
//! - `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.
202
202
//!
203
203
//! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn
204
204
//! DefaultHandler(..` this will be an infinite loop.
227
227
//! `__EXCEPTIONS` in the `.vector_table` section.
228
228
//!
229
229
//! - `__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.
233
233
//!
234
234
//! If you override any exception handler you'll find it as an unmangled symbol, e.g. `SysTick` or
235
235
//! `SVCall`, in the output of `objdump`,
245
245
//!
246
246
//! ## Setting the program entry point
247
247
//!
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.
250
251
//!
251
252
//! The `Reset` handler will call a symbol named `main` (unmangled) *after* initializing `.bss` and
252
253
//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). A function with the
253
254
//! `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).
255
256
//!
256
257
//! The unmangled `main` symbol must have signature `extern "C" fn() -> !` or its invocation from
257
258
//! `Reset` will result in undefined behavior.
385
386
//! Be very careful with the `link_section` attribute because it's easy to misuse in ways that cause
386
387
//! undefined behavior. At some point in the future we may add an attribute to safely place static
387
388
//! 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
388
393
389
394
// # Developer notes
390
395
//
@@ -402,7 +407,9 @@ use core::fmt;
402
407
use core:: sync:: atomic:: { self , Ordering } ;
403
408
404
409
#[ cfg( feature = "device" ) ]
410
+ #[ doc( inline) ]
405
411
pub use macros:: interrupt;
412
+ #[ doc( inline) ]
406
413
pub use macros:: { entry, exception, pre_init} ;
407
414
408
415
#[ export_name = "error: cortex-m-rt appears more than once in the dependency graph" ]
0 commit comments