全球最实用的IT互联网信息网站!

AI人工智能P2P分享&下载搜索网页发布信息网站地图

当前位置:诺佳网 > 电子/半导体 > 控制/MCU >

瑞萨RA单片机在e2 studio环境下printf编译出错的问题

时间:2025-05-24 15:51

人气:

作者:admin

标签: 瑞萨    Printf  单片机  studio 

导读:最近看到有一些网友在讨论关于:瑞萨RA单片机在e2 studio环境下printf编译出错的问题。...

来源:strongerHuang

最近看到有一些网友在讨论关于:瑞萨RA单片机在e2 studio环境下printf编译出错的问题。

这个问题我之前也遇到过,今天就来分享一下我得出的解决办法。

问题点:在e2 studio集成开发环境下,使用串口printf打印时,会类似出现一个这样的错误:

C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/thumb/v8-m.main+dp/hardlibg_nano.a(libc_a-closer.o):infunction `_close_r'(.text._close_r+0xc): undefined reference to `_close'
C:/Renesas/RA/e2studio_
-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/thumb/v8-m.main+dp/hardlibg_nano.a(libc_a-lseekr.o):infunction `_lseek_r'(.text._lseek_r+0x10): undefined reference to `_lseek'
C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/thumb/v8-m.main+dp/hardlibg_nano.a(libc_a-readr.o):infunction `_read_r'(.text._read_r+0x10): undefined reference to `_read'
C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/thumb/v8-m.main+dp/hardlibg_nano.a(libc_a-fstatr.o):infunction `_fstat_r'(.text._fstat_r+0xe): undefined reference to `_fstat'
C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:C:/Renesas/RA/e2studio_v2024-10_fsp_v5.6.0/toolchains/gcc_arm/13.2.rel1/bin/../lib/gcc/arm-none-eabi/13.2.1/thumb/v8-m.main+dp/hardlibg_nano.a(libc_a-isattyr.o):infunction `_isatty_r'(.text._isatty_r+0xc): undefined reference to `_isatty'
collect2.exe: error: ld returned1exit status
make:***[makefile:96:RA8D1_DEBUG.elf]Error1


BuildFailed.6errors,0warnings. (took 190ms)
左右滑动查看全部

3cf91000-2a2f-11f0-9310-92fbcf53809c.png

网上最多的解决办法

在这个路径下:

项目->C/C++Project Settings->C/C++构建->设置->GUU ArmCrossC Linker->Miscellaneous


左右滑动查看全部

勾选【Use float with nano printf (-u _ printf float)】这个选项,并清空【Other linker flags】里面的内容。

3d3258ba-2a2f-11f0-9310-92fbcf53809c.png

但是,在e2 studio V5版本(比如:V5.6.0)环境下,这个解决方法“失效”了,编译还是会出现【错误】。

网上又有了一种解决办法

在同样的路径下,勾选【Do not use syscalls (--specs=nosys.specs)】这个选项,如下图:

3d5602e2-2a2f-11f0-9310-92fbcf53809c.png

这样,确实能解决【编译出错】的问题,也能正常printf打印输出。

但会出现【警告】,如下图:

3d71fbe6-2a2f-11f0-9310-92fbcf53809c.png

还有一种最理想的解决办法

这个办法不会错误,也不会警告,也是我在用。那就是在同样的路径下,【Other linker flags】这里添加:

--specs=rdimon.specs

3d9e7130-2a2f-11f0-9310-92fbcf53809c.png

警告这样的配置之后,编译就会:0错误,0警告。

3dbb648e-2a2f-11f0-9310-92fbcf53809c.png

这里的配置,在e2 studio以前的老版本是默认的,但这后面的版本,这里的配置默认是“空”了,我也搞不懂为啥。

这个解决办法在网上不容找到,我找到了一个地方:

https://community.renesas.com/mcu/ra/f/forum/32521/fsp5-0-0-cannot-print-data-to-uart-by-redirecting-printf

3dcc1324-2a2f-11f0-9310-92fbcf53809c.png

以上三种解决办法,推荐用最后一种。

本文就分享到这里,希望对你有所帮助。

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信