This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: My printf doesn't work


Is your crt0 properly clearing the .bss area? In your linker script the .bss is an area set aside for zero-initialized data. Usually the crt0 is responsible for writing zeroes to this area because the memory may be undefined at start-up. If you haven't done this, certain globals that newlib uses will be invalidly initialized to non-zero. This will cause general problems (e.g. a buffer won't be allocated because the check made will look for a NULL pointer).

If you didn't add a newline to your output data, the write syscall won't occur until either you fflush stdout or during the exit logic (just in case you debugged only to the end of printf).

-- Jeff J.

Franzi Edo. wrote:
Hi,
I would like to implement the "printf" function on my target. Accordingly with the documentation I found it seems that it should be enough to write some low level routine such "fstat, sbrk, istty, ... read, write". So, I implement these functions and I can monitor that fstat, sbrk and isatty are called during the printf. However, the "write" function is never called, and of course I cannot have the data out to my USART. Do I have initialise some I/O table or stuffs like this to make operational my printf? Any ideas?


I use gcc-4.1.0,
cpu32 target
newlib-1.14.0

Regards E. Franzi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]