EmbDev.net

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


Author: Christopher Biessener (Company: Voom Technologies, Inc.) (ampoliros)
Posted on:

Rate this post
0 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,
start.h:
#define START_MSG "\nStart\n"

start.cpp:
printf("%s", START_MSG);
-or-
printf("\nStart\n");
both fail to print the trailing newline, while
format.h:
#define SPINNING_MSG "Spinning Drive"

main.cpp:
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.

Author: Jörg Wunsch (dl8dtl) (Moderator)
Posted on:

Rate this post
1 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.

Author: Christopher Biessener (Company: Voom Technologies, Inc.) (ampoliros)
Posted on:

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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.