Starterware/am3359: clock() always return 0

Part Number: am3359

Tool/software: Starterware

Hi TI,

              AM335x starter kit, starterware, CCS  Version: 7.2.0.00013

I am working on starterware with AM335x starter kit. Below is the test program on clock() function.

#include <stdio.h>
#include <time.h>

int main(int argc, char *argv[])
{
  int i;
  clock_t t_start, t_stop, t_overhead;

  t_start = clock ();

  for (i = 0; i < 10000000; ++i)  // dummy for loop
    ;

  t_stop = clock ();
  t_overhead = t_stop - t_start;

  printf("took: %ld CPU time\n", (long) t_overhead);
  return 0;
}

console output: [CortxA8] took: 0 CPU time

search on e2e, and found similar thread, such as below from 4 years ago,

e2e.ti.com/.../303963

It mentioned "In your CCS Debug view--->Target menu, go to Clock and select Enable." However, CCS7 seems changed a lot, and I cannot find the right location to enable this Clock. (if I missed, please help to provide a screenshot for my instruction)

I also tried to replace the "dummy for loop" by my already working project codes, in case CCS7 optimizing out the "dummy for loop". Though it didn't help either.

Please advise, Thanks in advance.

Mike

2 Replies