Not able to use printf/scanf functionality in S32DS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to use printf/scanf functionality in S32DS

283 Views
emb02
Contributor IV

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.

S32 create proj.PNG

Screenshot (63).png

 

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

0 Kudos
7 Replies

242 Views
emb02
Contributor IV

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.

 

0 Kudos

240 Views
jiri_kral
NXP Employee
NXP Employee

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: 

jiri_kral_0-1716808943545.png

 

0 Kudos

221 Views
emb02
Contributor IV
HI,
I want to use real serial port of the MCU not serial console.
I've used mentioned newlib Semihosting library but not able to print data on UART terminal.
0 Kudos

204 Views
jiri_kral
NXP Employee
NXP Employee

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...

0 Kudos

176 Views
emb02
Contributor IV

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).

0 Kudos

173 Views
jiri_kral
NXP Employee
NXP Employee

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. 

0 Kudos

244 Views
jiri_kral
NXP Employee
NXP Employee

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:

jiri_kral_0-1716805001596.png

 

0 Kudos