-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Problem Description
Simple RISC-V test binaries load successfully to the Sargantana core on the U280 FPGA but don't appear to execute correctly. Memory reads return all zeros instead of the expected test values.
Environment
- FPGA: Xilinx Alveo U280
- Core: Sargantana RISC-V core
- Toolchain: /opt/Xilinx/Vitis/2023.2/gnu/riscv/lin/riscv64-unknown-elf/bin/riscv64-unknown-elf-gcc
- FPGA Shell: BSC FPGA shell
- Driver: QDMA driver
Steps to Reproduce
-
Generate Bitstream
git clone https://github.com/bsc-loca/fpga-shell
cd fpga-shell
make u280
make initialize LOAD_EA=sargantana
make project
make bitstream -
Load Bitstream
./load-bitstream-onic.sh qdma -i /home/eirabor/fpga-shell/bitstream/system.bit -f ux -b 1
Result: Bitstream loads successfully, PCIe device enumerated correctly -
Create Test Binary
Simple RISC-V assembly program:
.section .text
.global _start
_start:
# Load test value 0x12345678 into register t0
lui t0, 0x12345
addi t0, t0, 0x678
# Write to memory address 0x100
li t1, 0x100
sw t0, 0(t1)
# Infinite loop
loop:
j loop
-
Build Binary
riscv64-unknown-elf-gcc -march=rv64gc -mabi=lp64d -nostdlib -nostartfiles -T linker.ld -o test_binary.elf test.S
riscv64-unknown-elf-objcopy -O binary test_binary.elf test_binary.bin
Result: Binary builds successfully (48 bytes) -
Load and Execute Binary
./load_binary.sh test_binary.bin
Result: Binary loads successfully via DMA -
Read Memory
dma-from-device -d /dev/qdma08000-MM-1 -s 4 -a 0x100 -f output.bin
hexdump -C output.bin
Problem: Returns 00 00 00 00 instead of expected 78 56 34 12
Expected Behavior
Memory at address 0x100 should contain the value 0x12345678 (little-endian: 78 56 34 12)
Actual Behavior
Memory reads return all zeros, suggesting either:
- The core is not executing the program
- There are memory addressing or mapping issues
- The core is stuck in reset or not running
Boot Script Details
The boot script performs:
- Reset core: dma-ctl qdma08000 reg write bar 2 0x0 0x0
- Load binary via DMA: dma-to-device -d /dev/qdma08000-MM-1 -s 48 -a 0x0 -f test_binary.bin
- Release reset: dma-ctl qdma08000 reg write bar 2 0x0 0x1
Boot Script Output
*** Sargantana Boot Script ***
Booting using test_binary.bin image file which is 48 bytes
*** Resetting core ***
qdma08000, 08:00.00, bar#2, reg 0x0, read back 0x0.
*** Uploading binary into main memory ***
dev /dev/qdma08000-MM-1, address 0x0, size 0x30, offset 0x0, count 1
size=48 Average BW = 1.340857 MB/sec
*** Releasing core's reset ***
qdma08000, 08:00.00, bar#2, reg 0x0, read back 0x1.
Binary Content
hexdump -C test_binary.bin
00000000 b7 42 34 12 93 82 82 67 37 03 00 00 93 82 03 10
00000010 23 20 53 00 6f 00 00 00 00 00 00 00 00 00 00 00
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Memory Map Notes
- Boot script comment: "Bootrom makes the core jump to address 0x8000_0000, which is translated to HBM address 0x0000_0000"
- Binary is loaded at HBM address 0x0
- Test writes to address 0x100 (should be accessible as HBM address 0x100)
- Is the core actually executing after reset is released?
- Are there any status registers to check the core execution state?
- Is the memory addressing correct (e.g., is 0x100 relative to the right base)?
- Are there specific requirements for the binary format or entry point?
Request for Help
Looking for guidance on:
- How to verify if the Sargantana core is actually running
- Correct memory addressing scheme
- Any missing steps in the boot/execution process