|
194 | 194 | //! One will always find the following (unmangled) symbols in `cortex-m-rt` applications:
|
195 | 195 | //!
|
196 | 196 | //! - `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` |
| 197 | +//! booting. This function will call the user program entry point (cf. [`#[entry]`]) using the `main` |
198 | 198 | //! symbol so you may also find that symbol in your program; if you do, `main` will contain your
|
199 | 199 | //! application code. Some other times `main` gets inlined into `Reset` so you won't find it.
|
200 | 200 | //!
|
201 |
| -//! [`entry!`]: macro.entry.html |
| 201 | +//! [`#[entry]`]: https://docs.rs/cortex-m-rt-macros/0.1.5/cortex_m_rt_macros/attr.entry.html |
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.
|
|
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]` is implemented. This information is useful to developers who |
| 249 | +//! want to provide an alternative to `#[entry]` that provides extra guarantees. |
250 | 250 | //!
|
251 | 251 | //! The `Reset` handler will call a symbol named `main` (unmangled) *after* initializing `.bss` and
|
252 |
| -//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). `entry!` provides this |
253 |
| -//! symbol in its expansion: |
254 |
| -//! |
255 |
| -//! ``` ignore |
256 |
| -//! entry!(path::to::main); |
257 |
| -//! |
258 |
| -//! // expands into |
259 |
| -//! |
260 |
| -//! #[export_name = "main"] |
261 |
| -//! pub extern "C" fn __impl_main() -> ! { |
262 |
| -//! // validate the signature of the program entry point |
263 |
| -//! let f: fn() -> ! = path::to::main; |
264 |
| -//! |
265 |
| -//! f() |
266 |
| -//! } |
267 |
| -//! ``` |
| 252 | +//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). A function with the |
| 253 | +//! `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). |
268 | 255 | //!
|
269 | 256 | //! The unmangled `main` symbol must have signature `extern "C" fn() -> !` or its invocation from
|
270 | 257 | //! `Reset` will result in undefined behavior.
|
|
0 commit comments