zephyr: logging: 32 bit float values don't work.
Code
float x = 1.234f;
printf("this is a 32 bit float %f\n", x);
LOG_INF("this is a 32 bit float %f", x);
Output
***** Booting Zephyr OS build v2.0.0-rc1-50-g70640334730b ***** … this is a 32 bit float 1.234000 [00:00:00.008,000] <inf> ggm.main: this is a 32 bit float 0.000000
Notes CONFIG_LOG_ENABLE_FANCY_OUTPUT_FORMATTING=y This uses the minimal libc print formatter for the log messages. The print formatter works for float formatting when invoked via printf, suggesting that the float value is somehow being clobbered in the log functions.
Environment
- OS: Linux
- Toolchain: gcc-arm-none-eabi-8-2018-q4-major
- Board: mimxrt1020_evk
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 17 (7 by maintainers)
Commits related to this issue
- applications: asset_tracker_v2: Use deferred logging v2 Use deferred logging v2. After the change to deferred logging, floats were not properly printed anymore. This patch fixes this issue by using ... — committed to simensrostad/fw-nrfconnect-nrf by simensrostad 3 years ago
- applications: asset_tracker_v2: Use deferred logging v2 Use deferred logging v2. After the change to deferred logging, floats were not properly printed anymore. This patch fixes this issue by using ... — committed to nrfconnect/sdk-nrf by simensrostad 3 years ago
@manoj153 please check if float formatting is enabled in cbprintf
CBPRINTF_FP_SUPPORT.