TL;DR: We need an MBed simulator of RTOS features that can run on the x86 platform on a desktop operating system. We are asking whether there are any existing solutions and if there’s an interest in an open-source version should we write one ourselves.
Context
On MIT Rocket Team, we’ve just started using MBed OS and we love it! Especially, we like how unlike most other embedded solutions, it is using idiomatic C++ features (operator overloading etc.) and great separation of concerns, which make the code more clear and readable.
One of our main requirements is extensive testing: from unit-testing to testing on hardware. Hence, we need to be able to compile the code in the following configurations:
- Unit testing: compiled for a desktop OS. Each unit test is its own target, and it consists of the cpp file under test, as well as stubs. This was partially inspired by this guide, and partially emerged as a replacement for our more complicated dependency injection patterns when previously compiling all unit tests into the same target and only using GoogleMocks (and not stubs)
- Hardware-out-of-the-Loop (HOOTL) testing: compiled for a desktop OS. Here, we would compile most of our code (excluding the HAL and device drivers) into a single target, and run it in a simulated environment. This is the target that will require an implementation of RTOS features for desktop environments, which is what this post is about.
- Hardware-in-the-Loop (HITL) driver testing: compiled for ARM targets. We will create a target for each device driver so that we can test the driver on the target hardware.
- Production firmware target: compiled for ARM targets. This is the actual firmware for our flight computer that we are developing.
We are using the CMake build system, which lets us use different compilers (one for 1 and 2, and one for 3 and 4). For 3 and 4, we are using mbed-cmake - (check out this forum post), which lets us create separate hardware targets for our different HITL tests and the main target.
RTOS Simulator
Number 2 is where we are currently stuck. We want to be able to simulate running on the actual targets, using all RTOS features: Threads, Queues, Mutexes, etc., but without a particular need for any hardware interaction features. That’s because we will abstract out the whole Hardware Abstraction Layer, and replace it with a simulated implementation, removing the dependency on hardware functions, and simplifying feeding fake data into our code.
The closest to what we need would be the MBed simulator, although it seems to be the opposite of what we need - with support for simulated hardware but no RTOS features. We would be open to running our code on a more fully-fledged simulation, and simply not use the hardware features, but that might make it harder for us to compile in the stubbed HAL that we can feed with fake data.
If such an implementation of MBed RTOS components does not exist yet, we will create one for ourselves. Then the question becomes whether there is interest (either from MBed staff, or the open-source community) to help maintain that. If we limit ourselves to the RTOS features, that shouldn’t be too big of an implementation.
Please, let me know your thoughts!