File tree Expand file tree Collapse file tree 13 files changed +517
-281
lines changed Expand file tree Collapse file tree 13 files changed +517
-281
lines changed Original file line number Diff line number Diff line change 11** /* .rs.bk
2+ . #*
23Cargo.lock
34bin /* .after
45bin /* .before
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ version = "0.5.3"
1212
1313[dependencies ]
1414r0 = " 0.2.1"
15+ cortex-m-rt-macros = { path = " macros" , version = " 0.1.0" }
1516
1617[dev-dependencies ]
1718panic-semihosting = " 0.3.0"
Original file line number Diff line number Diff line change 55
66 cargo check --target $TARGET --features device
77
8+ ( cd macros && cargo check && cargo test )
9+
810 local examples=(
911 alignment
1012 minimal
Original file line number Diff line number Diff line change 44#![ no_main]
55#![ no_std]
66
7- #[ macro_use( entry) ]
87extern crate cortex_m_rt as rt;
98extern crate panic_abort;
109
1110use core:: ptr;
1211
13- entry ! ( main ) ;
12+ use rt :: entry;
1413
1514static mut BSS1 : u16 = 0 ;
1615static mut BSS2 : u8 = 0 ;
@@ -19,6 +18,7 @@ static mut DATA2: u16 = 1;
1918static RODATA1 : & [ u8 ; 3 ] = b"012" ;
2019static RODATA2 : & [ u8 ; 2 ] = b"34" ;
2120
21+ #[ entry]
2222fn main ( ) -> ! {
2323 unsafe {
2424 let _bss1 = ptr:: read_volatile ( & BSS1 ) ;
Original file line number Diff line number Diff line change 55#![ no_main]
66#![ no_std]
77
8- #[ macro_use( entry) ]
98extern crate cortex_m_rt as rt;
109extern crate panic_abort;
1110
1211use core:: ptr;
1312
14- entry ! ( main ) ;
13+ use rt :: entry;
1514
1615// This large static array uses most of .rodata
1716static RODATA : [ u8 ; 48 * 1024 ] = [ 1u8 ; 48 * 1024 ] ;
@@ -20,6 +19,7 @@ static RODATA: [u8; 48*1024] = [1u8; 48*1024];
2019// without also overflowing RAM.
2120static mut DATA : [ u8 ; 16 * 1024 ] = [ 1u8 ; 16 * 1024 ] ;
2221
22+ #[ entry]
2323fn main ( ) -> ! {
2424 unsafe {
2525 let _bigdata = ptr:: read_volatile ( & RODATA as * const u8 ) ;
Original file line number Diff line number Diff line change 55#![ no_main]
66#![ no_std]
77
8- #[ macro_use( entry) ]
98extern crate cortex_m_rt as rt;
109extern crate panic_semihosting;
1110
12- // the program entry point
13- entry ! ( main) ;
11+ use rt:: entry;
1412
13+ #[ entry]
1514fn main ( ) -> ! {
1615 loop { }
1716}
Original file line number Diff line number Diff line change 55#![ no_main]
66#![ no_std]
77
8- #[ macro_use( entry) ]
98extern crate cortex_m_rt as rt;
109extern crate panic_semihosting;
1110
12- // the program entry point
13- entry ! ( main) ;
11+ use rt:: entry;
1412
13+ // the program entry point
14+ #[ entry]
1515fn main ( ) -> ! {
1616 loop { }
1717}
Original file line number Diff line number Diff line change 66#![ no_std]
77
88extern crate cortex_m;
9- #[ macro_use( entry, exception) ]
109extern crate cortex_m_rt as rt;
1110extern crate panic_semihosting;
1211
1312use cortex_m:: asm;
14- use rt:: ExceptionFrame ;
15-
16- // the program entry point
17- entry ! ( main) ;
13+ use rt:: { entry, exception, ExceptionFrame } ;
1814
15+ #[ entry]
1916fn main ( ) -> ! {
2017 loop { }
2118}
2219
23- exception ! ( * , default_handler) ;
24-
20+ #[ exception( DefaultHandler ) ]
2521fn default_handler ( _irqn : i16 ) {
2622 asm:: bkpt ( ) ;
2723}
2824
29- exception ! ( HardFault , hard_fault) ;
30-
25+ #[ exception( HardFault ) ]
3126fn hard_fault ( _ef : & ExceptionFrame ) -> ! {
3227 asm:: bkpt ( ) ;
3328
Original file line number Diff line number Diff line change 44#![ no_main]
55#![ no_std]
66
7- #[ macro_use( entry, pre_init) ]
87extern crate cortex_m_rt as rt;
98extern crate panic_semihosting;
109
11- pre_init ! ( disable_watchdog ) ;
10+ use rt :: { entry , pre_init} ;
1211
12+ #[ pre_init]
1313unsafe fn disable_watchdog ( ) {
1414 // Do what you need to disable the watchdog.
1515}
1616
17- // the program entry point
18- entry ! ( main) ;
19-
17+ #[ entry]
2018fn main ( ) -> ! {
2119 loop { }
2220}
Original file line number Diff line number Diff line change 55#![ no_main]
66#![ no_std]
77
8- #[ macro_use( entry, exception) ]
98extern crate cortex_m_rt as rt;
109extern crate panic_semihosting;
1110
12- // the program entry point
13- entry ! ( main) ;
11+ use rt:: { entry, exception} ;
1412
13+ #[ entry]
1514fn main ( ) -> ! {
1615 loop { }
1716}
1817
1918// exception handler with state
20- exception ! ( SysTick , sys_tick, state: u32 = 0 ) ;
21-
22- fn sys_tick ( state : & mut u32 ) {
23- * state += 1 ;
19+ #[ exception( SysTick , static STATE : u32 = 0 ) ]
20+ fn sys_tick ( ) {
21+ * STATE += 1 ;
2422}
You can’t perform that action at this time.
0 commit comments