agra-uni-bremen / riscv-vp

RISC-V Virtual Prototype
MIT License
139 stars 49 forks source link

Request: debug_memory support of peripherals #9

Open U2654 opened 3 years ago

U2654 commented 3 years ago

It seems that only flash and ram is supported for reading in debug-mode. It would be great if memory on-chip peripherals (e.g. gpio) could be viewed, too. Currently, reading these leads to the following error.

hifive-vp: ...riscv-vp/vp/src/core/common/debug_memory.cpp:56: std::__cxx11::string DebugMemoryInterface::read_memory(uint64_t, unsigned int): Assertion `nbytes_read == nbytes && "not all bytes read"' failed.

Cirromulus commented 3 years ago

This is not that easy, because memory mapped peripherals are not directly accessible by the debugger. If they would access over memory, unwanted side-effects would change a perihperal's state. A dedicated debugging interface would be needed (which is part in an ongoing publication).

As a work-around, I would suggest returning zero on an unmapped memory location instead of failing away.

Cirromulus commented 3 years ago

Can you try this build if it is at least usable that way?

U2654 commented 3 years ago

It allows vscode/platformio to continue debugging after opening the peripherals view. No feature but at least no exit.