For tests like unit tests or integration tests, that need to run quickly on small sets of code, virtual platforms offer advantages over hardware, including:
- Speed - Virtual platforms have no overhead for flashing the application on physical hardware. This means that you can save time on small and fast unit tests.
- Scale - Virtual platforms can scale to run many tests in parallel. This makes virtual platforms more cost-effective than a farm of physical hardware.
- Maintenance – Unlike physical hardware, virtual platforms do not overheat, wear out from overuse, break from misuse, or use physical space and resources.
- Upgrades – You can change and reconfigure virtual platforms to match corresponding changes to the underlying hardware platform that is under development. These types of changes can be costly or impossible with physical hardware.
You can use both virtual platforms and hardware in your continuous integration regression test suite. Using both can provide an efficient software development workflow. Testing on virtual platforms is fast and accurate, but may not include specific components that are necessary for full system tests. Typically, there are a lower number of full system tests than small unit tests. This means that running system tests on hardware gives the benefits of a complete system performance check with fewer physical boards in the regression test suite.
Mbed OS is an open-source embedded operating system that provides a suite of tests to execute. These tests validate whether various parts of a platform, either hardware or virtual, work with the various Mbed OS capabilities. With the Mbed OS software base, you can quickly compare the results of virtual platforms and physical hardware as unit testing platforms.
Mbed OS is designed for Cortex-M microcontrollers and supports a wide range of Arm Cortex-M-based devices, including the Arm MPS2+ FPGA board. This FPGA can be programmed to use various Arm Cortex-M cores. Mbed OS also supports tests on the virtual platforms that represent the MPS2+ FPGA board, which are known as a Fixed Virtual Platforms (FVPs). Because unit tests often rely on only the core and memory of a processor, platforms with different peripherals can still be used to test the same code. This is another reason why virtual platforms are so powerful.
In the example in this guide, we test using an Arch Pro board and an MPS2+ FVP, both containing a Cortex-M3 core. The subset of unit tests that are used now require only the core and memory. This means that the MPS2+ FVP is suitable to run the same types of tests that are intended for the Arch Pro board. Using the free Mbed OS tools and a temporary license to Arm Compiler and the MPS2+ FVP, you can compare the test results of hardware compared to a virtual platform.