AnsweredAssumed Answered

Newlib-nano with _REENT_SMALL

Question asked by SCOTT MILLER on May 28, 2018

Since my build environment seems to be causing no end of trouble with MCUXpresso, I've started over with a fresh, vanilla install of MCUX 10.2.0 and removed Processor Expert from my projects and just kept the generated code.


It's been more stable, but my main problem now is getting newlib-nano working right.  The version included with MCUX doesn't seem to support the _REENT_SMALL option.  I'm using newlib-nano for the sake of thread-safe standard functions like malloc(), but the default reent setup wastes a huge amount of RAM for each FreeRTOS task.  _REENT_SMALL cuts that down by quite a bit and I've been using it successfully until now.


With MCUX's version, I get unresolved references for __sf_fake_stderr, __sf_fake_stdin, and __sf_fake_stdout when tasks.c compiles.  That's coming from reent.h, which expects stubs of file handles to be declared elsewhere.  Hoping that maybe that was all that was missing, I added the constants to my own code but that just gives me a hard fault at setvbuf().  I'm guessing that's because the reent structure is mismatched between the headers and the compiled libraries.


I'm now a couple of hours into trying to rebuild newlib-nano, which is not a smooth process on Windows.  Assuming I do get it to work, it's still going to mean departing from the standard MCUX setup, which is what I've been trying to avoid with this whole exercise.


Is there another way I should be going about this?