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

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

HLana
Beginner
1,550 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
493 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.

0 Kudos
Reply