Version: *B
Translation - Japanese: PSoC® 4 の printf の代替関数 - KBA87093- Community Translated (JA)
Question:
The printf function consumes significant flash memory in PSoC® 4. Is there any alternate function for printf?
Answer:
The printf function is provided in the tool chain (ARM® GCC). As an alternative, use the iprintf() function provided in this KB. This function has the optimized code to implement some of the most commonly-used features of the printf function.
The iprintf() function supports only the following format specifiers:
Table 1. iprintf() Format Specifiers
%s | Array of char |
%d | Integer in decimal format |
%c | Char single character |
%x | Integer in hexadecimal format |
To test the code, follow the steps given below:
If you are using the Software UART Component (SW_Tx_UART) with the instance name SW_Tx_UART_1, then use the function SW_Tx_UART_1_PutChar() in iputc() function.