Hello,
I am trying to use stdout (e.g. fprintf(stdout,"hello world\n");) from a thread without success. Functions where stdout is implicit (e.g. printf) work fine. I am using Sys/BIOS 6_35_04_50, gcc version gcc-arm-none-eabi-4_7-2012q4, and I am compiling for an A15.
I notice that stdio.h maps stdout:
#define stdout (_REENT->_stdout)
to the current thread's context via __getreent(). However no thread's context (other than the "main" thread) points to a valid FILE pointer for stdout.
I have a temporary workaround in a single source file using stdout by performing:
# if defined(stdout)
# undef stdout
# define stdout _stdout_r(_GLOBAL_REENT)
# endif
But I am hoping that there is a better and more general solution out there. I am supporting a large code base so making platform specific workarounds like these is not idea.
Thanks
P.S. This question crosses the boundary between OS and compiler/runtime libraries. I apologize if I chose the wrong forum to post into.