tiarmclang compiler: introduction to code coverage
Get an introduction to code coverage in tiarmclang. See the final display in different formats. Learn about the online article on code coverage that is used as the basis for the code coverage demonstration given in the next few videos.
Resources
[AUDIO LOGO]
Welcome to another video in the series about the tiarmclang compiler. This video introduces the code coverage features. My name is George Mock, and I'm your guide.
So I want to discuss at a very high level what's the back story, what's code coverage about? Well, what it's about is trying to get at the question, how much of your code is getting tested? It's taking a close look at the input that you're pushing through the program or whatever you're testing to see, well, how much of that input is causing code in the system to actually be in-- actually be executed, which raises the question, are there any hidden bugs?
Is there anything that's wrong in your program that's still there because you just haven't tested it? Well, code coverage is an attempt to get at that. It's also required for meeting safety standards, such as ISO 26262.
So what we're looking at right here is the end result of the code coverage process in the tiarmclang compiler. Multiple steps are involved in getting there. And I'm going to be walking you through all those steps. And as we do it, I want you to have a sense of what the final destination is. So you're not going to understand everything at this point, but I'll be able to show you a little bit.
So you can see the source code that's been annotated. You can see it in HTML format. Things in red are bad. And I'll explain that when we get to it. You can also see it in text format if that makes sense for your situation.
And here towards the bottom, I'm showing how you can see a coverage report. And this is the kind of thing that tends to be important when you're trying to meet certain safety standards. So this is what we're aiming for. We're trying to get to a point of where we could see this kind of thing regarding your source code.
So the videos thus far have been mostly me talking over slides and conveying information in that mode. We're about to switch out of slides mode into actually showing things in Code Composer Studio. And I'll be walking through the steps that are inspired by an article that's already available online.
The full URL to the article is here. That's kind of a lot. I don't expect you to stare that down and type it in. That's not practical. What I hope is practical, you can go to your favorite search engine and type in "code coverage with tiarmclang compiler."
I think that's pretty straightforward to type that in. And then, all the search engines I checked return this long URL in the first three results. So I recommend that be the method that you use to get to it.
So the next thing we'll be seeing is I will introduce the CCS project used in the demonstration. At this point, what I have is a project in Code Composer Studio. It happens to be Code Composer Studio version 12, the most recent one as of this recording time.
And the thing is all ready to run. We're ready to hit Run. And I'll get to why I wanted to do that. Because I decided to think the best way to introduce what's happening here is to actually try and run this code. So let's give it a go. And here it goes. You see the output down here is happening.
What's going on here? Let's get a little bit better look at just the output of the program. So it's a children's program. Well, it's a computer simulation, if you will, of a of a children's game called FizzBuzz. And so maybe the way you want to go about learning about what this is by doing a search on FizzBuzz. I don't know. Maybe that's how you like to do things.
But when you actually play this game in real life, you have a group of kids sitting in a circle, and they start counting off 1, 2. And every time you get to a multiple of 3, you don't say 3 or whatever the number is. You say fizz. Every time you get to a multiple of 5, you say buzz. And this pattern continues.
The interesting case is when you get to 15. That is a multiple of both 3 and 5. And so you have to say fizz buzz, and so on and so on. So that that's what this code is doing. What's nice about it here is it's fairly simple to explain at this point just what it's doing.
So now let's start to take a bit of a look at the source code itself. Let me make that a bit larger. I don't want to explain this in a lot of detail. I don't think that makes a lot of sense. There are just countless ways to implement this little program.
It's going from 1 to limit, where limit is 50. So we're playing this game for that range of numbers. And this is not the most intelligent implementation. It's not the most efficient, not the most anything of that nature. When I was putting this example together, what I was trying to do is just introduce as many different kinds of tests and branches as I could think of, just to try and show off a lot of what code coverage can do, as this different condition-- different branching behavior happens during the program.
Now, the only other thing I do want to point out at this point is that there is this, which is something that I introduced purely to show something that never executes during the time of the program. So this is the CCS project that we're going to be with for a little while here. And I just wanted to do a basic introduction with the program it is before we start getting into the code coverage aspects of it.
I'll close out this video by giving you a couple of references. The first reference is to the home page for tiarmclang, www.ti.com/tiarmclang. Here's where you can download the compiler, access the manual, and other details like that.
The second reference is to e2e.ti.com. This is where you can ask questions about any TI product, not just tiarmclang. But certainly, tiarmclang is included. Should that question be in any way related to a compiler or one of the associated tools, those questions are answered by me. Thank you for watching this video in the series about the tiarmclang compiler.
This video is part of a series
-
Video series: tiarmclang Compiler
video-playlist (17 videos)