Remove #[no_mangle]
from CORE_PERIPHERALS
to enable zero-cost peripherals
#242
Labels
#[no_mangle]
from CORE_PERIPHERALS
to enable zero-cost peripherals
#242
The
#[no_mangle]
on theCORE_PERIPHERALS
currently prevents LLVM from optimizing it out when only stored to:cortex-m/src/peripheral/mod.rs
Lines 152 to 153 in 1c9d36e
This means that even if an app only uses
Peripherals::steal()
, it still has to pay 1 Byte of RAM for the global. Since 1 is greater than 0, this can be improved.#[no_mangle]
is used to prevent multiple cortex-m versions to be linked together, so this behavior must be retained somehow. While we already uselinks
inCargo.toml
for this, this only works with newer versions (that are currently not even released), so another (zero-sized) global should be introduced to take overCORE_PERIPHERALS
' job.The text was updated successfully, but these errors were encountered: