Skip to content

Commit 64637b6

Browse files
authored
flash: apply link_section for embedded targets only
This fixes unit tests for non-linux targets.
1 parent aa6c2d4 commit 64637b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hal/src/flash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl<'a> Flash<'a> {
419419
/// The compiler may inline this function, because `#[inline(never)]` is
420420
/// merely a suggestion.
421421
#[allow(unused_unsafe)]
422-
#[link_section = ".data"]
422+
#[cfg_attr(target_os = "none", link_section = ".data")]
423423
#[inline(never)]
424424
pub unsafe fn fast_program(&mut self, from: *const u64, to: *mut u64) -> Result<(), Error> {
425425
let sr: u32 = self.sr();
@@ -504,7 +504,7 @@ impl<'a> Flash<'a> {
504504
/// 1. The CPU must execute this from SRAM.
505505
/// The compiler may inline this function, because `#[inline(never)]` is
506506
/// merely a suggestion.
507-
#[link_section = ".data"]
507+
#[cfg_attr(target_os = "none", link_section = ".data")]
508508
#[inline(never)]
509509
pub unsafe fn mass_erase(&mut self) -> Result<(), Error> {
510510
let sr: u32 = self.sr();

0 commit comments

Comments
 (0)