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;
}