diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index e8091a2a5..b440591cf 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml @@ -86,7 +86,7 @@ boot2-w25x10cl = [] ## Have embassy-rp not provide the boot2 so you can use your own. ## Place your own in the ".boot2" section like: ## ``` -## #[unsafe(link_section = ".boot2")] +## #[link_section = ".boot2"] ## #[used] ## static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes! ## ``` @@ -109,7 +109,7 @@ imagedef-nonsecure-exe = [] ## ```ignore ## use embassy_rp::block::ImageDef; ## -## #[unsafe(link_section = ".start_block")] +## #[link_section = ".start_block"] ## #[used] ## static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation. ## ``` @@ -174,6 +174,3 @@ smart-leds = "0.4.0" [dev-dependencies] embassy-executor = { version = "0.7.0", path = "../embassy-executor", features = ["arch-std", "executor-thread"] } static_cell = { version = "2" } - -[patch.crates-io] -cortex-m-rt = { git = "https://github.com/yutannihilation/cortex-m", branch = "fix/allow-unsafe-wrap-rust2024" } diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs index 5f0bac248..14f9e46aa 100644 --- a/embassy-rp/src/bootsel.rs +++ b/embassy-rp/src/bootsel.rs @@ -36,7 +36,7 @@ mod ram_helpers { /// This function must live in ram. It uses inline asm to avoid any /// potential calls to ABI functions that might be in flash. #[inline(never)] - #[unsafe(link_section = ".data.ram_func")] + #[link_section = ".data.ram_func"] #[cfg(target_arch = "arm")] pub unsafe fn read_cs_status() -> GpioStatus { let result: u32; diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs index 1ac15a677..ef1cd9212 100644 --- a/embassy-rp/src/flash.rs +++ b/embassy-rp/src/flash.rs @@ -623,7 +623,7 @@ mod ram_helpers { /// Length of data must be a multiple of 4096 /// addr must be aligned to 4096 #[inline(never)] - #[unsafe(link_section = ".data.ram_func")] + #[link_section = ".data.ram_func"] #[cfg(feature = "rp2040")] unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { #[cfg(target_arch = "arm")] @@ -688,7 +688,7 @@ mod ram_helpers { /// Length of data must be a multiple of 4096 /// addr must be aligned to 4096 #[inline(never)] - #[unsafe(link_section = ".data.ram_func")] + #[link_section = ".data.ram_func"] #[cfg(feature = "_rp235x")] unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { let data = data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null()); @@ -807,7 +807,7 @@ mod ram_helpers { /// /// Credit: taken from `rp2040-flash` (also licensed Apache+MIT) #[inline(never)] - #[unsafe(link_section = ".data.ram_func")] + #[link_section = ".data.ram_func"] #[cfg(feature = "rp2040")] unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) { #[cfg(target_arch = "arm")] diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index 9b7c2b6ea..f549446bc 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs @@ -434,13 +434,13 @@ macro_rules! select_bootloader { ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { $( #[cfg(feature = $feature)] - #[unsafe(link_section = ".boot2")] + #[link_section = ".boot2"] #[used] static BOOT2: [u8; 256] = rp2040_boot2::$loader; )* #[cfg(not(any( $( feature = $feature),* )))] - #[unsafe(link_section = ".boot2")] + #[link_section = ".boot2"] #[used] static BOOT2: [u8; 256] = rp2040_boot2::$default; } @@ -463,13 +463,13 @@ macro_rules! select_imagedef { ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => { $( #[cfg(feature = $feature)] - #[unsafe(link_section = ".start_block")] + #[link_section = ".start_block"] #[used] static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef(); )* #[cfg(not(any( $( feature = $feature),* )))] - #[unsafe(link_section = ".start_block")] + #[link_section = ".start_block"] #[used] static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default(); } diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs index ec05bfdf5..d10b6837c 100644 --- a/embassy-rp/src/multicore.rs +++ b/embassy-rp/src/multicore.rs @@ -90,7 +90,7 @@ impl Stack { #[cfg(all(feature = "rt", feature = "rp2040"))] #[interrupt] -#[unsafe(link_section = ".data.ram_func")] +#[link_section = ".data.ram_func"] unsafe fn SIO_IRQ_PROC1() { let sio = pac::SIO; // Clear IRQ @@ -115,7 +115,7 @@ unsafe fn SIO_IRQ_PROC1() { #[cfg(all(feature = "rt", feature = "_rp235x"))] #[interrupt] -#[unsafe(link_section = ".data.ram_func")] +#[link_section = ".data.ram_func"] unsafe fn SIO_IRQ_FIFO() { let sio = pac::SIO; // Clear IRQ diff --git a/embassy-stm32-wpan/src/tables.rs b/embassy-stm32-wpan/src/tables.rs index 204790e6d..fe6fc47a3 100644 --- a/embassy-stm32-wpan/src/tables.rs +++ b/embassy-stm32-wpan/src/tables.rs @@ -190,94 +190,94 @@ pub struct RefTable { } // --------------------- ref table --------------------- -#[unsafe(link_section = "TL_REF_TABLE")] +#[link_section = "TL_REF_TABLE"] pub static mut TL_REF_TABLE: MaybeUninit = MaybeUninit::uninit(); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_DEVICE_INFO_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_BLE_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_THREAD_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_LLD_TESTS_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_BLE_LLD_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_SYS_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_MEM_MANAGER_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_TRACES_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_MAC_802_15_4_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TL_ZIGBEE_TABLE: Aligned> = Aligned(MaybeUninit::uninit()); // --------------------- tables --------------------- -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut FREE_BUF_QUEUE: Aligned> = Aligned(MaybeUninit::uninit()); #[allow(dead_code)] -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut TRACES_EVT_QUEUE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut CS_BUFFER: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut EVT_QUEUE: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut SYSTEM_EVT_QUEUE: Aligned> = Aligned(MaybeUninit::uninit()); // --------------------- app tables --------------------- #[cfg(feature = "mac")] -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut MAC_802_15_4_CMD_BUFFER: Aligned> = Aligned(MaybeUninit::uninit()); #[cfg(feature = "mac")] -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut MAC_802_15_4_NOTIF_RSP_EVT_BUFFER: MaybeUninit< Aligned, > = MaybeUninit::uninit(); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut EVT_POOL: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut SYS_CMD_BUF: Aligned> = Aligned(MaybeUninit::uninit()); -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut SYS_SPARE_EVT_BUF: Aligned> = Aligned(MaybeUninit::uninit()); #[cfg(feature = "mac")] -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut MAC_802_15_4_CNFINDNOT: Aligned> = Aligned(MaybeUninit::uninit()); #[cfg(feature = "ble")] -#[unsafe(link_section = "MB_MEM1")] +#[link_section = "MB_MEM1"] pub static mut BLE_CMD_BUFFER: Aligned> = Aligned(MaybeUninit::uninit()); #[cfg(feature = "ble")] -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] pub static mut BLE_SPARE_EVT_BUF: Aligned> = Aligned(MaybeUninit::uninit()); #[cfg(feature = "ble")] -#[unsafe(link_section = "MB_MEM2")] +#[link_section = "MB_MEM2"] // fuck these "magic" numbers from ST ---v---v pub static mut HCI_ACL_DATA_BUFFER: Aligned> = Aligned(MaybeUninit::uninit()); diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 8ba604830..226293a9d 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -331,7 +331,7 @@ mod dual_core { /// use core::mem::MaybeUninit; /// use embassy_stm32::{init_secondary, SharedData}; /// - /// #[unsafe(link_section = ".ram_d3")] + /// #[link_section = ".ram_d3"] /// static SHARED_DATA: MaybeUninit = MaybeUninit::uninit(); /// /// init_secondary(&SHARED_DATA); diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index ed3a880a0..1335aa84b 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml @@ -93,6 +93,3 @@ debug = false debug-assertions = false opt-level = 0 overflow-checks = false - -[patch.crates-io] -cortex-m-rt = { git = "https://github.com/yutannihilation/cortex-m", branch = "fix/allow-unsafe-wrap-rust2024" }