You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ This is a simple and readable **RISC-V RV32IMAC emulator** written in pure Pytho
14
14
-**Supports memory-mapped IO** and provides a **UART peripheral** using a pseudo-terminal, and a **memory-mapped block device** backed by an image file
15
15
-**Passes all `rv32ui`, `rv32mi`, `rv32um`, `rv32ua`, and `rv32uc` unit tests** provided by [RISC-V International](https://github.com/riscv-software-src/riscv-tests)
16
16
-**Supports logging** of register values, function calls, system calls, traps, invalid memory accesses, and violations of invariants
17
+
-**GDB remote debugging support** via GDB Remote Serial Protocol (RSP) with breakpoints, single-stepping, register/memory inspection
17
18
- Runs [MicroPython](https://micropython.org/), [CircuitPython](https://circuitpython.org/) with emulated peripherals, and [FreeRTOS](https://www.freertos.org/) with preemptive multitasking
19
+
-**Browser-based emulation** via [Pyodide](https://pyodide.org/), try it [here](https://ccattuto.github.io/riscv-python/)
18
20
- Self-contained, modular, extensible codebase. Provides a **Python API** enabling users to control execution, inspect state, and script complex tests directly in Python.
├── gdbstub.py # GDB Remote Serial Protocol implementation
40
43
├── Makefile # Builds ELF/binary targets
41
44
├── start_bare.S # Minimal startup code
42
45
├── start_newlib.S # Startup code for Newlib-nano
@@ -90,6 +93,9 @@ pip install -r requirements.txt
90
93
|`--raw-tty`| Enable raw terminal mode |
91
94
|`--no-color`| Remove ANSI colors in debugging output |
92
95
|`--log LOG_FILE`| Log debug information to file `LOG_FILE`|
96
+
|`--gdb`| Enable GDB remote debugging (integrates with all other features) |
97
+
|`--gdb-port PORT`| GDB server port (default: 1234) |
98
+
|`--gdb-host HOST`| GDB server host (default: localhost) |
93
99
|`--help`| Show usage help and available options |
94
100
95
101
### Compiling Examples
@@ -236,7 +242,23 @@ Example Python programs using programmatic access to the emulator are provided i
236
242
PYTHONPATH=. python tests/test_api_simple.py
237
243
```
238
244
239
-
## 🌐 Running Programs in the Browser
245
+
### 🐛 GDB Remote Debugging
246
+
247
+
The emulator includes GDB remote debugging support. Add the `--gdb` flag to enable it:
248
+
249
+
```bash
250
+
./riscv-emu.py --gdb prebuilt/test_bare1.elf
251
+
```
252
+
253
+
Then connect with GDB, e.g.:
254
+
```bash
255
+
riscv64-unknown-elf-gdb prebuilt/test_bare1.elf
256
+
(gdb) target remote localhost:1234
257
+
```
258
+
259
+
All standard GDB commands work (breakpoints, stepping, register/memory inspection). CSRs can be accessed via monitor commands: `monitor csr mstatus`, `monitor csr mtvec 0x1000`.
260
+
261
+
### 🌐 Running Programs in the Browser
240
262
241
263
The emulator can run in a web browser thanks to [Pyodide](https://pyodide.org/). See `advanced/webapp/`.
0 commit comments