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++
12618 Discussions

undefined reference to getc error

Altera_Forum
Honored Contributor II
2,763 Views

Hi, 

I am new to nios processor. when I use getchar function in my programm, I am getting error "undefined reference to `getc'".My task is very simple.I need to read a charecter from console and compare that charecter,if it is "w" I have to send data to pio ( again from console and it is just 8 bit pio). If it is "r" I have to read data from PIO (I am lucky, atleast printf is working ).Can anybody tell me what is wrong with getchar function ? and any suggestions to impliment my task. 

Sarat
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,123 Views

Hi friends, 

Sorry for the previous post.I have got solution from some other thread.I have increased the memory size and I have unchecked the small c library on bps properties and my code is working fine:). 

 

Sarat
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

The 'small' C library may well have a function to read a character directly from the JTAG UART fifo - it wouldn't be that big! 

But I wouldn't know what it was called!
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

The hal.enable_lightweight_device_driver_api must set to true if the small device drivers bsp option is checked. 

 

Both settings can be made in the BSP editor 

 

links: 

http://www.altera.com/support/kdb/solutions/rd10152012_873.html  

 

http://www.altera.com/literature/an/an459.pdf page 36
0 Kudos
Reply