From 61642575ab6187c78fe5cd683cfde3a447543f75 Mon Sep 17 00:00:00 2001 From: Sebastian Holzapfel Date: Sat, 23 Sep 2023 11:41:39 +0200 Subject: [PATCH] works perfectly in debug mode?! --- firmware/build.sh | 4 ++-- firmware/litex-fw/src/log.rs | 10 +--------- firmware/litex-fw/src/main.rs | 1 + 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/firmware/build.sh b/firmware/build.sh index bf4acd4..f5e3670 100755 --- a/firmware/build.sh +++ b/firmware/build.sh @@ -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 diff --git a/firmware/litex-fw/src/log.rs b/firmware/litex-fw/src/log.rs index f546bac..33c64ed 100644 --- a/firmware/litex-fw/src/log.rs +++ b/firmware/litex-fw/src/log.rs @@ -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); } } } @@ -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); } } } diff --git a/firmware/litex-fw/src/main.rs b/firmware/litex-fw/src/main.rs index 51bf32a..b5d6eed 100644 --- a/firmware/litex-fw/src/main.rs +++ b/firmware/litex-fw/src/main.rs @@ -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]);