Skip to content
Snippets Groups Projects
Commit ec91bf76 authored by Isak Forsgren's avatar Isak Forsgren
Browse files

peer rewiev issues resolved

parent 7d3c9df4
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ looks like the code executes 10000 asm::nop();
so diff/10000
1150151/100000 =
1150151/10000 =
115.0151 per iteration
```
......@@ -371,7 +371,7 @@ Paste your program output for a release build:
2023-11-11 16:53:32.005602369 +01:00:00 :Cacheen status: false
2023-11-11 16:53:32.005604623 +01:00:00 :Cacheen status: true
2023-11-11 16:53:32.005606236 +01:00:00 :start timed_loop
2023-11-11 16:53:32.005607468 +01:00:00 :start 13019, end 923173, diff 910154
2023-11-11 16:53:32.005607468 +01:00:00 :start 2027345902, end 2027385903, diff 40001
2023-11-11 16:53:32.005608851 +01:00:00 :idle
```
......@@ -383,7 +383,7 @@ Now compare the measured cycle count, to the best case estimation (B5 above), wh
[Your answer here]
```
my best case estimate 30000 + 10000p fits with this if p is on the lower end at 1 cycle.
my best case estimate (relase build) 30000 + 10000p fits with this if p is on the lower end at 1 cycle.
```
Now, with a bit of luck the loop fits perfectly in the cache and you should not have any wait states triggered. However, the cache and pipeline fill is not very advanced/smart, so it depends largely on the address alignment. Try "moving" the loop by un-commenting one of the `asm::nop()` instructions. Re-run your application to see if the cycle count changed. Iterate, this (un-comment another) and try to find the "best" and "worst" case (lowest/highest number of cycles).
......
......@@ -77,13 +77,13 @@ fn timed_loop() -> (u32, u32) {
asm::nop(); // 4 nop, [40001]
asm::nop(); // 5 nop, [40001]
asm::nop(); // 6 nop, [40001]
asm::nop(); // 7 nop, [40001]
asm::nop(); // 8 nop, [40001]
//asm::nop(); // 6 nop, [40001]
//asm::nop(); // 7 nop, [40001]
//asm::nop(); // 8 nop, [40001]
asm::nop(); // 9 nop, [40001]
asm::nop(); //10 nop, [69998]
asm::nop(); //11 nop, [69998]
//asm::nop(); // 9 nop, [40001]
//asm::nop(); //10 nop, [69998]
//asm::nop(); //11 nop, [69998]
//asm::nop(); //12 nop, [40001]
//asm::nop(); //13 nop, [40001]
......
......@@ -111,12 +111,44 @@ Paste the implementation here
[Your answer here]
```rust
//! src/main.rs
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate panic_halt;
use nrf52840_hal as _;
// use panic_rtt_target as _;
use panic_halt as _; // You need to enable `panic-halt` in the Cargo.toml file
#[rtic::app(device = nrf52840_hal::pac)]
mod app {
use rtt_target::{rprintln, rtt_init_print};
#[shared]
struct Shared {}
#[local]
struct Local {}
#[init]
fn init(_cx: init::Context) -> (Shared, Local, init::Monotonics) {
rtt_init_print!();
rprintln!("init");
(Shared {}, Local {}, init::Monotonics())
}
#[idle]
fn idle(_cx: idle::Context) -> ! {
rprintln!("idle");
panic!("my custom panic message");
fn main() {
panic!("argument is ignored");
#[allow(unreachable_code)]
loop {}
}
}
```
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment