Skip to content

Commit

Permalink
works perfectly in debug mode?!
Browse files Browse the repository at this point in the history
  • Loading branch information
vk2seb committed Sep 23, 2023
1 parent 50d74e1 commit 6164257
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions firmware/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ svd2rust -i $BUILD_DIR/csr.svd --target riscv

# Build the firmware .elf file
cd $FW_ROOT/litex-fw
cargo build --target=riscv32imac-unknown-none-elf --release
cargo build --target=riscv32imac-unknown-none-elf

# Copy it into a binary that litex_term can upload.
${OBJCOPY} target/riscv32imac-unknown-none-elf/release/litex-fw -O binary $BUILD_DIR/rust-fw.bin
${OBJCOPY} target/riscv32imac-unknown-none-elf/debug/litex-fw -O binary $BUILD_DIR/rust-fw.bin
10 changes: 1 addition & 9 deletions firmware/litex-fw/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,13 @@ fn default_handler() {
let offset = peripherals.DMA_WRITER0.offset.read().bits();
//info!("dmaw0 {:x} {:x}", pending_type, offset);
unsafe {
asm!(
"fence iorw, iorw",
);
asm!("fence iorw, iorw");
}

if offset == 0x10 {
for i in 0..0x10 {
unsafe {
BUF_IN_CP[i] = BUF_IN[i];
fence(Ordering::Release);
BUF_IN_CP[i] = BUF_IN[i];
fence(Ordering::Release);
}
}
}
Expand All @@ -74,9 +69,6 @@ fn default_handler() {
for i in 0x10..0x20 {
unsafe {
BUF_IN_CP[i] = BUF_IN[i];
fence(Ordering::Release);
BUF_IN_CP[i] = BUF_IN[i];
fence(Ordering::Release);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions firmware/litex-fw/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn main() -> ! {
loop {
log::info!("READ");
unsafe {
asm!("fence iorw, iorw");
for i in 0..BUF_SZ_WORDS {
log::info!("{:x}@{:x}", i, BUF_IN_CP[i]);

Expand Down

0 comments on commit 6164257

Please sign in to comment.