[方案相关] 使用printf

[复制链接]
1461|3
 楼主| mickit 发表于 2024-9-20 20:00 | 显示全部楼层 |阅读模式


  1. #if defined (__CC_ARM)          //KEIL
  2. #pragma import(__use_no_semihosting) //取消ARM的半主机工作模式
  3. void _sys_exit(int x) //定义_sys_exit()以避免使用半主机模式
  4. {
  5.     x = x;
  6. }
  7. struct __FILE //标准库需要的支持函数
  8. {
  9.     int handle;
  10.     /* Whatever you require here. If the only file you are using is */
  11.     /* standard output using printf() for debugging, no file handling */
  12. /* is required. */
  13. };
  14. /* FILE is typedef?d in stdio.h. */
  15. FILE __stdout;

  16. #endif


yangxiaor520 发表于 2024-9-21 09:12 来自手机 | 显示全部楼层
printf函数实现一是重定义putc函数,二是自己通过钓鱼C语言的格式化字符串函数来实现
shenxiaolin 发表于 2024-9-29 10:41 | 显示全部楼层
需要重定向
更多更合适ii 发表于 2024-9-30 17:26 来自手机 | 显示全部楼层
struct __FILE //标准库需要的支持函数
您需要登录后才可以回帖 登录 | 注册

本版积分规则

89

主题

1560

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部