FreeRTOS and non-nano newlib

Hi,

I’m trying to get to the bottom of a different newlib related issue, and wanted to see if building with the “non-nano” version of newlib changed the bug’s behavior at all. Unfortunately, nothing is that easy and I am stuck with 3 errors, all blamed on tasks.c:

undefined reference to __sf_fake_stdout' undefined reference to __sf_fake_stdin’
undefined reference to `__sf_fake_stderr’

These are obviously references present in newlib-nano that are missing from newlib, but I’m at a loss as to how I can resolve them and get a good build with newlib.

This is for FreeRTOS 10.0.0 by the way.

Thanks

Which compiler and compiler options are you using? I don’t think FreeRTOS version (or FreeRTOS itself) is relevant.

Is the bug you are working on related?

Your response was the hint I needed :slight_smile:

My IDE had a checkbox to select nano or not under the linker options, but “–specs=nano.specs” was also being included in the compiler arguments independantly of that, and I had to manually remove it. Doing so cleared the errors. I have not yet tested if it solved the underlying bug.

To answer the rest of your question,

I’m using GNU C, specifically GNU Arm Embedded Toolchain: 6-2017-q2-update. This has version 2.5 of newlib in it.

The link to FreeRTOS is that this bug manifests as a memory leak when
configUSE_NEWLIB_REENTRANT is set to 1 and a task using certain newlib functions (in my case snprintf with floats) is created and deleted.

I have a thread here: Memory Leak using snprintf with floats - #15 by hillridge

there’s also an older thread (linked via a response in mine) that covers the same issue.

Unfortunately, it looks like the root cause was never fully uncovered, just that “something” is wrong with some newlib builds provided with toolchains. I would like to both solve my immediate problem, and get to the bottom of this one if possible.

I know there are workarounds, and I’ll likely use one for other reasons, but I’d still like to understand what is causing this within newlib.