Hi,
I'm using S32K144 and want to use printf/scanf functions for testing purpose. I want to print some data on UART terminal (Teraterm).
To use printf function EWL library is used but while creating new S32DS project there is no option to select library. Also there is no option to select EWL library in project properties->settings->Target Processor.
Can I use printf/scanf without EWL library? Is there any other way to print data on UART terminal.
I'm using,
S32DS v3.5
Toolchain - NXP GCC 10.2 for Arm 32-bit bare metal
Hi @jiri_kral
I don't want to use semihosting console, I want to print data on debugger console. But there is no option for ewl_c Debugger console library in project settings (properties->settings->Target Processor->Libraries Support).
Please guide me with this.
Hi,
EWL C Library is not supported by S32DS v3.5. But both STD C libraries are using the same Debug output to Semihosting Console (which is different name for Debugger Console).
Or what you mean by Debugger Console?
The right NewLib version is this one:
Hello,
Thank you for your response; however, if the EWL library is not supported for S32DS V3.5, could you suggest any other solution to the same query?
and When I try to create a new project, the SDK is not available for that toolchain.
I am using
S32DS v3.5
Toolchain: NXP GCC 10.2 for Arm 32-bit bare metal
Hi @jiri_kral,
I'm using S32K144 and want to use printf/scanf functions for testing purposes. I want to print some data on UART terminal (Teraterm).
As per your response, I am trying to make a setting in S32DS, but these options
(newlib semihosting v2 (-specs=rdimon-v2.mspecs)) is not available in Project→properties→Setting→Target Processor.
I'm using,
S32DS v3.5
Toolchain - NXP GCC 6.3 for Arm 32-bit bare metal
Please guide me with this
Hi,
I already answered you question a month ago:
Best way is start with an UART example and use newlib no I/O.
In details - if you call printf/scanf from STD C library (newlib no I/O) the output of both functions is calling _write or _read function which is by default empty. You need to implement both functions - inside _write function you need to send buffer passed through _write function into UART, for scanf you copy buffer read from UART to pointer passed by _read function.
There is nothing special about it - check the example linked in some previous post.
Hi,
okay, I see. For this you need to use NewLib with no I/O support and implement _read and _write functions as described in post bellow - https://community.nxp.com/t5/S32K/Not-able-to-use-printf-scanf-functionality-in-S32DS/m-p/1875490/hi...
Hi @jiri_kral
It will be helpful if you can share example project in which NewLib with no I/O support library is used for printf (to print on UART).
Hi,
I don't have such example project. You can simply use some existing UART example and implement _write and _read functions by the same way as it is in Example shared with the previous link.
Hi,
for printf/scanf via UART you need to implement
int _write(int handle, char * buffer, int * count)
int _read(int handle, char * buffer, int * count)
Functions and use NewLib no I/O std C library. Here is example for EWL library - the difference is only in read/write function name - https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/EXAMPLE-S32k144-UART-printf-scanf-unde...
If you are okay with Semihosting Console, you can link to your project NewLib_Semihosting:
Hello @jiri_kral
I referred your code for UART testing, when I try to print data using the printf function, the program does not jump to the write_console function in the console.c.
I have attached my code. Please guide me further.
S32DS version 3.5
NXP GCC 10.2 toolchain for Arm 32-bit bare metal
Hello, @jiri_kral.
I'm using my old project (S32DS version 3.5 with NXP GCC 6.3 for Arm 32-bit bare metal, which supports the EWL library) to print data on URAT.
In which the program jumps into the write_console function (console.c) after calling printf and able to print data on UART.
When I'm using your code (S32DS version 3.5 with NXP GCC 10.2 for Arm 32-bit bare metal) to print data on UART, program does jumps into the write_console function (console.c) after calling printf.
I've attached my codes. Please guide me further.