Skip to content

Add renode MCU emulation support (WIP) - #33975

Open
tridge wants to merge 10 commits into
ArduPilot:masterfrom
tridge:tools-renode
Open

Add renode MCU emulation support (WIP)#33975
tridge wants to merge 10 commits into
ArduPilot:masterfrom
tridge:tools-renode

Conversation

@tridge

@tridge tridge commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This adds support for "renode" (see https://renode.io/ ) for emulating STM32 MCUs, allowing unmodified ArduPilot for STM32/ChibiOS to be booted within a MCU emulator. This is evolving rapidly as I add new features, but roughly speaking at the moment it supports:

  • many H743 and F405 based flight controllers (I've tested MatekH743, CubeOrange and KakuteF4 for example)
  • basic sensor support
  • persistent microsd, ramtron and flash storage emulation
  • gdb of the running image
  • uses unmodified ArduPilot firmware, so you can point it at an old release of ArduPilot and run it on a virtual MCU

Speed is roughly equal to realtime on my (quite fast) laptop.
We're using a modified version of renode which I have put here:
https://github.com/ArduPilot/renode/tree/pr-arudpilot-am32-perf
it also needs .NET 10 (you can apt-get install on recent linux). I have the following installed on ubuntu 26.04:

tridge@blu4:/data/APM.3(tools-renode)$ dpkg -l|grep dotn
ii  dotnet-apphost-pack-10.0                        10.0.10-0ubuntu1~26.04.1                     amd64        Internal - targeting pack for Microsoft.NETCore.App 10.0
ii  dotnet-host-10.0                                10.0.10-0ubuntu1~26.04.1                     amd64        .NET host command line
ii  dotnet-hostfxr-10.0                             10.0.10-0ubuntu1~26.04.1                     amd64        .NET host resolver
ii  dotnet-runtime-10.0                             10.0.10-0ubuntu1~26.04.1                     amd64        .NET runtime
ii  dotnet-sdk-10.0                                 10.0.110-0ubuntu1~26.04.1                    amd64        .NET 10.0 Software Development Kit
ii  dotnet-sdk-aot-10.0                             10.0.110-0ubuntu1~26.04.1                    amd64        .NET platform NativeAOT components.
ii  dotnet-targeting-pack-10.0                      10.0.10-0ubuntu1~26.04.1                     amd64        Internal - targeting pack for Microsoft.NETCore.App 10.0
ii  dotnet-templates-10.0                           10.0.110-0ubuntu1~26.04.1                    amd64        .NET 10.0 templates

There is a lot more to do and many things are emulated in a very minimal form, just enough to get us booting, but it has already reproduced and fixed its first bug, see #33933

tridge added 10 commits August 8, 2026 16:34
Run unmodified STM32F405 and STM32H743 ChibiOS firmware under Renode.
Generate board overlays and launch scripts at invocation time from the
application and bootloader hwdefs instead of maintaining board copies.

Add shared MCU platforms, peripheral models, persistent media, real-time
pacing, and a deterministic H743 BLHeli/Shared_DMA reproduction.
Generate IOMCU, SPI chip-select routing, and required sensor models from the
compiled hwdef data. Preserve RAMTRON writes at real chip-select transaction
boundaries so parameters survive firmware resets and Renode restarts.
Deliver host bytes over virtual time so H7 UART DMA can rearm between bounce
buffers, and synthesize IDLE only after a real input gap. Preserve the last
valid baud rate while the UART resets so queued MAVProxy traffic cannot abort
Renode during reboot.
Bridge generated CAN controllers to ArduPilot multicast buses and connect H7
Ethernet controllers to a host TAP. Add the sensor and controller behavior
needed to run Pixhawk6X firmware with those interfaces enabled.
Extend generated platform support across additional STM32F4, STM32F7, and
STM32H7 flight controllers. Add the IMU, barometer, SDMMC, USB, and IOMCU
models required by their production hwdefs.
Correct H7 Ethernet receive descriptor handling and complete the generated
SPI and ICM42688 behavior needed for reliable Pixhawk6X startup and operation.
Expose ChibiOS threads and saved contexts through a GDB remote proxy. Support
bounded Renode reverse execution, reconnect the proxy after snapshot restore,
and keep affected peripherals snapshot-safe.

Reduce reverse snapshot storage while keeping normal debugging responsive by
forwarding interrupts during execution and batching thread registry reads.
Select AP_Periph firmware automatically and derive simulated GPS, airspeed,
battery, and serial rangefinder devices from hwdef feature definitions. Route
generated CAN interfaces to consecutive multicast buses by default.

Add platform support for compatible STM32F1, STM32F3, STM32F4, STM32F7,
STM32G4, STM32H7, and STM32L4 targets, covering all STM32 AP_Periph builds.
Report occupied proxy ports without a Python traceback and wait for the proxy
to become ready before starting Renode or launching GDB.
Back the full internal MCU flash using BOARD_FLASH_SIZE so linker layout
changes do not invalidate persistent state. Overlay the selected firmware's
file-backed bytes without clearing crash data.

Import legacy storage and crash-log images once at their physical addresses
and retain the old files as backups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant