This repository was archived by the owner on Jul 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,13 +12,16 @@ version = "0.2.7"
1212# cortex-m = "0.4.0"
1313# cortex-m-rt = "0.4.0"
1414cortex-m-rt = { git = " https://github.com/japaric/cortex-m-rt" , branch = " stable" }
15- # cortex-m-semihosting = "0.2.0"
1615# panic-loop = { path = "../panic-loop" }
1716panic-abort = " 0.1.1"
1817# panic-semihosting = "0.1.0"
1918# Uncomment for the allocator example.
2019# alloc-cortex-m = "0.3.3"
2120
21+ [dependencies .cortex-m-semihosting ]
22+ default-features = false
23+ version = " 0.2.1"
24+
2225# Uncomment for the device example.
2326# [dependencies.stm32f103xx]
2427# features = ["rt"]
Original file line number Diff line number Diff line change 22//!
33//! ---
44
5- #![ feature( used) ]
5+ #![ feature( asm) ]
6+ #![ no_main]
67#![ no_std]
78
8- extern crate cortex_m ;
9+ # [ macro_use ]
910extern crate cortex_m_rt;
10- extern crate cortex_m_semihosting;
11+ extern crate cortex_m_semihosting as sh ;
1112extern crate panic_abort; // panicking behavior
1213
1314use core:: fmt:: Write ;
1415
15- use cortex_m:: asm;
16- use cortex_m_semihosting:: hio;
16+ use sh:: hio;
1717
18- fn main ( ) {
18+ main ! ( main) ;
19+
20+ fn main ( ) -> ! {
1921 let mut stdout = hio:: hstdout ( ) . unwrap ( ) ;
2022 writeln ! ( stdout, "Hello, world!" ) . unwrap ( ) ;
23+
24+ loop { }
2125}
2226
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) ;
2728
28- extern "C" fn default_handler ( ) {
29- asm :: bkpt ( ) ;
29+ fn dh ( _nr : u8 ) -> ! {
30+ loop { }
3031}
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