File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ use cortex_m_rt::entry;
2424use cortex_m_semihosting:: hprintln;
2525use panic_halt as _;
2626
27+ // Minimal dummy critical-section implementation for single-core boards
28+ #[ no_mangle]
29+ extern "C" fn _critical_section_1_0_acquire ( ) -> u8 {
30+ 0
31+ }
32+ #[ no_mangle]
33+ extern "C" fn _critical_section_1_0_release ( _token : u8 ) { }
34+
2735static mut COUNTER : u32 = 42 ;
2836
2937#[ entry]
@@ -33,9 +41,11 @@ fn main() -> ! {
3341 ( COUNTER - 1 , COUNTER )
3442 } ;
3543
44+ // Print via semihosting; ignore errors
3645 hprintln ! ( "Previous counter value: {}" , prev) ;
3746 hprintln ! ( "New counter value: {}" , new) ;
3847
48+ // Panic if data section not initialized properly
3949 if prev != 42 || new != 43 {
4050 panic ! ( "Unexpected COUNTER value! Data section may not be initialized." ) ;
4151 }
You can’t perform that action at this time.
0 commit comments