public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jochen Strohbeck <jochen@strohbeck.net>
To: newlib@sourceware.org
Subject: Re: Hard faults using sprintf() and float
Date: Mon, 03 Apr 2017 13:19:00 -0000	[thread overview]
Message-ID: <63c8d131-9ce8-ffbd-28e7-67d122a61b78@strohbeck.net> (raw)
In-Reply-To: <7e3fac0d-d907-4c07-37cb-6ece658360e2@strohbeck.net>

The hard fault and strange formatted output does not happen if a
semaphore is used to protect sprintf().

Again, this problem seems only to happen if floats are printed and this
behaviour has been observed and reported by other users in the past and
I wonder what happens here. I have implemented malloc_r() which is using
FreeRTOS own heap4 pvPortMalloc() and is called by newlib's sprintf(),
printf(), puts() etc. So memory allocation seems not to be the real
problem here. Are there other functions to be implemented which are
called by sprintf() in order to protect it ?

In this article www.billgatliff.com/newlib.html the compile switch
REENTRANT_SYSCALLS_PROVIDED is mentioned. I defined
configUSE_NEWLIB_REENTRANT but get an ASSERT() due to a corrupted task
descriptor in FreeRTOS if sprintf() is not guarded by my semaphore.

I downloaded and compiled newlib on Windows but it seems that the lib is
built for Intel not ARM (makefile refers to gcc not arm-none-eabi-gcc).
Any switch that must be passed to configure ?


> Can I check if the provided newlib library is ready for (Free)RTOS
> applications ?

  reply	other threads:[~2017-04-03 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24  8:31 Jochen Strohbeck
2017-03-24  9:38 ` Sebastian Huber
2017-03-24 11:46   ` Jochen Strohbeck
2017-03-24 13:41     ` Richard Earnshaw (lists)
2017-03-27  8:48       ` Jochen Strohbeck
2017-04-03 13:19         ` Jochen Strohbeck [this message]
2017-04-03 18:57           ` onkel.jack

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=63c8d131-9ce8-ffbd-28e7-67d122a61b78@strohbeck.net \
    --to=jochen@strohbeck.net \
    --cc=newlib@sourceware.org \
    --cc=strohbeck@gmx.net \
    /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).