Skip to content

Commit 84ca49b

Browse files
committed
feat(tests): Add test to verify hard float scheduling on Cortex-M
Signed-off-by: Ollrogge <nils-ollrogge@outlook.de>
1 parent 783ffcd commit 84ca49b

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed

Cargo.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

4142
exclude = ["src/lib", "doc"]

tests/laze.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ subdirs:
99
- spi-loopback
1010
- spi-main
1111
- threading-dynamic-prios
12+
- threading-fpu
1213
- threading-lock
1314
- threading-mutex

tests/threading-fpu/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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", features = ["time"] }
9+
ariel-os-boards = { path = "../../src/ariel-os-boards" }

tests/threading-fpu/laze.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apps:
2+
- name: threading-fpu
3+
selects:
4+
- sw/threading

tests/threading-fpu/src/main.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#![no_main]
2+
#![no_std]
3+
4+
use ariel_os::debug::log::*;
5+
use ariel_os::debug::{ExitCode, exit, log::info};
6+
use ariel_os::gpio::{Level, Output};
7+
8+
use ariel_os::thread;
9+
10+
#[ariel_os::thread(autostart)]
11+
fn thread0() {
12+
info!("Hello from thread 0");
13+
let mut a: f32 = 1.111;
14+
let mut b = 2.222;
15+
let mut test = 0.0;
16+
for _ in 0..10 {
17+
a += 1.1234;
18+
b += 2.5678;
19+
20+
test += a + b;
21+
thread::yield_same();
22+
}
23+
24+
assert_eq!(test, 236.34601_f32);
25+
exit(ExitCode::SUCCESS);
26+
}
27+
28+
#[ariel_os::thread(autostart)]
29+
fn thread1() {
30+
info!("Hello from thread 1");
31+
let mut a: f32 = 3.333;
32+
let mut b = 4.444;
33+
let mut test = 0.0;
34+
for _ in 0..10 {
35+
a += 3.4321;
36+
b += 4.8765;
37+
38+
test += a * b;
39+
40+
thread::yield_same();
41+
}
42+
43+
assert_eq!(test, 8324.532_f32);
44+
exit(ExitCode::SUCCESS);
45+
}

0 commit comments

Comments
 (0)