C++ iostream only working in Init, not in other RTEMS Tasks

Joel Sherrill joel at rtems.org
Wed May 3 20:42:24 UTC 2017


On Wed, May 3, 2017 at 12:46 AM, Sebastian Huber <sebastian.huber at embedded-
brains.de> wrote:

> On 03/05/17 07:15, Sebastian Huber wrote:
>
>> On 03/05/17 00:47, Chris Johns wrote:
>>
>>> On 2/5/17 6:03 pm, Sebastian Huber wrote:
>>>
>>>> On 02/05/17 09:35, Chris Coppens wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> In our RTEMS application C++ iostream (e.g. "cout") is only working in
>>>>> the “Init” function?
>>>>> If I use “cout” in a RTEMS Task other than Init, no output is shown in
>>>>> the console.
>>>>> Any idea why this is happening?
>>>>>
>>>> The C++ library uses thread-local standard IO streams (Newlib feature)
>>>> for the global IO stream objects. I am not sure how to fix this
>>>> properly, but I guess a RTEMS-specific change in the libstdc++ would be
>>>> necessary.
>>>>
>>>> Does a ticket exist for this? This should be fixed for 4.12.0 so please
>>> set the milestone to 4.12.0 and blocker.
>>>
>>
>> I don't know if a ticket exists. This issue exits in all RTEMS versions
>> with C++ support. Since the initialization thread is restarted after the
>> C++ global constructor calls this issue is more obvious now.
>>
>> Before you make this a release blocker, then please find someone who can
>> fix this.
>>
>>
> Just for reference. The std::cout etc. is initialized here
>
> https://gcc.gnu.org/viewcvs/gcc/trunk/libstdc%2B%2B-v3/src/c
> %2B%2B98/ios_init.cc?view=markup#l85
>
> via a placement new. The "stdout" etc. is thread-local in Newlib. Using
> this for a global object like std::cout is quite broken.


Is there a test program to demonstrate that this is broken?

Since Cygwin also uses newlib, I have trouble believing this would
not also be broken there.

Going back to the original post. How many file descriptors are configured?
I am suspicious that the way C++ does it might require more file
descriptors.

--joel

>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170503/66bc3a57/attachment-0002.html>


More information about the users mailing list