Community
cancel
Showing results for 
Search instead for 
Did you mean: 
GKO00
Beginner
282 Views

There is c code errors for using performance counter IP, but I can not debug this problem.

The followings are my c code, and "perf_print_formatted_report" has c code error... I don't no why...

 

#include "sys/alt_stdio.h"

#include "stdio.h"

#include "system.h"

#include "altera_avalon_pio_regs.h"

#include "altera_avalon_performance_counter.h"

#define SECTION_1 1

int main()

 int count=0;

 int delay;

 alt_putstr("Hello from Nios II!\n");

 PERF_RESET(PERFORMANCE_COUNTER_BASE);

 

 PERF_START_MEASURING (PERFORMANCE_COUNTER_BASE);

 PERF_BEGIN (PERFORMANCE_COUNTER_BASE,1);

 

 PERF_END (PERFORMANCE_COUNTER_BASE,1);

 PERF_STOP_MEASURING(PERFORMANCE_COUNTER_BASE);

 

   perf_print_formatted_report (

  (void *)PERFORMANCE_COUNTER_BASE, // Peripheral's HW base address

  ALT_CPU_FREQ, // defined in "system.h"

  1,

  "1st_test"

   );

 while(1){

 IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE,count);

 delay = 0;

 while(delay<20000000){

 delay++;

 }

 count++;

 }

 /* Event loop never exits. */

 printf("Goodbye from Nios II - returning from main()!\n");

 return 0;

}

 

error.jpg

 

 

Tags (2)
0 Kudos
1 Reply
Ahmed_H_Intel1
Employee
41 Views

Hi,

the code looks fine only you don't have to use these two headers:

#include "sys/alt_stdio.h"

#include "stdio.h"

The error is because the tools failed to make the files, I encourage you to follow the following steps to fix this error:

https://www.intel.com/content/altera-www/global/en_us/index/support/support-resources/knowledge-base...

Regards,