-
Notifications
You must be signed in to change notification settings - Fork 12
Adds a basic FPU test. #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thejpster
wants to merge
2
commits into
rust-embedded:main
Choose a base branch
from
thejpster:add-fpu-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
202 changes: 202 additions & 0 deletions
202
examples/mps3-an536/reference/fpu-test-armv8r-none-eabihf.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
Sine wave test (f32)... | ||
( 0.0000) ..............................o | ||
( 0.1253) .................................o | ||
( 0.2487) .....................................o | ||
( 0.3681) .........................................o | ||
( 0.4818) ............................................o | ||
( 0.5878) ...............................................o | ||
( 0.6845) ..................................................o | ||
( 0.7705) .....................................................o | ||
( 0.8443) .......................................................o | ||
( 0.9048) .........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9048) .........................................................o | ||
( 0.8443) .......................................................o | ||
( 0.7705) .....................................................o | ||
( 0.6845) ..................................................o | ||
( 0.5878) ...............................................o | ||
( 0.4818) ............................................o | ||
( 0.3681) .........................................o | ||
( 0.2487) .....................................o | ||
( 0.1253) .................................o | ||
(-0.0000) .............................o | ||
(-0.1253) ..........................o | ||
(-0.2487) ......................o | ||
(-0.3681) ..................o | ||
(-0.4818) ...............o | ||
(-0.5878) ............o | ||
(-0.6845) .........o | ||
(-0.7705) ......o | ||
(-0.8443) ....o | ||
(-0.9048) ..o | ||
(-0.9511) .o | ||
(-0.9823) o | ||
(-0.9980) o | ||
(-0.9980) o | ||
(-0.9823) o | ||
(-0.9511) .o | ||
(-0.9048) ..o | ||
(-0.8443) ....o | ||
(-0.7705) ......o | ||
(-0.6845) .........o | ||
(-0.5878) ............o | ||
(-0.4818) ...............o | ||
(-0.3681) ..................o | ||
(-0.2487) ......................o | ||
(-0.1253) ..........................o | ||
( 0.0000) ..............................o | ||
( 0.1253) .................................o | ||
( 0.2487) .....................................o | ||
( 0.3681) .........................................o | ||
( 0.4818) ............................................o | ||
( 0.5878) ...............................................o | ||
( 0.6845) ..................................................o | ||
( 0.7705) .....................................................o | ||
( 0.8443) .......................................................o | ||
( 0.9048) .........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9048) .........................................................o | ||
( 0.8443) .......................................................o | ||
( 0.7705) .....................................................o | ||
( 0.6845) ..................................................o | ||
( 0.5878) ...............................................o | ||
( 0.4818) ............................................o | ||
( 0.3681) .........................................o | ||
( 0.2487) .....................................o | ||
( 0.1253) .................................o | ||
(-0.0000) ..............................o | ||
(-0.1253) ..........................o | ||
(-0.2487) ......................o | ||
(-0.3681) ..................o | ||
(-0.4818) ...............o | ||
(-0.5878) ............o | ||
(-0.6845) .........o | ||
(-0.7705) ......o | ||
(-0.8443) ....o | ||
(-0.9048) ..o | ||
(-0.9511) .o | ||
(-0.9823) o | ||
(-0.9980) o | ||
(-0.9980) o | ||
(-0.9823) o | ||
(-0.9511) .o | ||
(-0.9048) ..o | ||
(-0.8443) ....o | ||
(-0.7705) ......o | ||
(-0.6845) .........o | ||
(-0.5878) ............o | ||
(-0.4818) ...............o | ||
(-0.3681) ..................o | ||
(-0.2487) ......................o | ||
(-0.1253) ..........................o | ||
Sine wave test (f64)... | ||
( 0.0000) ..............................o | ||
( 0.1253) .................................o | ||
( 0.2487) .....................................o | ||
( 0.3681) .........................................o | ||
( 0.4818) ............................................o | ||
( 0.5878) ...............................................o | ||
( 0.6845) ..................................................o | ||
( 0.7705) .....................................................o | ||
( 0.8443) .......................................................o | ||
( 0.9048) .........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9048) .........................................................o | ||
( 0.8443) .......................................................o | ||
( 0.7705) .....................................................o | ||
( 0.6845) ..................................................o | ||
( 0.5878) ...............................................o | ||
( 0.4818) ............................................o | ||
( 0.3681) .........................................o | ||
( 0.2487) .....................................o | ||
( 0.1253) .................................o | ||
(-0.0000) .............................o | ||
(-0.1253) ..........................o | ||
(-0.2487) ......................o | ||
(-0.3681) ..................o | ||
(-0.4818) ...............o | ||
(-0.5878) ............o | ||
(-0.6845) .........o | ||
(-0.7705) ......o | ||
(-0.8443) ....o | ||
(-0.9048) ..o | ||
(-0.9511) .o | ||
(-0.9823) o | ||
(-0.9980) o | ||
(-0.9980) o | ||
(-0.9823) o | ||
(-0.9511) .o | ||
(-0.9048) ..o | ||
(-0.8443) ....o | ||
(-0.7705) ......o | ||
(-0.6845) .........o | ||
(-0.5878) ............o | ||
(-0.4818) ...............o | ||
(-0.3681) ..................o | ||
(-0.2487) ......................o | ||
(-0.1253) ..........................o | ||
( 0.0000) ..............................o | ||
( 0.1253) .................................o | ||
( 0.2487) .....................................o | ||
( 0.3681) .........................................o | ||
( 0.4818) ............................................o | ||
( 0.5878) ...............................................o | ||
( 0.6845) ..................................................o | ||
( 0.7705) .....................................................o | ||
( 0.8443) .......................................................o | ||
( 0.9048) .........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9980) ...........................................................o | ||
( 0.9823) ...........................................................o | ||
( 0.9511) ..........................................................o | ||
( 0.9048) .........................................................o | ||
( 0.8443) .......................................................o | ||
( 0.7705) .....................................................o | ||
( 0.6845) ..................................................o | ||
( 0.5878) ...............................................o | ||
( 0.4818) ............................................o | ||
( 0.3681) .........................................o | ||
( 0.2487) .....................................o | ||
( 0.1253) .................................o | ||
(-0.0000) .............................o | ||
(-0.1253) ..........................o | ||
(-0.2487) ......................o | ||
(-0.3681) ..................o | ||
(-0.4818) ...............o | ||
(-0.5878) ............o | ||
(-0.6845) .........o | ||
(-0.7705) ......o | ||
(-0.8443) ....o | ||
(-0.9048) ..o | ||
(-0.9511) .o | ||
(-0.9823) o | ||
(-0.9980) o | ||
(-0.9980) o | ||
(-0.9823) o | ||
(-0.9511) .o | ||
(-0.9048) ..o | ||
(-0.8443) ....o | ||
(-0.7705) ......o | ||
(-0.6845) .........o | ||
(-0.5878) ............o | ||
(-0.4818) ...............o | ||
(-0.3681) ..................o | ||
(-0.2487) ......................o | ||
(-0.1253) ..........................o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Simple FPU test | ||
|
||
#![no_std] | ||
#![no_main] | ||
|
||
// pull in our start-up code | ||
use cortex_r_rt::entry; | ||
|
||
// pull in our library | ||
use mps3_an536 as _; | ||
|
||
use semihosting::println; | ||
|
||
static BAR: &str = "............................................................"; | ||
const MAX_LEN: f32 = BAR.len() as f32; | ||
|
||
/// The entry-point to the Rust application. | ||
/// | ||
/// It is called by the start-up code in `cortex-r-rt`. | ||
#[entry] | ||
fn main() -> ! { | ||
const STEPS: u32 = 100; | ||
const RADIANS_PER_STEP: f32 = (2.0 * core::f32::consts::PI) / 50.0; | ||
println!("Sine wave test (f32)..."); | ||
for row in 0u32..100u32 { | ||
let angle = (row as f32) * RADIANS_PER_STEP; | ||
let sine = libm::sinf(angle); | ||
let bar_len = ((sine + 1.0) * (MAX_LEN / 2.0)) as usize; | ||
println!("({:7.04}) {:.*}o", sine, bar_len, BAR); | ||
} | ||
|
||
println!("Sine wave test (f64)..."); | ||
for row in 0u32..100u32 { | ||
let angle = (row as f64) * f64::from(RADIANS_PER_STEP); | ||
let sine = libm::sin(angle); | ||
let bar_len = ((sine + 1.0) * (f64::from(MAX_LEN) / 2.0)) as usize; | ||
println!("({:7.04}) {:.*}o", sine, bar_len, BAR); | ||
} | ||
semihosting::process::exit(0); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ cortex-ar = { path = "../../cortex-ar", features = ["critical-section-single-cor | |
cortex-a-rt = { path = "../../cortex-a-rt" } | ||
cortex-r-rt = { path = "../../cortex-r-rt" } | ||
semihosting = { version = "0.1.18", features = ["stdio"] } | ||
libm = "0.2.15" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be optional? |
||
|
||
[build-dependencies] | ||
arm-targets = { version = "0.3.0", path = "../../arm-targets" } | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be optional as with
gic
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was thinking about that feature. For the examples I'm inclined to make the GIC crate mandatory and remove the feature. If you don't want to use the GIC, don't use it. I don't know it makes the examples better if they show how to make your interrupt controller optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was in the cortex-ar crate then yeah, totally should be optional.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I mean examples are not really held by SemVer anyways. I think easy running of examples triumphs 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But lets take that in another PR, I can help out with that small thing. :)