public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: "R. Diez" <rdiezmail-newlib@yahoo.de>
To: Keith Packard <keithp@keithp.com>
Cc: Jeff Johnston <jjohnstn@redhat.com>,
	"newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: _REENT_CHECK_VERIFY calls __assert_func even if NDEBUG is defined
Date: Wed, 29 Apr 2020 15:05:02 +0200	[thread overview]
Message-ID: <83127821-8a4f-b4a4-3fc2-3dcd5e6110ed@yahoo.de> (raw)
In-Reply-To: <878sifp8y8.fsf@keithp.com>


> If you're tight on RAM, you might look at the newlib fork, picolibc,
> which uses native TLS support for reentrant data values like
> _rand_next. With that approach, your thread-local storage contains only
> values used by your application and malloc need never be called. In this
> case, the per-thread data would be only eight bytes.

I do have one microcontroller with 8 KiB SRAM. For all others I do not want to bother.

I am interested in your "only eight bytes" claim. Say I use picolibc, and then my firmware wants to use rand(), which needs many more bytes for the 
state of the pseudo-random number generator.

The firmware is bare metal (no operating system). I guess there will not be a native TLS support then.

How does rand() get the memory it needs? Do I need to preallocate it statically? Or have a separate memory pool for the TLS? Do I need to implement 
TLS myself? Can you do that with some sort of easy-to-code stack?

Regards,
   rdiez

      reply	other threads:[~2020-04-29 13:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <989180140.2023825.1588003097077.ref@mail.yahoo.com>
2020-04-27 15:58 ` R. Diez
2020-04-27 17:39   ` Jeff Johnston
2020-04-27 20:29     ` R. Diez
2020-04-27 23:57       ` Jeff Johnston
2020-04-28 12:06         ` R. Diez
2020-04-29 19:51           ` Jeff Johnston
2020-04-30  8:08             ` R. Diez
2020-04-28 19:36         ` FAQ link to crossgcc broken R. Diez
2020-04-28 19:57         ` _REENT_CHECK_VERIFY calls __assert_func even if NDEBUG is defined R. Diez
2020-04-28 22:00           ` Keith Packard
2020-04-29 13:05             ` R. Diez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83127821-8a4f-b4a4-3fc2-3dcd5e6110ed@yahoo.de \
    --to=rdiezmail-newlib@yahoo.de \
    --cc=jjohnstn@redhat.com \
    --cc=keithp@keithp.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).