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

Chris Coppens Chris.Coppens at TopicProducts.com
Thu May 4 06:42:32 UTC 2017


Hello,

We are configuring maximum 64 file descriptors at the moment:

…
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS DYPLO_DRIVER_TABLE_ENTRY
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_DRIVERS 10

#define CONFIGURE_EXECUTIVE_RAM_SIZE    (128*1024*1024)
#define CONFIGURE_STACK_SPACE_SIZE      (10*1024*1024)

#define CONFIGURE_UNLIMITED_OBJECTS

#define CONFIGURE_INIT_TASK_STACK_SIZE  (1024*1024)
#define CONFIGURE_INTERRUPT_STACK_SIZE                (32*1024)
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (32*1024)
#define CONFIGURE_MAXIMUM_TASKS                               3
#define CONFIGURE_MAXIMUM_SEMAPHORES           64
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MICROSECONDS_PER_TICK 1000

#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 64
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#include <rtems/confdefs.h>

#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#include <rtems/shellconfig.h>
…




From: users [mailto:users-bounces at rtems.org] On Behalf Of Joel Sherrill
Sent: woensdag 3 mei 2017 22:42
To: Sebastian Huber
Cc: rtems-users at rtems.org
Subject: Re: C++ iostream only working in Init, not in other RTEMS Tasks



On Wed, May 3, 2017 at 12:46 AM, Sebastian Huber <sebastian.huber at embedded-brains.de<mailto: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<tel:%2B49%2089%20189%2047%2041-16>
Fax     : +49 89 189 47 41-09<tel:%2B49%2089%20189%2047%2041-09>
E-Mail  : sebastian.huber at embedded-brains.de<mailto:sebastian.huber at embedded-brains.de>
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




Kind regards,



Chris Coppens

Software Designer



[cid:image140503.PNG at 2bf96124.46b8295e]


TOPIC Products








Materiaalweg 4








5681 RJ Best


T:


+31 (0) 499 33 69 69


Postbus 440


E:


Chris.Coppens at TopicProducts.com


5680 AK Best


W:


www.topicproducts.com<http://www.topicproducts.com>


The Netherlands

[cid:imagef17685.JPG at 0cd661b5.4692de6b] <https://www.facebook.com/TopicProducts> [cid:image142cc7.JPG at 4f054b35.4aa92564] <https://twitter.com/TopicProducts> [cid:image0b71b0.JPG at 780a0bf3.4a9dec55] <https://www.linkedin.com/company/topic-embedded-products>
Please consider the environment before printing this e-mail



_______________________________________________
users mailing list
users at rtems.org<mailto: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/20170504/24eab703/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image140503.PNG
Type: image/png
Size: 9075 bytes
Desc: image140503.PNG
URL: <http://lists.rtems.org/pipermail/users/attachments/20170504/24eab703/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imagef17685.JPG
Type: image/jpeg
Size: 1088 bytes
Desc: imagef17685.JPG
URL: <http://lists.rtems.org/pipermail/users/attachments/20170504/24eab703/attachment-0006.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image142cc7.JPG
Type: image/jpeg
Size: 1087 bytes
Desc: image142cc7.JPG
URL: <http://lists.rtems.org/pipermail/users/attachments/20170504/24eab703/attachment-0007.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image0b71b0.JPG
Type: image/jpeg
Size: 1060 bytes
Desc: image0b71b0.JPG
URL: <http://lists.rtems.org/pipermail/users/attachments/20170504/24eab703/attachment-0008.jpe>


More information about the users mailing list