printf returning EOF

Joel Sherrill joel.sherrill at
Mon Jan 30 19:45:38 UTC 2006

Keith Robertson wrote:

> Hi all.
> I'm in the process of porting rtems to a new bsp (gen405 dervied). 
> However, whilst doing so I've encountered an error I've not seen before.
Given that this is a new BSP, it ispossible that the memory layout isn't 
right and the mallocs during early newlib initialization and the first 
are failing.  Can you determine the memory ranges given to the RTEMS 
and to the C program heap?

> Essentially printf is returning -1 or EOF from a macro called cantwrite
> inside the newlib code.  I'm confident that stdin/out/err streams are
> being opened in bsp_postdriver_hook, and set to the proper magic numbers
> (0,1,2).  Beyond this, I'm really quite confused.
> The only thing that I can think of is that newlib isn't getting
> initalised correctly.  However, I don't have enough knowledge of the
> libc/rtems integration to understand if this is the case.  Can anybody
> point me in the direction of some things to check?
> Has anybody encountered this before?  There's a post on the mailing list
> from ages ago asking about precisely the same problem.  However,
> unfortunately, the poster appeared to resolve the problem with posting
> his resolution :(
> The post is here for further info:
> Very stumped.
> Keith

More information about the users mailing list