|
237 | 237 | //! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after
|
238 | 238 | //! `__EXCEPTIONS` in the `.vector_table` section.
|
239 | 239 | //!
|
240 |
| -//! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults pointing at |
241 |
| -//! `1` and if not changed to point to another address, usually by calling the `pre_init!` macro, |
242 |
| -//! the `_pre_init` function is skipped. The function cannot default to `0` as the compiler |
243 |
| -//! optimizes out the check for `0` under the assumption that a function pointer cannot point to |
244 |
| -//! `0`. |
| 240 | +//! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults to an empty |
| 241 | +//! function. The function called can be changed by calling the `pre_init!` macro. The empty |
| 242 | +//! function is not optimized out by default, but if an empty function is passed to `pre_init!` the |
| 243 | +//! function call will be optimized out. |
245 | 244 | //!
|
246 | 245 | //! If you override any exception handler you'll find it as an unmangled symbol, e.g. `SysTick` or
|
247 | 246 | //! `SVCall`, in the output of `objdump`,
|
@@ -493,9 +492,7 @@ pub unsafe extern "C" fn Reset() -> ! {
|
493 | 492 | }
|
494 | 493 |
|
495 | 494 | let pre_init: unsafe extern "C" fn() = __pre_init;
|
496 |
| - if pre_init as usize != 1 { |
497 |
| - pre_init(); |
498 |
| - } |
| 495 | + pre_init(); |
499 | 496 |
|
500 | 497 | // Initialize RAM
|
501 | 498 | r0::zero_bss(&mut __sbss, &mut __ebss);
|
@@ -552,6 +549,10 @@ pub unsafe extern "C" fn DefaultUserHardFault() {
|
552 | 549 | }
|
553 | 550 | }
|
554 | 551 |
|
| 552 | +#[doc(hidden)] |
| 553 | +#[no_mangle] |
| 554 | +pub unsafe extern "C" fn DefaultPreInit() {} |
| 555 | + |
555 | 556 | /// Macro to define the entry point of the program
|
556 | 557 | ///
|
557 | 558 | /// **NOTE** This macro must be invoked once and must be invoked from an accessible module, ideally
|
|
0 commit comments