PlatformIO Community

Hurry! About the problem that the value of the switch cannot be read when using the whisper command simulator

一. Regarding the problem that the switch value (GPIO_SWs) cannot be read into the switches_value variable when using the whisper command emulator.
Source code:

#define GPIO_SWs 0x80001400
#define GPIO_LEDs 0x80001404
#define GPIO_INOUT 0x80001408

#define READ_GPIO(dir) (*(volatile unsigned)dir)
#define WRITE_GPIO(dir, value) { (volatile unsigned *)dir) = (value); }

int main ( void )
{

int En_Value=0xFFFF, switches_value;

WRITE_GPIO(GPIO_INOUT, En_Value);

while (1) { 
    switches_value = READ_GPIO(GPIO_SWs);
    switches_value = switches_value >> 16;
    WRITE_GPIO(GPIO_LEDs, switches_value);
}

return(0);

}
  1. Platformio.ini settings
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[env:swervolf_nexys]
platform = chipsalliance
board = swervolf_nexys
framework = wd-riscv-sdk

monitor_speed = 115200

debug_tool = whisper
debug_build_flags = -O0 -ggdb3 -g3

board_build.bitstream_file = /home/minyang/RVfpga/src/rvfpga.bit

board_debug.verilator.binary = /home/minyang/RVfpga/verilatorSIM/Vrvfpgasim
  1. Problems encountered
    When I follow the tutorial manual, first connect the board to the pc, then download the bits stream to the pc, and then click the pio debug button. When I click the single-step skip debugging button, the value of switches_val is always displayed as 0, which is not consistent with the value of the switch I set on the board (Figure 1). I guess the reason is that whisper is a virtual debugger and has nothing to do with connecting to the board? Then when the pio debug button is clicked, is the c program downloaded to the board? What should I do if I want the switches_value to be the same as the one I set on the board?
    图片

According to the descriptions of the debuggers / simulators in RVfpga: Digilent Nexys A7 — PlatformIO 5.2.0a5 documentation that seems to be the case. However, also per linked documentation, the board has a on-board JTAG-HS1 debugger that should be able to display live values from the real device.

If this is not working, please file an issue in GitHub - platformio/platform-chipsalliance: CHIPS Alliance: development platform for PlatformIO.

Hi @my2752736153 ! Whisper is an instruction set simulator, it’s used for verification purposes, but it also can be used for running applications without RISC-V hardware at hand. It means that the Whisper simulator doesn’t interact with your board in any way.

If you want to use the real on-board debug probe, then simply remove or comment the debug_tool = whisper line in your platformio.ini file and start a new debug session.