Running an emulator with Renode
Contents:
This blog is to try out emulating a board in renode. We’ll pick a sample board, go over the entire process of emulation end-to-end which includes peripherals and see how things work, exactly.
# Setup
I already explained the renode setup here at this blog, so you can follow that to reach the stage where I am right now.
# Runing renode
I am the following the documentation over here. So, let’s launch the terminal:
Now in there we can create an empty machine:
# Typed inside the monitor
You should see the <Timestamp> [INFO] System bus created. being logged in your terminal. This is the machine creating just the sysbus and it has no other peripherals, not even the CPU or memory. So, let’s get that first:
This loads the CPU and peripherals for stm32f4. You can verify that by running peripherals. It should have a bunch of stuff other than sysbus. We can inspect the memory:
Now we have to load the binary, this can be done via LoadELF:
The question is, what is this firmware? Well we’ll have to come up with something that can be run on an stm32f4.
To do this I am using this repo here. This is a sample project for educational purposes. I am also installing the GNU Arm embedded toolchain for this. Or if you’re confused like I am, just do this:
Once this is installed, you can do this and get the firmware:
Then in the renode CLI you need to do:
Not impressed? I agree, this makes for a shitty demo. I need to find a better firmware which is more chattier so we can talk over UART or something. The easiest to verify is:
And you can observe it do a bunch of stuff.