0

Could you please share your idea about the measurement code coverage that is run on actual hardware target? It's mean how to do instrument for that test and the method how to get the coverage information after testing code is executed on real hardware.

Example: I have STM32L152RB discovery board. I do the Unit testing for its software. I can run the code coverage measurement on X86 (Visualizing environment or PC environment). But I want to run that testing code on real hardware (STM32L152RB discovery board) to make sure that the code coverage is more reliable.

Thanks and regards, TRUONG

  • https://istarc.wordpress.com/2015/01/06/stm32f4-unit-testing/ this provides all the info afaik – Pradheep Jun 29 '15 at 03:10
  • when you run on an operating system you have...an operating system...sitting under the code, lots of resources and code. but running on a target like that you need your main code plus the code to do the coverage, which likely wants an environment, so there is the challenge. – old_timer Jun 29 '15 at 23:40
  • Check and see if that part supports ETM, an optional add-on for Cortex-M3 parts. If so, then its just a matter of getting the right tools. – Brian McFarland Jun 30 '15 at 17:47
  • Thank Pradheep, dwelch abd Brian. I did it by using Green Hill compiler on another target (RH850-D1x) It needs a decode file after execution. Then run the coverage analysis tool to report the result. – Nguyễn Xuân Trường Sep 18 '15 at 03:03

1 Answers1

0

It sounds like you wish to do dynamic analysis in run-time, which is the only way to measure true code coverage on embedded systems, since it is done on the actual hardware with all possible inputs available.

To do this on a microcontroller, you would traditionally need expensive tools like a true in-circuit emulator. But nowadays there are probably JTAG adapters etc capable of recording the program counter of a running program. Depends on if the CPU supports trace or "cycle stealing" etc. I don't know how to do this on your particular hardware (and tool recommendations are off topic on SO anyway) but you should probably be prepared for hefty tool costs.

Lundin
  • 195,001
  • 40
  • 254
  • 396
  • Hi Lundin, Yes, I have to have the circuit debugger, and I did it successfully. But I do not understand the theory about code coverage on the real target. Do you have any basic knowledge about the framework or any resource to figure it out? – Nguyễn Xuân Trường Sep 18 '15 at 03:06