EmbDev.net

Forum: ARM programming with GCC/GNU tools migration from w2k to win7 broke newlines


von Christopher B. (Company: Voom Technologies, Inc.) (ampoliros)


Rate this post
useful
not useful
Our product uses an Atmel AT91R40008 processor.
The w2k environment is:
* Cygwin 1.3
* eCos 1.3.1
* gcc toolchain arm-elf 2.95

The win7 environment is:
* Cygwin 1.7
* eCos 1.3.1
* gcc toolchain arm-elf 4.6.0

Something in the win7 environment broke some, but not all of the 
trailing newline characters we output via RS-232.  I've looked at the 
printf calls.  There's no practical difference between the calls that 
get truncated and the calls that work.
For instance,
1
start.h:
2
#define START_MSG "\nStart\n"
3
4
start.cpp:
5
printf("%s", START_MSG);
6
-or-
7
printf("\nStart\n");
both fail to print the trailing newline, while
1
format.h:
2
#define SPINNING_MSG "Spinning Drive"
3
4
main.cpp:
5
printf("%s %s\n", SPINNING_MSG, drive_text);
will print the trailing newline.

I've tried the -ansi flag to no avail.

Any suggestions to try and track this ?bug/feature? down?
The same code in the w2k environment works fine.
Thanks in advance.

von Jörg W. (dl8dtl) (Moderator)


Rate this post
useful
not useful
Your failing printf()s are probably replaced by the compiler by
puts(), where the compiler omits the trailing newline since puts()
is supposed to add it by itself.  If the puts() implementation is
broken (for whatever reason), then the trailing newline is missing
in the output.

von Christopher B. (Company: Voom Technologies, Inc.) (ampoliros)


Rate this post
useful
not useful
Thank you very much.  puts() was the problem.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.