Emulate arduino portenta H7

Hi, is it possible to emulate an arduino portenta H7?
Does anyone have experience with this?

I use platformio for development but I can switch to something else as well se serve.
Thank you all for your attention!

If there is one piece of software that I think would be capable of emulating this Arduino board, it would be Renode: https://renode.readthedocs.io/en/latest/introduction/supported-boards.html

After all, they support multiple STM32 boards and the Arduino Nano 33 BLE, along with other boards.

The Portenta H7 features a STM32H747XI microcontroller. Sadly, Renode doesn’t have that exactly, but it does have a stm32h743.

I tried feeding in a “print hello world” Arduino sketch (board = portenta_h7_m7, framework = arduino) into Renode, but I didn’t have any luck with the firmware booting fully up: It seems to try to start the RTX5 real-time-operating-system in mbed_rtos_start, from which it goes into the supervisor call handler (SVC_Handler), but it never runs any registered threads, like mbed_start, which would at some point call into the Arduino core’s main() function, and then setup(), etc.

I see PRs open like https://github.com/renode/renode/pull/650 which might fix that though, haven’t tested it.

So unless there is some other great emulator for STM32 boards that is not Renode, I don’t think there is a current emulator for that board. Of course, there are general CPU emulators (qemu) and ARM fast models for the ARM Cortex-M7, but that is still a long shot away from being able to boot up a firmware written for a STM32H747XI, because all STM32 peripherals must be emulated too. Which is exactly what Renode tries to do.

This is the closest I could I get: PlatformIO connecting to the GDB debug server opened by Renode.

stays in SVC_Handler forever and gets ocassionally interrupted by the low-power timer interrupts

Of course, another thought would be to also compile your firmware for a board that Renode can emulate. A simpler / more supported one, like the Arduino Nano 33 BLE, or a simple Bluepill (STM32F103). But if you use Portenta specific libraries that have no equivalent, that won’t work either.

renode_gdb.resc
using sysbus

$bootelf=$ORIGIN/portentah7_bootloader_mbed_fs.elf

mach create "Portenta H7"
machine LoadPlatformDescription @platforms/cpus/stm32h743.repl

showAnalyzer sysbus.usart1
showAnalyzer sysbus.lpuart1

sysbus LoadELF $bootelf

machine StartGdbServer 3333