Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage returns required for alignment? #395

Open
Virtual-Machine opened this issue Jun 17, 2021 · 2 comments
Open

Carriage returns required for alignment? #395

Virtual-Machine opened this issue Jun 17, 2021 · 2 comments

Comments

@Virtual-Machine
Copy link

When I compile the example programs I am finding that the output is misaligned. At first I thought it was extra spacing but later realized that the cursor was not going to the beginning of the next line. I am used to unix style line endings but if I change "\n" to "\r\n" then the output of programs looks as I would expect. Am I doing something wrong or should most example programs be updated?

Default output of sisense-welcome
Screenshot_2021-06-17_00-13-46

After swapping "\r\n" in for "\n"
Screenshot_2021-06-17_00-15-27

@Virtual-Machine
Copy link
Author

Virtual-Machine commented Jun 17, 2021

For reference I am using this to connect, which comes from the HiFive1 Rev B getting started manual:

sudo screen /dev/ttyACM0 115200

On my system (Ubuntu) it has Screen v4.08.00 05-Feb-20 which appears to be the latest version.

@nick-knight
Copy link

nick-knight commented Jun 17, 2021

Historically, Freedom-Metal used to (sneakily, silently) replace \n by \r\n in C standard output routines. I found this behavior to be problematic and so I pushed to change it in March 2020 (PR #236). I think I still feel the same way.

A different question is whether the examples should instead use \r\n. I have less strong of an opinion here. There's no universally correct way to display a newline: \n, \r, \r\n, etc., are all "correct" on different terminal emulators, so it's impossible to write a single example program that will work correctly for everyone.

This being said, there is an issue here: you apparently followed our instructions (to use GNU screen), and had a bad experience. I think the solution is for SiFive to provide users with instructions on how to reconfigure GNU screen to reinterpret \n as \r\n (or whatever screen needs to display the correct output). Perhaps this isn't a screen setting at all, but is coming from the underlying terminal emulator that screen is running in. I Googled for a few minutes and couldn't figure this out: most Google hits suggested using a different program, or hacking the GNU screen source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants