Mbed 6.2 无法打印浮点数的解决方法

Mbed 真的好诡异,到了6.2 版本,浮点数打印都不出来了。幸亏网络分享:

https://forums.mbed.com/t/float-printf-doesnt-work-in-desktop-version/9164

     为了减少代码大小,Mbed引入了最小的printf和snprintf 5。从Mbed OS 6.0开始,默认情况下启用它。仅当minimal-printf-enable-floating-pointconfig设置为true(默认情况下禁用)时,浮点参数才存在。如果您的应用程序需要更高级的功能(以使用更多的闪存为代价),您可以切换到标准的printf库,需要在mbed_app.json文件中对其进行配置:

    "target_overrides": {
        "*": {
            "target.printf_lib": "std"
        }
    }

加上这一条,OK了。 

猜你喜欢

转载自blog.csdn.net/yaojiawan/article/details/108378122