Skip to content

Commit

Permalink
Remove static-mut warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster committed Jun 6, 2024
1 parent 3a21af4 commit 1858bec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions neotron-os/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ impl core::fmt::Write for Ctx {
/// (as it doesn't know where they are).
#[cfg(all(target_os = "none", not(feature = "lib-mode")))]
unsafe fn start_up_init() {
use core::ptr::{addr_of, addr_of_mut};

extern "C" {

// These symbols come from `link.x`
Expand All @@ -367,8 +369,12 @@ unsafe fn start_up_init() {
static __sidata: u32;
}

r0::zero_bss(&mut __sbss, &mut __ebss);
r0::init_data(&mut __sdata, &mut __edata, &__sidata);
r0::zero_bss(addr_of_mut!(__sbss), addr_of_mut!(__ebss));
r0::init_data(
addr_of_mut!(__sdata),
addr_of_mut!(__edata),
addr_of!(__sidata),
);
}

#[cfg(any(not(target_os = "none"), feature = "lib-mode"))]
Expand Down
2 changes: 1 addition & 1 deletion neotron-os/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl TransientProgramArea {
// points to, as the linker can only invent symbols pointing at
// addresses; it cannot actually put values in RAM.
#[cfg(all(target_os = "none", target_arch = "arm"))]
let official_tpa_start: Option<*mut u32> = Some((&mut _tpa_start) as *mut u32);
let official_tpa_start: Option<*mut u32> = Some(core::ptr::addr_of_mut!(_tpa_start));

#[cfg(not(all(target_os = "none", target_arch = "arm")))]
let official_tpa_start: Option<*mut u32> = None;
Expand Down

0 comments on commit 1858bec

Please sign in to comment.