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: Blackfin & printf()/fprintf()


Sebastian Dressler wrote:
Sebastian Dressler wrote:
Ok, it seems now, that the sbrk call is broken, i've tested that with
malloc ... it fails. So i'll hang in there and fix it first. Maybe it
works then...


Well...i've fixed sbrk and malloc behaves correct now, but nothing changed in the behavior of printf. I've debugged it, and found out, that something goes wrong, when vfprintf checks the fp. I assume that stdin/out/err is not initialized.

After making some google-research i found out, that maybe _sinit() should be
called or the the _REENT structure should be initialized. Since i don't use
reentrancy, i'm a bit confused now...

Sebastian
You use the reentrancy structure regardless of threads. It is used to store the std streams, errno, the strtok last pointer, etc... Now, if you look at libc/stdio/local.h, you will see that CHECK_INIT is set up to look at the reentrancy struct to see if the std streams are set up. If not, it calls __sinit(). If you don't have a properly initialized reentrancy structure, then you have problems. So, start there and look at the _sdidinit field to ensure it is false to start with and that you end up calling __sinit(). The default reentrancy structure _impure_data which is referenced by the _REENT macro, is initialized in libc/reent/impure.c.

-- Jeff J.


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