I have a client that would like to build virtual versions of their integrated hardware. Ie its C code uploaded to a microcontroller of various types. I think one is atmega-like and the other is a via cortex m3 or so. Has anyone ever looked into building this firmware in a way it can be run on a desktop so you can run tests against it?
If it were say python, I’d spin up a linux vm and install some things and bada bing bada boom. But firmware? tricky. The end goal is to have a sort of contained box that we can communicate with over a virtual serial port (so even if it can be turned into some kind of binary, that binary would probably get chucked on its own vm and they’d all talk together via virtual serial ports)
Yes I’ve done a bit of this. The thing to remember is its just another c
compiler target… so u can use makefile voodoo and #ifdef s to compile the
same code for dire rent platforms. Ardupilot does this, and calls it a
“sitl” build ( software in the loop ).
Ahhh thats super interesting. A great place to start googling at least.
Yeah, we have real hardware to test on for that stuff. This is mainly around ‘if the communicating peripherals are on magical perfect hardware, does everyone talk nicely’ ie, its kind of half about testing the code that it works ideally, and half that it integrates with the rest of the (crazy convoluted) software stack.
and here’s a link to the core part/s of the “desktop” build for
ArduPlane/Copter… ( “Desktop build” is another name for SITL)
( the reason I linked to the old 2.8.1 branch, is because they added a
Hardware Abstraction Layer (HAL) in later versions that is both way more
awesome, and totally useless to your needs here at this time, as its very
specific to what they do )