Get started with Keil MDK Code Coverage
Introduction
What is Code Coverage?
Set up Code Coverage
Next Steps
Get started with Keil MDK Code Coverage
Who is this for?
This is an introductory topic for embedded software developers new to the code-coverage feature in Keil MDK.
What will you learn?
Upon completion of this Learning Path, you will be able to:
- Set up project execution on FVP
- Understand basics of the Code Coverage report
Prerequisites
Before starting, you will need the following:
- Basic familiarity with Keil MDK
Summary
This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You’ll enable and use Keil MDK code coverage on a Cortex-M Fixed Virtual Platform (FVP). First, you’ll import and build the CMSIS-RTOS2 Blinky example for the
ARMCM3 device using Pack Installer. Then, you’ll configure μVision debug to execute the application on the supplied Cortex-M FVP. After running the program, you’ll review the coverage results to see which lines and branches executed and identify untested paths, such as incomplete switch cases. You’ll focus on running with FVPs and learn how to interpret the basic code coverage report and decide what tests to add next.Frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Choose ARM > ARM Cortex M3 > ARMCM3, then on the Examples tab copy the CMSIS-RTOS2 Blinky (uVision Simulator) example. Open the copied project in MDK and build it.
Build the project and check that it completes without errors and produces an image. Ensure it runs on the selected target without immediate faults.
In the project’s debug settings, select the supplied Cortex-M FVP as the execution target. This Learning Path uses FVPs instead of real hardware.
Look for highlighted executed and unexecuted lines or branches. Verify that intended paths, such as all cases in a C switch statement, were exercised.
Yes, MDK supports code coverage on real hardware using instruction trace (ETM trace). You’ll use FVPs in this Learning Path. If you’re configuring hardware trace, follow MDK guidance.