Skip to main content
SBhon.1
Associate II
October 21, 2022
Question

How do we check code coverage on STM32?

  • October 21, 2022
  • 5 replies
  • 5042 views

I am using STM32L4 for my application and I want to do code coverage on my controller to see how it performs. How can I do that? Is there any tool or is there any in-built feature in STM32CubeIDE which I can use?

This topic has been closed for replies.

5 replies

Pavel A.
Super User
October 21, 2022

IAR EWARM has good instrumentation for coverage.

SBhon.1
SBhon.1Author
Associate II
October 22, 2022

Yes. But I am running linux so only STM32CubeIDE is working for me. IAR, Keil dont have support for linux. So is there any option?

GLASS
Visitor II
October 22, 2022

If board is equiped wih a large package, maybe ETM can be accessible through debug/trace connector. In this case Ozone debugger from Segger with j-trace probe are very good. Not affordable for hobbyst but helpfull for professional targeting good quality software.

With it you can code coverage in real time! A must have​. Caution: With j link probe you can't code coverage. Only with j trace and if you can connect to ETM.

I use it under Windows but it is also under Linux​.

SBhon.1
SBhon.1Author
Associate II
October 22, 2022

Thanks. Will try that and revert back for any queires.

waclawek.jan
Super User
October 23, 2022

What is code coverage?

JW

Javier1
Principal
October 26, 2022

i had the same, this lead me to a google learning adventure.

This all sounds very klingon to me still...

hit me up in https://www.linkedin.com/in/javiermuñoz/
GLASS
Visitor II
October 24, 2022

Hi Jan. Code coverage is a metrics on source code based on runtime analysis. With ETM it can be done in real time with not noticable impact on timing.

Doing so can highlight for example instruction that are not executed during a non regression test​. Generally tools give also statistic so you can target very qickly witch part of code need to be rewrite for optimisation purpose.

As stated by @Pavel A.​ ITM can only sample PC to give a statistic. Sampling approche is not so accurate due to insuffisant sampling on very small part of code as like ISR for example...

Have a look to video example using J-TRACE not j link!!!

https://www.segger.com/products/development-tools/ozone-j-link-debugger/technology/code-coverage/

waclawek.jan
Super User
October 24, 2022

Thanks.

JW