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

printf in Nios to stdout (altera_avalon_uart) sends "\ n" (LF) without translating to CR LF

HLana
Beginner
1,245 Views

Hello

 

our system is a Nios (with uCOS) in a CycloneV using an altera_avalon_uart as stdout. In other embedded systems the "\n" in a printf is often replaced with CR+LF. In some systems it is possible to select the behavior by activating O_TEXT or O_BINARY with fcntl(). A printf​ in the Nios never translates \n to CR+LF. It sends only LF. Is there a setting to change this behavior? fcntl() does not work for me. O_TEXT is unknown in fcntl.h.

 

Thanks

Hendrik

0 Kudos
1 Reply
JOHI
New Contributor II
188 Views

Hello Hendrik,

Since nios is open source, you can dive into the system code during debugging and follow the source.

There you will see all opportunities.

From what I remember, it was not possible to change the behaviour as requiested, but i am not 100% sure, it has been some time since i did this;

However, you can write a wrapper around printf (with the same name) and change the behaviour as specified or write your own printf function.

 

What you can also do is change one of the helper functions

see alt_printf.c for more details.

A few lines of code might get you the desired result.

 

Best Regards,

Johi.

Reply