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

nios2 terminal output characters format problem

Altera_Forum
Honored Contributor II
2,106 Views

Hi, 

 

I'm trying to debug a nios2 software, and i have problems with my printf outputs :  

the characters are displayed in the terminal, but in a weird format..  

So i then tried running the simple hello_world example : 

Instead of getting in the console : 

"Hello from Nios II!" 

i get : 

"H¢³`o;±öow.Æi¥ÕºI'¶" 

And with some other random printf, i even get the error message : 

"nios2-terminal: exiting due to ^D on remote" 

but i didnt send any ctrl-D command... 

 

Anyone can help me with this problem ? 

 

Thanks 

 

edit :  

i see that the only way for me to display correct characters is to use alt_putchar function but its not very handy
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
852 Views

Make sure you have enough heap and stack space since they may be colliding. Also try different USB cables or ports, I remember seeing this years ago when I had my USB-Blaster hooked up to the hub inside my monitor and that LCD was spewing out more noise than a hairdryer on the line :)

0 Kudos
Altera_Forum
Honored Contributor II
852 Views

Since the smaller system using alt_putchar() instead of printf (which will pull in a LOT of libc stuff) works it does look like a memory space issue. 

(If a real async/rs232 line were involved I'd actually suggest a baud rate problem.) 

 

For debug, you might find it enough to write a 'putstr' function based on alt_putchar(), and a 'putint' one that converts an integer into a local buffer then sends it. 

 

OTOH, you could write a printf that insn't based on stdio snd libc! I've just compiled one I have for nios2 - actually snprintf() - comes out at 1725 bytes + a call to __udivsi3 (for the divide by 10 - which could be coded differently). This version is actually optimised for speed, not size, and supports all the field width stuff but no floating point.
0 Kudos
Reply