Hi,
I am trying to use sprintf with.
K64 freedom board.
REDLIB nohost.
every time i try to use sprintf i see a hard fault.
I did not find a place to change the heap, do i have to change it? increase?
I get no error when compiling the project and everything else is working so far.
(void)sprintf(distance,"%s\r\n",_distance);
What version of MCUXpresso IDE are you using?
I've just tried a simple sprintf example on K64 (based on http://www.cplusplus.com/reference/cstdio/sprintf/?kw=sprintf) with the current MCUXpresso IDE v10.2, and all seems to be OK.
It might be worth stepping through your code at the instruction level to try to work out what is triggering the hard fault.
In particular how are "distance" and "_distance" defined in your example? I suspect you might be passing the buffer rather than a pointer to the buffer into your sprintf call
If you are still having problems, can you use the Quickstart Panel 's "Export project to archive" option" and post an example project that replicates the problem?
Regards,
MCUXpresso IDE Support
Thank you.
Yes it was my mistake, my buffer was too short.
now everything is working.