一. 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);
}
- 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
- 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?