From c96c78e9efe761feddb3c28c90084cecc6dd82aa Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sun, 25 Apr 2021 14:42:28 +0800 Subject: [PATCH] emulation: document how to edit Renode peripherals Signed-off-by: Sean Cross --- emulation/README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/emulation/README.md b/emulation/README.md index 8738fd779..2bd50ae5e 100644 --- a/emulation/README.md +++ b/emulation/README.md @@ -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 `` 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.