File tree Expand file tree Collapse file tree 6 files changed +68
-0
lines changed
Expand file tree Collapse file tree 6 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ members = [
3636 " tests/threading-dynamic-prios" ,
3737 " tests/threading-lock" ,
3838 " tests/threading-mutex" ,
39+ " tests/threading-fpu" ,
3940]
4041
4142exclude = [" src/lib" , " doc" ]
Original file line number Diff line number Diff line change 99 - spi-loopback
1010 - spi-main
1111 - threading-dynamic-prios
12+ - threading-fpu
1213 - threading-lock
1314 - threading-mutex
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " threading-fpu"
3+ edition.workspace = true
4+ license.workspace = true
5+ publish = false
6+
7+ [dependencies ]
8+ ariel-os = { path = " ../../src/ariel-os" }
9+ ariel-os-boards = { path = " ../../src/ariel-os-boards" }
Original file line number Diff line number Diff line change 1+ apps :
2+ - name : threading-fpu
3+ selects :
4+ - sw/threading
5+ - " context::stm32c031c6 " :
6+ - too-little-memory
7+ conflicts :
8+ - ram-tiny
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+ #![ no_std]
3+
4+ use ariel_os:: { debug:: log:: info, thread} ;
5+
6+ #[ ariel_os:: thread( autostart) ]
7+ fn thread0 ( ) {
8+ info ! ( "Hello from thread 0" ) ;
9+ let mut a: f32 = 1.111 ;
10+ let mut b = 2.222 ;
11+ let mut test = 0.0 ;
12+ for _ in 0 ..10 {
13+ a += 1.1234 ;
14+ b += 2.5678 ;
15+
16+ test += a + b;
17+ thread:: yield_same ( ) ;
18+ }
19+
20+ assert_eq ! ( test, 236.34601_f32 ) ;
21+ info ! ( "Thread 0 success" ) ;
22+ }
23+
24+ #[ ariel_os:: thread( autostart) ]
25+ fn thread1 ( ) {
26+ info ! ( "Hello from thread 1" ) ;
27+ let mut a: f32 = 3.333 ;
28+ let mut b = 4.444 ;
29+ let mut test = 0.0 ;
30+ for _ in 0 ..10 {
31+ a += 3.4321 ;
32+ b += 4.8765 ;
33+
34+ test += a * b;
35+
36+ thread:: yield_same ( ) ;
37+ }
38+
39+ assert_eq ! ( test, 8324.532_f32 ) ;
40+ info ! ( "Thread 1 success" ) ;
41+ }
You can’t perform that action at this time.
0 commit comments