Please make sure you are using a C++ project for this since the linker file for this is different from the one used for C projects and it has a runtime heap defined.
sprintf() internally calls _sbrk(), the definition of this can be found in the cyfxcppsyscall.cpp file inside the BulkLoopAutoCpp project in the SDK. Include this definition in your code.
hi, Do not do what you want in the following function? CyU3PDebugStringPrint You mean, do you need the support of the number of floating-point format? I'm sorry I was wrong. I'm sorry. This English is machine translation. Thanks
If you're suggesting to use CyU3PDebugStringPrint, then that's not working for me. I need the formatted string in a buffer, not output to a UART.
I actually 'fixed' it by implementing the _sbrk function in my own code.
The _sbrk function is supposed to extend the heap .. I didn't think that would ever by necessary in my case, so I just log a warning whenever the function actually gets called, and return an error code (-1).
Turned out that function indeed never gets called (again: in MY case). But by having it there, it fixes my build problem.
Notice, btw, that this was actually mentioned in the Errata sections of the FX3's datasheet.
apiRetStatus = CyU3PDebugStringPrint((uint8_t *)buffer, 256, (char *)format, args); This is accommodated formatted string in the buffer. not output to the UART. This is similar to the name in the function to be output to the UART. e.g. CyU3PDebugPrint(4, buffer);