I am having problem in getting "vfprintf" provided by the NewLib library working on a multi-tasked environment based on the FreeRTOS running on a NXP K64 ARM Cortext-M4 processor.
The code is compiled using arm gcc compiler.
The FreeRTOS is configured to have the configUSE_NEWLIB_REENTRANT switch enabled.
I have provided the _write_r system call so eventually data will be passed on to the one of the MCU's UARTs.
A hard-fault exception is triggered in __sfvwrite_r when accessing the "fp->_p". In this case fp is the stderr which is assigned to xNewLib_reent.__sf[2] by default.
The default value of xNewLib_reent.__sf[2]._p pointer is NULL and is not allocated anywhere else.
Any advise on this regard is highly appreciated.
Update: In the hard fault ISR I extract PC from stack frame and by checking the assembly view in my debugger (i.e. Eclipse CDT stand alone debugger) I can see that it is crashing when dereferencing the _p pointer.