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

Doubts using stdio.h

Altera_Forum
Honored Contributor II
1,463 Views

hello everybody, i'm trying to read some data sent from my computer to my De2-70 through the UART port, i read the Embedded Peripherals IP user Guide and there was written in the page 6 of the chapter 6 that i may use the getchar() function to receive data, but when i compiled my code i receive this message here shown in the image below: 

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=8477  

 

I also tried to use the scanf, but the same error appeared. 

I just need to read some data from the UART. Please help me!!!! 

 

Thank you all!!!
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
467 Views

Do you have stdin/stdout specified in the BSP? Also, those are some pretty heavyweight functions. Do you have offchip memory you're running this code in? If you're trying to keep the code small, you can use alt_getchar() and similar/smaller functions.

0 Kudos
Altera_Forum
Honored Contributor II
467 Views

Yes in the BSP editor i setted the uart to stdin and stdout. In the Qsys i used On-chip memory ram or rom.

0 Kudos
Altera_Forum
Honored Contributor II
467 Views

What do you have for your BSP settings: enable small c library, enable lightweight device driver api? These options can remove some things. If you're using onchip ram, you may want to enable these and use the lightweight functions. Otherwise you won't have much room left if using standard scanf/printf stdio functions.

0 Kudos
Altera_Forum
Honored Contributor II
467 Views
0 Kudos
Altera_Forum
Honored Contributor II
467 Views

Thank you cronus10 i'll read this thread and try it.

0 Kudos
Altera_Forum
Honored Contributor II
467 Views

Cronus10 i read the thread you posted to me. So a disable the options: enable small c library, enable lightweight device driver api. But now, when i compile my code this error is shown: http://puu.sh/728hj.png

 

I tried to fix it connecting the IRQ option in my Qsys design and it works, but sometimes when i try to reset the board pressing a button that i set to the reset pin nothing works anymore. So i need to turn off and turn on my board. I dont know exactly what the IRQ does, could help using this? If i disconnect this option my project doesn't work. Thank you!!!
0 Kudos
Altera_Forum
Honored Contributor II
467 Views

You will need to connect the IRQ in Qsys if you want to use the interrupt driven uart driver. I think your reset issue is a different problem. How is the reset coming into your system? Is it active high or low on the board? Do you have a reset synchronizer on your top level? Are you feeding it directly from your top level into your Qsys' clk/rst source module? 

 

Cheers,
0 Kudos
Reply