When running a C program for the e310 SiFive board the RISCV register values never appear to change. I’m trying to call a simple assembly function from C, so I need to be able to track the effect the instructions are having on the register values as I step through the code. I’m also new to Platformio, so perhaps I’m missing some configuration to achieve the desired emulation behavior. I’ve tried the Dissassembly mode “switch to assembly” and when stepping through the C code the register values are simply not updating for the debugging emulation session.
Am I missing something here to enable this use case?
[platformio]
description = A simple "Hello, World!" example to demonstrate printf and build environment.
[env:e310-emulation]
platform = sifive
framework = freedom-e-sdk
board = e310-arty
debug_tool = qemu
hello.c
#include <stdio.h>
int main() {
printf("Hello, World!\n");
}
Something as simple as the code above will fail to update registers even when stepping through the assembly that is generated from the Disassembly option.
I see the same thing. Register values are showing up as 0 under “REGISTERS” on the left side.
However, accessing the registers from the gdb console works (info registers, p $ra, etc).
It also works to add them as watch expressions (using $ra etc).
The list of registers are from toolchain or SVD file. These register names point to some memory address. So, does QEMU support this emulation? I’m not so expert here. @valeros please comment.