Hello,
I would like to print signed long long int (s64_t ) values using printk or printf.
I tried some suggestions I found online %lli , %lld but they did not work.
Please advise.
Thank you.
Kind regards
Mohamed
Hello,
I would like to print signed long long int (s64_t ) values using printk or printf.
I tried some suggestions I found online %lli , %lld but they did not work.
Please advise.
Thank you.
Kind regards
Mohamed
Hi,
With ncs v1.5.0-rc1 (with minimal lib c), it should print 64 bit numbers using printk(). I added this to the hello_world sample:
int64_t long_num = 0x10000000000; printk("%lli\n", long_num);
And it prints:
Hello World! nrf9160dk_nrf9160 1099511627776
Which tag are you on?
Kind regards,
Håkon
Which tag are you on?
I am not sure which tag you are referring to.
Good morning Hakon,
Correct me if I am wrong but I think printk() does not handle float well and this is the reason I included
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
Kind regards
Mohamed
Good morning Mohamed,
If you use newlib c, those needs to be set in order to use printf() with floats. printk needs "CONFIG_CBPRINTF_FP_SUPPORT" for float.
In the case of minimal libc, you should include "CONFIG_MINIMAL_LIBC_LL_PRINTF" to allow 64 bit printing.
Kind regards,
Håkon
Hi Hakon,
I am getting rather confused with what lib to use for what purpose .
I need to be able to print all types of values including float, intx_t int64_t etc... So, which lib should I be including?
Thank you.
Kind regards
Mohamed
Hi,
Learner said:I need to be able to print all types of values including float, intx_t int64_t etc... So, which lib should I be including?
I would recommend that you setup a project that prints the types you want to print, via printk() and/or printf(), then set your local project configuration wrt. each standard libc, and see which one fits your needs.
Kind regards,
Håkon
Thank you Hakon.
Thank you Hakon.