NRF Connect SDK: when using newlibc, floats and doubles not printed by printf

I would like to use newlibc for access to math functions (logf). However, when I enable newlibc I can't get floats or doubles to print with printf when compiling for the nrf52840dk_nrf52840. It does work for native_posix.

My test program:

#include <zephyr.h>
#include <stdio.h>

void main(void)
	int i = 123;
	double d = (double)i;
	printf(" i: %d; d: %.3f end\n", i, d);



When I build and run as native_posix I get the expeced output:

source ~/ncs/zephyr/
west build -d /tmp/ -b native_posix
west build -t run -d /tmp/

*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
 i: 123; d: 123.000 end.

When I build and run as nrf52840dk_nrf52840, printf prints a blank for the double:

 source ~/ncs/zephyr/
 west build -d /tmp/build.t -b nrf52840dk_nrf52840
 west flash -d /tmp/build.t
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
 i: 123; d:  end.

If I don't use newlibc, I get the expected output. Is there another way to get the math functions that I haven't discovered?


~/ncs/nrf$ git reflog
290c67a38 (HEAD, tag: v1.7.1, origin/v1.7-branch) HEAD@{0}: clone: from

Zip file of project:


Jan Erik