Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

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

GKO00
Beginner
853 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
612 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/embedded/2019/error---makefile-is-not-up-to-date-.html

Regards,

 

0 Kudos
Reply