Skip to content

Commit 3b43606

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 325ddb2 commit 3b43606

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" }
9+
ariel-os-boards = { path = "../../src/ariel-os-boards" }

tests/threading-fpu/laze.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apps:
2+
- name: threading-fpu
3+
selects:
4+
- sw/threading
5+
- "context::stm32c031c6":
6+
- too-little-memory
7+
conflicts:
8+
- ram-tiny

tests/threading-fpu/src/main.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
}

0 commit comments

Comments
 (0)