Hi!
Is it possible to use printf() through the OpenSDA debugger back to console?
Like the MCU outputs printf() data through SWD to OpenSDA debugger, and from there back to the console of S32 Design Studio.
I'm using S32K144EVB, and would like it to function in real time with running application, not using LPUART, and no SDK.
Thank you.
Hi,
for me the prontf() is working as you describe her using debugger. I can see the outputs with the debug session. When I disconnect from target it will stop (caused by printf). Also it does not run standalone afterwards. Is there a solution for that: having printf() in the running code without console? Why it is not running when printf() used?
br
Hi,
you are correct. This is printf functionality for debug purposes and technically the output is done by debug probe.
You can use UART for printf to some terminal (minicom, putty, RealTerm...).
Here are examples for printf via UART:
EXAMPLE: S32k144 UART printf/scanf under FreeRTOS - S32DS
https://community.nxp.com/docs/DOC-333788
Jiri
Hi,
printf() via OpenSDA is working - but the OpenSDA USB is acting as Virtual COM port and you need to use LPUART1 for that.
Other possibility is print to Debug Console (in S32DS). For that you need to link new_lib or ewl lib with I/O support.
Jiri
Thanks for your response Jiri!
So when the lib's are untouched (not linked), a printf() will put the data out on the MCU's LPUART1?
Don´t really understand which "way" the data takes when you use your second alternative and link the lib, is it the PC generating the data from the program just within S32DS, or is it the MCU which send it back in some way?
Do you have an example how to link the lib in S32DS?
Great thanks!
/Chris
Hi,
if you are okay with debug console only - just switch in project properties your actual c library from no I/O version to version which supports debug console:
Otherwise you need to implement read_console/write_console functions. For reference you can look at this example:
https://community.nxp.com/docs/DOC-335240
Jiri
Hi,
you can use NewLib (or NewLib_nano) with debugger console support.
Hello Jiri,
this topic describe exactly what I want to do using S32 design studio and a sample project out of it. When I configure the library support as you described, I need to include stdio.h in the main. Then it compiles and I can flash. But the debugger shows me, the program is running in a SW trap deep inside the printf. So it brakes. Any ideas?
Hi,
I forgot also mention that together with C lib supporting debug console you also need to enable semihosting console in debug session settings:
The printf output you can see in console:
Hope it helps.
Jiri
Hi Robert,
well - SW trap may be caused by many things. Can you share your project?
Jiri
Ok.
Maybe I miss some basics here, but which "way" does the data from printf() take when you choose a lib with "Debugger Console I/O"?
Is it the PC that runs the S32DS which generating the data from the program just "within" S32DS, or is it coming from the MCU which send it back in some way?
/Chris
Hi,
C lib with I/O supports has implemented printf functionality - you can see output in S32DS debug console. The data are from MCU and send via JTAG/SWD -> PE Micro(OpenSDA) to PC. Yon need to have active S32DS debug session.
Jiri