Forum : ARM
Original Post
| Post Information | Post |
|---|---|
|
September 2, 2008 - 2:35am
|
I've noticed something strange while using small printf for an STM32. If the string I want to print ends with a '\n' newline character everything is fine but otherwise the size of the hex file blows out. e.g. printf("xxx\n"); This leaves my hex size at 23.3KB printf("xxx"); This leaves my hex size at 60.4KB I assume this is because for some reason small printf can't handle it and substitutes the full printf function instead? Or have I done something stupid? Here's the putchar stuff: #ifdef __GNUC__
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
set to 'Yes') calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endifPUTCHAR_PROTOTYPE
{
/* Write a character to the USART */
USART_SendData(USART2, (u8) ch);
/* Loop until the end of transmission */
while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET)
{
}
return ch;
}
|