Hard faults using sprintf() and float
Mon Apr 3 13:19:00 GMT 2017
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 ?
More information about the Newlib