Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

PRINTF ERROR IN NIOS II ECLIPSE

Manprocoder
Beginner
230 Views
#include <stdio.h>
#include "system.h"
#include "io.h"
//------------------------------
//display CRC_seq output in binary format
//------------------------------
/*void decimalToBinary(int n) {
    int a =0;
 
    for(int i =0; i<8; i++){
    a = n>>(7-i) & 0x1;
    printf("%d", a);
    }
    printf("\n");
}*/
 
int main(){
//result variable
int crc_seq=0;
int write_data =0;
//Generator Polynomial(da thuc sinh) 0xd5
//int genPoly = 213 & 0xff;
int genPoly = 0xd5;
//0x0a55, 0x0a56, 0x0a57, 0x0a58, 0x0a59
//int data[5] = {2645, 2646, 2647, 2648, 2649};
int data[3] = {0x0a55, 0x0a56, 0x0a57};
//write genPoly down to design
IOWR(CRC_0_BASE, 0, genPoly);
printf("Hello Nios II!!!\n");
 
//--------------------------------------------------------------
//write valid data and read respective CRC sequence
//---------------------------------------------------------------
 
printf("Before IOWR...\n");
for(int i =0; i<3; i++){
write_data = data[i] & 0xffff;
IOWR(CRC_0_BASE, 1, write_data);
printf("After IOWR...\n");
printf("\nData[%d]: 0x%04x", i, write_data);
crc_seq = IORD(CRC_0_BASE,2)&0xff;
printf("\nCRC[%d] = 0x%02x", i, crc_seq);
}
 
return 0;
}
TOOL: quartus, nios ii eclipse, ModelSim
MY ISSUE: i do not see content  of this function "printf("After IOWR...\n");" on console although IOWR(CRC_0_BASE, 1, write_data); is implemented successfully.
Additional Note: all of contents of all printf before this command "IOWR(CRC_0_BASE, 1, write_data)" are successfully displayed onto console.
HELP ME. THANKS A LOT.
0 Kudos
1 Reply
Viet_H_Intel
Moderator
82 Views

Please provide a compiler version (icx/icpx) along with command line options and a compile-able and run-able test case.  

0 Kudos
Reply