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++
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
12583 Discussions

Why none getchar(), getc, fgetc() work ?

Altera_Forum
Honored Contributor II
1,170 Views

I built a embedded system in qsys which has the jtag_uart IP. Based on default set,jtag_uart is used as stdin, stdout. I create a hello world project and it can print hello world in console. 

But after I added the command like: 

 

getchar(), getc(), or fgetc(), then the program can't be build. It reports errors like: "undefined reference to 'getc' ". I copy my codes as below: 

# include <stdio.h># include "..\hello_world_bsp\HAL\inc\io.h"# include "..\hello_world_bsp\system.h" 

typedef unsigned int uint; 

 

 

int main() 

 

 

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

int c; 

c= getc(stdin); 

//c=getchar(); 

printf("This is from UART: %d", c); 

 

 

 

 

return 0; 

 

 

I also attached the screenshot. Why these functions which use jtag_uart to read don't work? Do I missed to include any files?  

 

Thanks in advance.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
340 Views

Anyone has idea? 

 

Thanks.
0 Kudos
Reply