Trouble printing floats in the new sdk

In porting from Zephyr SDK to device_sdk I’m having trouble print floats.
The code below works properly in the Zephyr SDK but gives the output below in in the firmware-sdk.

printk("\"int1\":%i,\"float1\":%3.02f\n",123,456.78);
"int1":123,"float1":%3.02f

I have all the right newlib entries in prj.conf

build/zephyr/.config:2386:CONFIG_NEWLIB_LIBC_SUPPORTED=y
build/zephyr/.config:2393:CONFIG_NEWLIB_LIBC=y
build/zephyr/.config:2398:CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=2048
build/zephyr/.config:2399:CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

Any ideas?

Hey John,

Add CONFIG_CBPRINTF_FP_SUPPORT=y to the project configuration. More information about formatted output can be found here.

That works for me. I saw references to that but it only looked like it applied to cbprintf, not printk. How many of the CONFIG_NEWLIB lines above do I need and why did this break with the new SDK?

You can leave all CONFIG_NEWLIB lines in the project configuration. If CONFIG_CBPRINTF_FP_SUPPORT wasn’t explicitly listed in the application configuration when you were using Golioth Zephyr SDK, that would mean other configuration files introduced it to your application. CONFIG_CBPRINTF_FP_SUPPORT is used only in the RCP example in both Zephyr SDK and Firmware SDK.

Yes, I confirmed that it is set using 0.7.1 but is not in 0.10.0 with a very similar config. I debugged it to several shells I turned off and then isolated it to CONFIG_SENSOR_SHELL=n.
That shell must enable CONFIG_CBPRINTF_FP_SUPPORT.

We can close this. Thanks for your support.