Acutally not only sprintf, there are some other functions have same issue.
I implement sprintf, sscanf, etc in my source code, but get multiple definition error below while linking:
You simply override them by defining functions with identical functional definition. If they are defined WEAK in the standard library they will be overridden, otherwise they are overridden on a first resolution basis so so long as your implementation is passed to the linker before the library containing the original printf definition is searched, it will override. Moreover .o / .obj files specifically are used in symbol resolution before .a / .lib files, so if your implementation is included in your project source, it will always override.
WEAK
But in your platform, if printf() of the original library is not defined with __WEAK property, you may not override it.
Maybe some useful piece of information from https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes :"weak The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code, though it can also be used with non-function declarations. Weak symbols are supported for ELF targets, and also for a.out targets when using the GNU assembler and linker. "