How to retarget printf() on an STM32F10x?

前端 未结 4 1168
迷失自我
迷失自我 2021-01-23 23:19

I use this code for retarget printf(), but it does not work

#ifdef __GNUC__
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->         


        
4条回答
  •  梦毁少年i
    2021-01-23 23:33

    just make sure to add the following in the init code:

    // Turn off buffers, so I/O occurs immediately
    setvbuf(stdin, NULL, _IONBF, 0);
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);
    

提交回复
热议问题