Alternate for sprintf in PSoC 4 | Cypress Semiconductor
Alternate for sprintf in PSoC 4
As you may know, PSoC 4 has limited flash when compared with PSoC 3 and PSoC 5LP. Using the GCC print and sprintf functions takes up ~30k of flash, which easily overflows PSoC 4’s flash space.To avoid this, we have developed the tinyprintf component and an example project showing its use.
The component supports d, u, c, x, X, and s formats. This component uses an open source printf solution created by Spare Time Labs 2.0. DRSW found this implementation on github. You can find the source at https://github.com/cjlano/tinyprintf. The solution is distributed under the BSD license. This basically means that the solution is to be taken as is and the author is not responsible under any circumstances for its use.
The project builds with 1656 bytes flash used with the UART and tinyprintf components initialized. With all the examples the project takes 3912 bytes of flash.