@@ -40,8 +40,8 @@ pub fn get_isr_location() -> ISRLocation {
40
40
/// Re-maps interrupt vectors to either RAM or Flash.
41
41
pub fn set_isr_location ( loc : ISRLocation ) {
42
42
regs:: SYSCON ( ) . sysmemremap . ignoring_state ( ) . set_map ( match loc {
43
- ISRLocation :: Bootloader => regs:: SYSCON_sysmemremap_map :: BOOT_LOADER_MODE_IN ,
44
43
ISRLocation :: RAM => regs:: SYSCON_sysmemremap_map :: USER_RAM_MODE_INTER ,
44
+ ISRLocation :: Flash => regs:: SYSCON_sysmemremap_map :: USER_FLASH_MODE_INT ,
45
45
_ => panic ! ( ) ,
46
46
} ) ;
47
47
}
@@ -75,6 +75,9 @@ mod test {
75
75
use volatile_cell:: { VolatileCellReplayer , set_replayer} ;
76
76
use expectest:: prelude:: * ;
77
77
use expectest;
78
+ use std:: thread;
79
+ use std:: string:: String ;
80
+ use std:: convert:: From ;
78
81
79
82
#[ test]
80
83
fn returns_isr_location ( ) {
@@ -98,9 +101,18 @@ mod test {
98
101
expect_replayer_valid ! ( ) ;
99
102
}
100
103
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 ) ) ;
104
116
}
105
117
106
118
#[ test]
0 commit comments