Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Commit 96b6943

Browse files
committed
Panic is ISR are switched over to bootloader
1 parent caa9c29 commit 96b6943

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/hal/lpc11xx/syscon.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub fn get_isr_location() -> ISRLocation {
4040
/// Re-maps interrupt vectors to either RAM or Flash.
4141
pub fn set_isr_location(loc: ISRLocation) {
4242
regs::SYSCON().sysmemremap.ignoring_state().set_map(match loc {
43-
ISRLocation::Bootloader => regs::SYSCON_sysmemremap_map::BOOT_LOADER_MODE_IN,
4443
ISRLocation::RAM => regs::SYSCON_sysmemremap_map::USER_RAM_MODE_INTER,
44+
ISRLocation::Flash => regs::SYSCON_sysmemremap_map::USER_FLASH_MODE_INT,
4545
_ => panic!(),
4646
});
4747
}
@@ -75,6 +75,9 @@ mod test {
7575
use volatile_cell::{VolatileCellReplayer, set_replayer};
7676
use expectest::prelude::*;
7777
use expectest;
78+
use std::thread;
79+
use std::string::String;
80+
use std::convert::From;
7881

7982
#[test]
8083
fn returns_isr_location() {
@@ -98,9 +101,18 @@ mod test {
98101
expect_replayer_valid!();
99102
}
100103

101-
set_isr_location(ISRLocation::Bootloader);
102-
103-
expect_replayer_valid!(replayer);
104+
#[test]
105+
fn fails_to_set_isr_location_to_bootloader() {
106+
let j = thread::Builder::new()
107+
.name(String::from("fails_to_set_isr_location_to_bootloader"))
108+
.spawn(|| {
109+
init_replayer!();
110+
expect_volatile_write!(0x4004_8000, 0);
111+
set_isr_location(ISRLocation::Bootloader);
112+
}).unwrap();
113+
let res = j.join();
114+
115+
expect!(res.is_err()).to(be_equal_to(true));
104116
}
105117

106118
#[test]

0 commit comments

Comments
 (0)