File tree 2 files changed +20
-13
lines changed
2 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,16 @@ version = "0.2.7"
12
12
# cortex-m = "0.4.0"
13
13
# cortex-m-rt = "0.4.0"
14
14
cortex-m-rt = { git = " https://github.com/japaric/cortex-m-rt" , branch = " stable" }
15
- # cortex-m-semihosting = "0.2.0"
16
15
# panic-loop = { path = "../panic-loop" }
17
16
panic-abort = " 0.1.1"
18
17
# panic-semihosting = "0.1.0"
19
18
# Uncomment for the allocator example.
20
19
# alloc-cortex-m = "0.3.3"
21
20
21
+ [dependencies .cortex-m-semihosting ]
22
+ default-features = false
23
+ version = " 0.2.1"
24
+
22
25
# Uncomment for the device example.
23
26
# [dependencies.stm32f103xx]
24
27
# features = ["rt"]
Original file line number Diff line number Diff line change 2
2
//!
3
3
//! ---
4
4
5
- #![ feature( used) ]
5
+ #![ feature( asm) ]
6
+ #![ no_main]
6
7
#![ no_std]
7
8
8
- extern crate cortex_m ;
9
+ # [ macro_use ]
9
10
extern crate cortex_m_rt;
10
- extern crate cortex_m_semihosting;
11
+ extern crate cortex_m_semihosting as sh ;
11
12
extern crate panic_abort; // panicking behavior
12
13
13
14
use core:: fmt:: Write ;
14
15
15
- use cortex_m:: asm;
16
- use cortex_m_semihosting:: hio;
16
+ use sh:: hio;
17
17
18
- fn main ( ) {
18
+ main ! ( main) ;
19
+
20
+ fn main ( ) -> ! {
19
21
let mut stdout = hio:: hstdout ( ) . unwrap ( ) ;
20
22
writeln ! ( stdout, "Hello, world!" ) . unwrap ( ) ;
23
+
24
+ loop { }
21
25
}
22
26
23
- // As we are not using interrupts, we just register a dummy catch all handler
24
- #[ link_section = ".vector_table.interrupts" ]
25
- #[ used]
26
- static INTERRUPTS : [ extern "C" fn ( ) ; 240 ] = [ default_handler; 240 ] ;
27
+ exception ! ( DefaultHandler , dh) ;
27
28
28
- extern "C" fn default_handler ( ) {
29
- asm :: bkpt ( ) ;
29
+ fn dh ( _nr : u8 ) -> ! {
30
+ loop { }
30
31
}
32
+
33
+ // As we are not using interrupts, we just bind them all to the `DefaultHandler` exception handler
34
+ interrupts ! ( DefaultHandler ) ;
You can’t perform that action at this time.
0 commit comments