Tool/software:
When i do the code coverage i can see when i collect, run the debugger till program is done, and then analyze and open the .csv i can see return frequency = 1. and if i run the analyze again see return frequency = 2.
But if i collect run the debugger, analzye and run the debugger again analyze return frequency = 3. if i rerun analyze return = 5.
Important to note i delete the .prf pdat and .csv files between these tests.
Why does it have this kind of behavior? Is there a way to get the .csv file without running/incrementing what's been collected when running the analyze another time? My expectation would be if you run the debugger 2 times you should return = 2 (went through the program 2 times) and that the analyze is generating the .csv.
Edit:
I also tried the following:
run debugger till the program finishes, then i go to tool profile code gen code coverage. look at the .csv it says return frequency = 1. i run the debugger again and and then do the tool gen code coverage and look at the .csv and i see frequency =3. why is that? Not sure what exactly i'm missing. Any help would be awesome.
Edit 2:
I think I figured part of the problem out. If you run the debugger a second time and you delete the .prf and the .csv and you run analyze it will show a return of 2 instead of 3, which seems correct to me.
I then tried to make a test and prove that its accumulating the changes even if you change the code.
I ran debug analyze with a line that says printf("pass_1"); and it showed frequency of 1 in the .csv, and then changed the line to printf("pass_2"); and ran again (delete .prf and .csv) and it says pass2 frequency = 2 andpass1 is not found in the .csv. I'm not sure why it's acting like this. My expectation would be that pass_1 and pass_2 would both appear in the 2nd run and have a frequency.
#include <stdio.h> #include <msp430.h> volatile unsigned int i; volatile unsigned long j = 0; extern void _TI_stop_pprof_collection(void); extern void _TI_start_pprof_collection(void); int main(void) { //start code coverage data collection //TI_COVDIR = "C:\Users\eVelez\PreVeil-eric.velez@mnemonics-inc.com\Documents\code_composer_work_spaces\v12\hfx2"; //TI_COVDATA = "yeehaw"; // WDTCTL = WDTPW + WDTHOLD; // Stop WDT // // puts("Does this string get printed?"); // printf("hello world"); // return 0; printf("yeehaw"); WDTCTL = WDTPW + WDTHOLD; // Stop WDT P5DIR |= 0x10; // P5.4= output direction P5SEL |= 0x10; // P5.4= MCLK option select P1DIR |= 0x01; // P1.0 = output direction //P1DIR |= 0x02; // P1.1 = output direction BCSCTL1 &= ~XT2OFF; // Activate XT2 high freq xtal BCSCTL3 |= XT2S_2; // 3 16MHz crystal or resonator do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while (IFG1 & OFIFG); // OSCFault flag still set? BCSCTL2 |= SELM_2; // MCLK = XT2 HF XTAL (safe) P1OUT |= 0x01; // P1.1 = 1 //initalize variable int loop_count = 0; for (;;) // Infinite loop { for(j = 0xFFFFF; j > 0; j--); //P1OUT |= 0x02; // P1.1 = 1 P1OUT ^= 0x01; // P1.1 = 0 //P1OUT &= ~0x02; // P1.1 = 0 //break out of for loop after 5 times if (loop_count == 5) { break; } loop_count = loop_count + 1; } //show branching if else if a =1 and a=0, switch statement//state machine //initalize a and b int a = 10; int b = 5; // more complicated if statement to test if (a == 10 && b == 5) { printf("a = 10 and b =5\n"); } else if (a == 5 && b == 10) { printf("a = 5 and b =10\n"); } // switch int switch_var = 1; switch (switch_var) { case 1: printf("switch_var = 1"); break; case 2: printf("switch_var = 2"); break; case 3: printf("switch_var = 3"); break; case 4: printf("switch_var = 4"); break; case 5: printf("switch_var = 4"); break; default: printf("not initialized.\n"); break; } //stop code coverage data collection _TI_stop_pprof_collection(); return 0; }