Skip to content

Commit b7a627c

Browse files
committed
fix tests
1 parent 9bab417 commit b7a627c

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

ci/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set -ex
1+
set -euxo pipefail
22

33
main() {
44
case $TARGET in

ci/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set -ex
1+
set -euxo pipefail
22

33
main() {
44
case $TARGET in

src/peripheral/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static mut CORE_PERIPHERALS: bool = false;
6969

7070
impl Peripherals {
7171
/// Returns all the core peripherals *once*
72+
#[inline(always)]
7273
pub fn take() -> Option<Self> {
7374
interrupt::free(|_| {
7475
if unsafe { CORE_PERIPHERALS } {

src/peripheral/test.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[test]
22
fn cpuid() {
3-
let cpuid = unsafe { &*::peripheral::CPUID.get() };
3+
let cpuid = unsafe { &*::peripheral::CPUID::ptr() };
44

55
assert_eq!(address(&cpuid.base), 0xE000_ED00);
66
assert_eq!(address(&cpuid.pfr), 0xE000_ED40);
@@ -16,7 +16,7 @@ fn cpuid() {
1616

1717
#[test]
1818
fn dcb() {
19-
let dcb = unsafe { &*::peripheral::DCB.get() };
19+
let dcb = unsafe { &*::peripheral::DCB::ptr() };
2020

2121
assert_eq!(address(&dcb.dhcsr), 0xE000_EDF0);
2222
assert_eq!(address(&dcb.dcrsr), 0xE000_EDF4);
@@ -26,7 +26,7 @@ fn dcb() {
2626

2727
#[test]
2828
fn dwt() {
29-
let dwt = unsafe { &*::peripheral::DWT.get() };
29+
let dwt = unsafe { &*::peripheral::DWT::ptr() };
3030

3131
assert_eq!(address(&dwt.ctrl), 0xE000_1000);
3232
assert_eq!(address(&dwt.cyccnt), 0xE000_1004);
@@ -48,7 +48,7 @@ fn dwt() {
4848

4949
#[test]
5050
fn fpb() {
51-
let fpb = unsafe { &*::peripheral::FPB.get() };
51+
let fpb = unsafe { &*::peripheral::FPB::ptr() };
5252

5353
assert_eq!(address(&fpb.ctrl), 0xE000_2000);
5454
assert_eq!(address(&fpb.remap), 0xE000_2004);
@@ -60,7 +60,7 @@ fn fpb() {
6060

6161
#[test]
6262
fn fpu() {
63-
let fpu = unsafe { &*::peripheral::FPU.get() };
63+
let fpu = unsafe { &*::peripheral::FPU::ptr() };
6464

6565
assert_eq!(address(&fpu.fpccr), 0xE000_EF34);
6666
assert_eq!(address(&fpu.fpcar), 0xE000_EF38);
@@ -72,7 +72,7 @@ fn fpu() {
7272

7373
#[test]
7474
fn itm() {
75-
let itm = unsafe { &*::peripheral::ITM.get() };
75+
let itm = unsafe { &*::peripheral::ITM::ptr() };
7676

7777
assert_eq!(address(&itm.stim), 0xE000_0000);
7878
assert_eq!(address(&itm.ter), 0xE000_0E00);
@@ -84,7 +84,7 @@ fn itm() {
8484

8585
#[test]
8686
fn mpu() {
87-
let mpu = unsafe { &*::peripheral::MPU.get() };
87+
let mpu = unsafe { &*::peripheral::MPU::ptr() };
8888

8989
assert_eq!(address(&mpu._type), 0xE000ED90);
9090
assert_eq!(address(&mpu.ctrl), 0xE000ED94);
@@ -101,7 +101,7 @@ fn mpu() {
101101

102102
#[test]
103103
fn nvic() {
104-
let nvic = unsafe { &*::peripheral::NVIC.get() };
104+
let nvic = unsafe { &*::peripheral::NVIC::ptr() };
105105

106106
assert_eq!(address(&nvic.iser), 0xE000E100);
107107
assert_eq!(address(&nvic.iser[7]), 0xE000E11C);
@@ -119,7 +119,7 @@ fn nvic() {
119119

120120
#[test]
121121
fn scb() {
122-
let scb = unsafe { &*::peripheral::SCB.get() };
122+
let scb = unsafe { &*::peripheral::SCB::ptr() };
123123

124124
assert_eq!(address(&scb.icsr), 0xE000_ED04);
125125
assert_eq!(address(&scb.vtor), 0xE000_ED08);
@@ -140,7 +140,7 @@ fn scb() {
140140

141141
#[test]
142142
fn syst() {
143-
let syst = unsafe { &*::peripheral::SYST.get() };
143+
let syst = unsafe { &*::peripheral::SYST::ptr() };
144144

145145
assert_eq!(address(&syst.csr), 0xE000_E010);
146146
assert_eq!(address(&syst.rvr), 0xE000_E014);
@@ -151,7 +151,7 @@ fn syst() {
151151

152152
#[test]
153153
fn tpiu() {
154-
let tpiu = unsafe { &*::peripheral::TPIU.get() };
154+
let tpiu = unsafe { &*::peripheral::TPIU::ptr() };
155155

156156
assert_eq!(address(&tpiu.sspsr), 0xE004_0000);
157157
assert_eq!(address(&tpiu.cspsr), 0xE004_0004);

0 commit comments

Comments
 (0)