Using WSL2, NCS 2, VSCode.
I tried to snprintf("%ull\n", (uint64_t)5) but I only see "ul" printed to the screen.
Here are the relevant prj.conf values
Using WSL2, NCS 2, VSCode.
I tried to snprintf("%ull\n", (uint64_t)5) but I only see "ul" printed to the screen.
Here are the relevant prj.conf values
Hi,
I found this stackoverflow article saying that the "lu" print can be from newlib nano:
Try to set CONFIG_NEWLIB_LIBC_NANO=n.
Remember to check if this configuration will have other side-effects on your project.
Regards,
Sigurd Hellesvik
That didn't fix it, and that parameter doesn't appear to be in effect anyway with the parameters I chose above.
What else can I do?
Thanks.
Here is a sample where I print an uint64_t.
Does it help?
Regards,
Sigurd Hellesvik
I see you're using the same prj.conf parameters as me, and then you do a printf with the "%llu" parameter (I had mistakenly wrote "%ull" before).
I can't tell if your printf works or not because my system isn't set up to redirect printf to UART. I'd actually like to be able to do that, though, do you know what I need to do to set that? I'm very unclear on how the various backends work.
I'm dimly aware that implementing a _write() function, under some circumstances, intercepts the bytes sent to stdout.
I have a full personal logging system that sends all of its data to UART0. I could easily send whatever was meant for stdout to that.
How can I do that? Then I'll be able to test the printf.
All the prj.conf values that affect output I have below here. Please let me know!
# I want serial enabled in general CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_1_INTERRUPT_DRIVEN=y CONFIG_UART_ASYNC_API=y CONFIG_UART_LINE_CTRL=y # I want logging to function CONFIG_LOG=y # I want to use the serial interface for logging # but when I enable shell, this makes printf'd material come out twice, # once normally, and another time with the shell prefix. # so I'm disabling it for now. # CONFIG_LOG_BACKEND_UART=y # I want synchronous logging (no queue and print later) CONFIG_LOG_MODE_IMMEDIATE=y # I want to be able to influnce what gets logged at runtime (via shell) CONFIG_LOG_RUNTIME_FILTERING=y # I want the default to be that every module prints all levels # 0 = off # 1 = error # 2 = error and warning # 3 = error and warning and info # 4 = error and warning and info and debug CONFIG_LOG_DEFAULT_LEVEL=4 # show function name in output CONFIG_LOG_FUNC_NAME_PREFIX_ERR=y CONFIG_LOG_FUNC_NAME_PREFIX_WRN=y CONFIG_LOG_FUNC_NAME_PREFIX_INF=y CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y # color it CONFIG_LOG_BACKEND_SWO=y CONFIG_LOG_BACKEND_SHOW_COLOR=y # redirect printk to the log # I am disabling this, because when shell enabled, prink output was # prefixed with shell. now I see it on serial with no prefix. #CONFIG_LOG_PRINTK=y # ##### Shell ##### # # I want the shell interface to operate CONFIG_SHELL=y
Thanks!
Nevermind about printf, I found out how to do it:
(there's a re-entrant version _write_r() I also implemented)
Anyway so I can intercept printf output now, and I still see it's not working.
Do you see snprintf working for you? That is actually what I want to get working.
What is the best way to track down what's not working here?
Thanks!