CMRX supports microcontrollers unsuitable for running “large” systems, such as Linux. In general, 32-bit low-power CPUs which are resource constrained and don’t support memory mapping. List of supported hardware is available in documentation.
Many (actually most modern) 32-bit microcontrollers support different way of limiting unwanted memory accesses. While it is not able to map virtual addresses to physical, it allows granting/rejecting certain kinds of access (read / write / execute) to certain regions of memory. In ARM-based microcontrollers, this subsystem is called Memory Protection Unit, in RISC-V it is called Physical Memory Protection. Some other architectures support similar subsystems. CMRX is configuring this subsystem to only allow application threads to access application own memory.
All three are using MPU to perform hardware-enforced isolation. The main difference between CMRX and remaining two is that CMRX environment was designed so that this becomes fully automatic. You as a devloper don’t have to think of memory protection configuration while writing your application. In both Zephyr and FreeRTOS, you need to perform manual configuration in order to enable isolation.
CMRX determines all the memory needs and memory protection settings at compile-time and builds static configuration. All that is then done at runtime is application of this precomputed configuration, which is quite fast. Benchmarks show that CMRX performance is well within performance of popular open-source RTOS systems while they are not using memory protection. If memory protection is enabled in Zephyr, it becomes substantially slower than CMRX running on same hardware.
CMRX doesn’t perform dynamic MPU updates similar to page fault-based MMU updates Linux does. MPU configuration is computed once, at compile time and is valid for whole process lifetime. It cannot be changed, thus it is not necessary to dynamically update it. MPU configuration is ever only changed when process owning currently running thread changes, which is deterministic. This is fundamentally similar to what FreeRTOS MPU does. MPU configuration doesn’t introduce any non-deterministic latency, thus CMRX is capable of hard real-time execution even with full memory protection enabled.
No. It is not fully compatible while it provides some very POSIX-like support for threads and mutexes. The environment CMRX targets - hard embedded devices is so different from environment ordinary POSIX systems run it, we don’t see that much value in full POSIX compliance. Actually some POSIX features are outright unsuitable for hard real-time systems.
On typical Cortex-M4 system with FPU present, kernel footprint is about 7kB of FLASH with all features and optimizations enabled. RAM consumption depends on compile-time configuration (e.g. how many entries each object pool is configured to store). Typical kernel RAM consumption varies between 1 - 2 kB of RAM.
No, CMRX is designed to work with vendor or 3rd party HALs. This decision was made to enable reuse of large pool of vendor drivers that already exist. The only requirement CMRX has on HAL used is that it must provide CMSIS headers for CPU used in the microcontroller. Major vendor HALs usually ship CMSIS headers.
No, CMRX does not require TrustZone presence. TrustZone is feature exclusively present in some ARMv8M-based microcontrollers, such as those based on Cortex-M33 core. Principally, TrustZone serves the purpose of isolating secure and unsecure portions of firmware, such as cryptographich infrastructure or secure bootloader from the rest of the system. While CMRX is TrustZone-aware, it uses Memory Protection Unit. MPUs are present in some ARMv6M, most of ARMv7M microcontrollers and all ARMv8M microcontrollers. Different platforms carry similar peripheral, so CMRX can theoretically run there too.
No. Stack limit registers prevent stack pointer from roaming outside pre-determined range but set no rules on how stack can be used. With stack limit registers set to cover whole thread / task stack it is still perfectly possible to overflow one stack-resident buffer, modify value of return address stored also on stack and divert code execution to code deployed into buffer just overflown (a common vector to realize remote code execution attack). CMRX isn’t using stack limit registers on ARMv8M and relies on MPU to provide security guarantees. In CMRX, stack limit is enforced by MPU. MPU also enforces that contents of stack cannot be executed. So even if return address gets corrupted an attempt to execute stack content will yield MemUsageFault.