2022-10-25 10:11 AM
Has anyone here worked with Renode? An emulator remotely similar to QEMU, but more geared towards MCUs, esp. w.r.t. emulating peripherals.
https://antmicro.com/platforms/renode/
Renode does not seem to have a forum, only the github issues for their project, which is, well, for genuine issues, I guess, and also there seems to be not much going on.
They do have a model file for STM32L071 and base the L072 one off of that, with some little addition.
Some of the L072's USARTS are missing, and related NVIC channels, too.
I removed the original only 2 usart definitions and pasted, from another model, the 1..6 usarts, removed the not present 3 and 6, and went through the manual to fix some of the different interrupt channels - not sure correctly, as some of the definitions in other files use something like "nvic@10", others "nvicInput14@1", I haven't seen yet what that difference means (see excerpt far below. And the other definitions also use "STM32F7_USART" in smaller stm32 models)
I simplified the firmware I originally wanted to test with Renode by a lot, and now I get it to kinda start running, but their Monitor window outputs this a lot:
sysbus: Read from an unimplemented register Flash:ACR (0x40022000), returning a value from SVD: 0x0.
... and I see my program is stuck in a loop waiting for that register content to change - in SystemClock_Config(), which is so essential that I wonder how they (the Renode people) got any of the "hello world" programs built with CubeIDE & default settings to run on any of those MCUs at all... (one of their guys did say in someone elses issue on github that CubeIDE's default stuff tends to work well, which is why I specifically mention it)
I have alas not found any of the existing stm32 models in Renode which have that register implemented, to use as an example.
Does anyone here know how one can add the register?
Can this be done in the .repl file, or do I need to implement some new C# module for it? (not yet seen how that works)
My change to the stm32l071.repl file:
usart1: UART.STM32F7_USART @ sysbus 0x40013800
frequency: 200000000
-> nvic@27
usart2: UART.STM32F7_USART @ sysbus 0x40004400
frequency: 200000000
-> nvic@28
usart4: UART.STM32F7_USART @ sysbus 0x40004C00
frequency: 200000000
-> nvicInput14@0
usart5: UART.STM32F7_USART @ sysbus 0x40005000
frequency: 200000000
-> nvicInput14@1
iwdg: Timers.STM32F4_IndependentWatchdog @ sysbus 0x40003000
frequency: 32000
nvicInput10: Miscellaneous.CombinedInput @ none
numberOfInputs: 2
-> nvic@10
nvicInput11: Miscellaneous.CombinedInput @ none
numberOfInputs: 4
-> nvic@11
nvicInput14: Miscellaneous.CombinedInput @ none
numberOfInputs: 2
-> nvic@14
nvicInput29: Miscellaneous.CombinedInput @ none
numberOfInputs: 4
-> nvic@29