Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit befa1ba

Browse filesBrowse files
committed
Mark pre_init as deprecated
1 parent c3d664b commit befa1ba
Copy full SHA for befa1ba

File tree

Expand file treeCollapse file tree

3 files changed

+11
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-4
lines changed

‎cortex-m-rt/CHANGELOG.md

Copy file name to clipboardExpand all lines: cortex-m-rt/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- Mark `pre_init` as deprecated
1011
- Add `set_msplim` feature to conditionally set the MSPLIM register at device
1112
reset ([#580]).
1213

‎cortex-m-rt/examples/pre_init.rs

Copy file name to clipboardExpand all lines: cortex-m-rt/examples/pre_init.rs
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
extern crate cortex_m_rt as rt;
88
extern crate panic_halt;
99

10-
use rt::{entry, pre_init};
10+
use rt::entry;
1111

12-
#[pre_init]
13-
unsafe fn disable_watchdog() {
14-
// Do what you need to disable the watchdog.
12+
// This function is called before the RAM is initialized.
13+
// For example, it can be used to disable the watchdog.
14+
core::arch::global_asm! {
15+
r#"
16+
__pre_init:
17+
// Do what you need to do before RAM is initialized.
18+
ret
19+
"#
1520
}
1621

1722
#[entry]

‎cortex-m-rt/macros/src/lib.rs

Copy file name to clipboardExpand all lines: cortex-m-rt/macros/src/lib.rs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
628628
}
629629

630630
#[proc_macro_attribute]
631+
#[deprecated(note = "Use core::arch::global_asm! to define the __pre_init function instead")]
631632
pub fn pre_init(args: TokenStream, input: TokenStream) -> TokenStream {
632633
let f = parse_macro_input!(input as ItemFn);
633634

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.