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.
12435 Discussions

undefined reference to getc error

Altera_Forum
Honored Contributor II
1,986 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
346 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
Altera_Forum
Honored Contributor II
346 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!
Altera_Forum
Honored Contributor II
346 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
Reply