@@ -10,15 +10,13 @@ use utralib::*;
10
10
use xous_bio_bdma:: * ;
11
11
12
12
/// Entrypoint
13
- /// This makes the program self-sufficient by setting up memory page assignment
14
- /// and copying the arguments to RAM.
15
- /// Assume the bootloader has already set up the stack to point to the end of RAM.
16
13
///
17
14
/// # Safety
18
15
///
19
16
/// This function is safe to call exactly once.
20
17
#[ export_name = "rust_entry" ]
21
18
pub unsafe extern "C" fn rust_entry ( ) -> ! {
19
+ // Initialize the timer, which is needed by the delay() function.
22
20
let mut timer = CSR :: new ( utra:: timer0:: HW_TIMER0_BASE as * mut u32 ) ;
23
21
const SYSTEM_CLOCK_FREQUENCY : u32 = 40_000_000 ;
24
22
const SYSTEM_TICK_INTERVAL_MS : u32 = 1 ;
@@ -30,11 +28,17 @@ pub unsafe extern "C" fn rust_entry() -> ! {
30
28
// enable the timer
31
29
timer. wfo ( utra:: timer0:: EN_EN , 0b1 ) ;
32
30
33
- let mut count = 0 ;
34
- let mut rgb = CSR :: new ( utra:: rgb:: HW_RGB_BASE as * mut u32 ) ;
31
+ // select a BIO test to run
35
32
fifo_basic ( ) ;
36
33
// hello_world();
34
+
37
35
let bio_ss = BioSharedState :: new ( ) ;
36
+ // The green LEDs flash whenever the FPGA is configured with the Arty BIO design.
37
+ // The RGB LEDs flash when the CPU is running this code.
38
+ let mut count = 0 ;
39
+ let mut rgb = CSR :: new ( utra:: rgb:: HW_RGB_BASE as * mut u32 ) ;
40
+ // provide some feedback on the run state of the BIO by peeking at the program counter
41
+ // value, and provide feedback on the CPU operation by flashing the RGB LEDs.
38
42
loop {
39
43
crate :: println!(
40
44
"pc: {:04x} {:04x} {:04x} {:04x}" ,
@@ -60,6 +64,7 @@ mod panic_handler {
60
64
}
61
65
}
62
66
67
+ /// Delay function that delays a given number of milliseconds.
63
68
pub fn delay ( ms : usize ) {
64
69
let mut timer = CSR :: new ( utra:: timer0:: HW_TIMER0_BASE as * mut u32 ) ;
65
70
timer. wfo ( utra:: timer0:: EV_PENDING_ZERO , 1 ) ;
@@ -131,6 +136,15 @@ pub fn fifo_basic() -> usize {
131
136
bio_ss. load_code ( fifo_basic2_code ( ) , 0 , BioCore :: Core2 ) ;
132
137
bio_ss. load_code ( fifo_basic3_code ( ) , 0 , BioCore :: Core3 ) ;
133
138
139
+ // The code readback is broken on the Arty BIO target due to a pipeline stage
140
+ // in the code readback path that causes the previous read's data to show up
141
+ // on the current read access. On the NTO-BIO (full chip version), the BIO runs
142
+ // at a much higher speed than the bus framework and thus the data is returned
143
+ // on time for the read. However in the FPGA for simplicity the BIO is geared
144
+ // at 2:1 BIO speed to CPU core speed, and the bus fabric runs at a single speed
145
+ // with no CDCs and also a fully OSS AXI to AHB bridge that I think could also
146
+ // be contributing to this bug.
147
+
134
148
/*
135
149
// expect no error
136
150
match bio_ss.verify_code(&fifo_basic0_code(), 0, BioCore::Core0) {
0 commit comments