emulation: document how to edit Renode peripherals

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-04-25 14:42:28 +08:00
parent 2202736aad
commit c96c78e9ef

View file

@ -4,12 +4,25 @@ Platonic is an ideal system useful for developing an operating system. It does
## Usage
It is recommended to use Renode.
For emulation, you will need to install Renode. Then, run `renode` on `xous-release.resc`. For example:
## Debugging
```
renode emulation/xous-resc.repl
```
$bin=@../../Xous/kernel/target/riscv32i-unknown-none-elf/debug/xous-kernel; i @scripts/single-node/litex_vexriscv.resc; machine StartGdbServer 3333
## Editing Renode Peripherals
# qemu
Renode supports adding peripherals written in C#. For example, many Betrusted peripherals have models created under the `peripherals/` directory.
$(QEMU) -machine $(MACH) -cpu $(CPU) -smp $(CPUS) -m $(MEM) -nographic -serial mon:stdio -bios none -kernel $(OUT) -drive if=none,format=raw,file=$(DRIVE),id=foo -device virtio-blk-device,scsi=off,drive=foo
Since there is no external compiler, it can be difficult to know if your code is correct. In fact, if you're unfamiliar with C# or the Renode codebase, editing unfamiliar C# code can be a slow exercise in frustration.
Fortunately, Visual Studio Code is free and has excellent C# tooling. All you need to do is point it at your Renode installation, load the C# plugin, and open a `.cs` file.
1. Copy `peripherals.csproj.template` to `peripherals.csproj`
2. Open `peripherals.csproj` and point `<RenodePath>` to your Renode installation directory
3. Install [C# for VSCode](vscode:extension/ms-dotnettools.csharp)
4. You can refer to [core Renode peripherals](https://github.com/renode/renode-infrastructure/tree/master/src/Emulator/Peripherals/Peripherals) as examples of what C# code looks like.
## Debugging with GDB
When running Renode, you can attach a GDB instance. It runs on port 3333. Simply run `tar ext :3333` in gdb to attach.