一,关于使用whisper指令仿真器时开关的值(GPIO_SWs)读不进 switches_value变量的问题
1,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);
}
2,platformio.ini设置
; 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
; Redirecting...
[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
3,遇到的问题
当我按照教程手册,先把板子连接到pc上,然后把bits流下载到pc上,接着点击pio debug按钮。在点击单步跳过调试按钮中,switches_val的值一直显示为0,这与我在板子上设置了开关的值不符合(如图一)。我猜想原因是不是whisper是虚拟调试器,与连上板子无关?那么在点击pio debug按钮时c程序是否下载到板子中?如果想让switches_value与我在板子上设置的一致该怎么做呢?
图一