Skip to content

Commit a5eab45

Browse files
committed
add some comments to explain where the code is currently at
1 parent 5d3e0eb commit a5eab45

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

baremetal/src/main.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ use utralib::*;
1010
use xous_bio_bdma::*;
1111

1212
/// 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.
1613
///
1714
/// # Safety
1815
///
1916
/// This function is safe to call exactly once.
2017
#[export_name = "rust_entry"]
2118
pub unsafe extern "C" fn rust_entry() -> ! {
19+
// Initialize the timer, which is needed by the delay() function.
2220
let mut timer = CSR::new(utra::timer0::HW_TIMER0_BASE as *mut u32);
2321
const SYSTEM_CLOCK_FREQUENCY: u32 = 40_000_000;
2422
const SYSTEM_TICK_INTERVAL_MS: u32 = 1;
@@ -30,11 +28,17 @@ pub unsafe extern "C" fn rust_entry() -> ! {
3028
// enable the timer
3129
timer.wfo(utra::timer0::EN_EN, 0b1);
3230

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
3532
fifo_basic();
3633
// hello_world();
34+
3735
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.
3842
loop {
3943
crate::println!(
4044
"pc: {:04x} {:04x} {:04x} {:04x}",
@@ -60,6 +64,7 @@ mod panic_handler {
6064
}
6165
}
6266

67+
/// Delay function that delays a given number of milliseconds.
6368
pub fn delay(ms: usize) {
6469
let mut timer = CSR::new(utra::timer0::HW_TIMER0_BASE as *mut u32);
6570
timer.wfo(utra::timer0::EV_PENDING_ZERO, 1);
@@ -131,6 +136,15 @@ pub fn fifo_basic() -> usize {
131136
bio_ss.load_code(fifo_basic2_code(), 0, BioCore::Core2);
132137
bio_ss.load_code(fifo_basic3_code(), 0, BioCore::Core3);
133138

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+
134148
/*
135149
// expect no error
136150
match bio_ss.verify_code(&fifo_basic0_code(), 0, BioCore::Core0) {

0 commit comments

Comments
 (0)