diff --git a/ci/install.sh b/ci/install.sh index f978160303f8cd6f45f5cbe12c12d8008cfbc93a..b7d81951c95b7470f90c24a54d789ea926128100 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -1,4 +1,4 @@ -set -ex +set -euxo pipefail main() { case $TARGET in diff --git a/ci/script.sh b/ci/script.sh index 080e7569fe283e53ad9fff02d5201a66b7be585d..9b60f0c23ddcd2c65346ff1aefa3269d4d577fdd 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -1,4 +1,4 @@ -set -ex +set -euxo pipefail main() { case $TARGET in diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index 74823987dcb2086f1a4faf64ecbf88d44263cca0..a2c768e1c52eccf14cd7b3bb302a07c9b17d2a39 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -69,6 +69,7 @@ static mut CORE_PERIPHERALS: bool = false; impl Peripherals { /// Returns all the core peripherals *once* + #[inline(always)] pub fn take() -> Option<Self> { interrupt::free(|_| { if unsafe { CORE_PERIPHERALS } { diff --git a/src/peripheral/test.rs b/src/peripheral/test.rs index 4cc488a9c6df0b604775cf9c1b620d7566503167..4283954eb531bd727c82d6b02b3c95252c99ef47 100644 --- a/src/peripheral/test.rs +++ b/src/peripheral/test.rs @@ -1,6 +1,6 @@ #[test] fn cpuid() { - let cpuid = unsafe { &*::peripheral::CPUID.get() }; + let cpuid = unsafe { &*::peripheral::CPUID::ptr() }; assert_eq!(address(&cpuid.base), 0xE000_ED00); assert_eq!(address(&cpuid.pfr), 0xE000_ED40); @@ -16,7 +16,7 @@ fn cpuid() { #[test] fn dcb() { - let dcb = unsafe { &*::peripheral::DCB.get() }; + let dcb = unsafe { &*::peripheral::DCB::ptr() }; assert_eq!(address(&dcb.dhcsr), 0xE000_EDF0); assert_eq!(address(&dcb.dcrsr), 0xE000_EDF4); @@ -26,7 +26,7 @@ fn dcb() { #[test] fn dwt() { - let dwt = unsafe { &*::peripheral::DWT.get() }; + let dwt = unsafe { &*::peripheral::DWT::ptr() }; assert_eq!(address(&dwt.ctrl), 0xE000_1000); assert_eq!(address(&dwt.cyccnt), 0xE000_1004); @@ -48,7 +48,7 @@ fn dwt() { #[test] fn fpb() { - let fpb = unsafe { &*::peripheral::FPB.get() }; + let fpb = unsafe { &*::peripheral::FPB::ptr() }; assert_eq!(address(&fpb.ctrl), 0xE000_2000); assert_eq!(address(&fpb.remap), 0xE000_2004); @@ -60,7 +60,7 @@ fn fpb() { #[test] fn fpu() { - let fpu = unsafe { &*::peripheral::FPU.get() }; + let fpu = unsafe { &*::peripheral::FPU::ptr() }; assert_eq!(address(&fpu.fpccr), 0xE000_EF34); assert_eq!(address(&fpu.fpcar), 0xE000_EF38); @@ -72,7 +72,7 @@ fn fpu() { #[test] fn itm() { - let itm = unsafe { &*::peripheral::ITM.get() }; + let itm = unsafe { &*::peripheral::ITM::ptr() }; assert_eq!(address(&itm.stim), 0xE000_0000); assert_eq!(address(&itm.ter), 0xE000_0E00); @@ -84,7 +84,7 @@ fn itm() { #[test] fn mpu() { - let mpu = unsafe { &*::peripheral::MPU.get() }; + let mpu = unsafe { &*::peripheral::MPU::ptr() }; assert_eq!(address(&mpu._type), 0xE000ED90); assert_eq!(address(&mpu.ctrl), 0xE000ED94); @@ -101,7 +101,7 @@ fn mpu() { #[test] fn nvic() { - let nvic = unsafe { &*::peripheral::NVIC.get() }; + let nvic = unsafe { &*::peripheral::NVIC::ptr() }; assert_eq!(address(&nvic.iser), 0xE000E100); assert_eq!(address(&nvic.iser[7]), 0xE000E11C); @@ -119,7 +119,7 @@ fn nvic() { #[test] fn scb() { - let scb = unsafe { &*::peripheral::SCB.get() }; + let scb = unsafe { &*::peripheral::SCB::ptr() }; assert_eq!(address(&scb.icsr), 0xE000_ED04); assert_eq!(address(&scb.vtor), 0xE000_ED08); @@ -140,7 +140,7 @@ fn scb() { #[test] fn syst() { - let syst = unsafe { &*::peripheral::SYST.get() }; + let syst = unsafe { &*::peripheral::SYST::ptr() }; assert_eq!(address(&syst.csr), 0xE000_E010); assert_eq!(address(&syst.rvr), 0xE000_E014); @@ -151,7 +151,7 @@ fn syst() { #[test] fn tpiu() { - let tpiu = unsafe { &*::peripheral::TPIU.get() }; + let tpiu = unsafe { &*::peripheral::TPIU::ptr() }; assert_eq!(address(&tpiu.sspsr), 0xE004_0000); assert_eq!(address(&tpiu.cspsr), 0xE004_0004);