如何在STM32F10x上重新定位printf()? [英] How to retarget printf() on an STM32F10x?

查看:134
本文介绍了如何在STM32F10x上重新定位printf()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将此代码用于重新定位printf(),但它不起作用

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

#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)
#endif /* __GNUC__ */

PUTCHAR_PROTOTYPE
{
    /* Place your implementation of fputc here */
      /* e.g. write a character to the LCD */
    lcd_Data_Write((u8)ch);

      return ch;
}

我使用STM32F103RBT6

I use STM32F103RBT6

编译器:带有emBitz编辑器的GCC

compiler : GCC with emBitz editor

推荐答案

向本斯·考勒斯(Bence Kaulics)致敬

Tank you Bence Kaulics

我使用tinyprintf库,并且运行良好: github链接

I use tinyprintf library and it worked quite well : github link

这篇关于如何在STM32F10x上重新定位printf()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆