Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12410 Discussions

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

GKO00
Beginner
426 Views

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

 

 

0 Kudos
1 Reply
Ahmed_H_Intel1
Employee
185 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,

 

Reply