How can i use printf() in s32DS just like in CW?

Showing results for 
Search instead for 
Did you mean: 

How can i use printf() in s32DS just like in CW?

Contributor II

usually, one func "TERMIO_PutChar" could be added to realize printf() in CW,  but when in S32DS, there three error occurs when printf used.

Does S32DS support printf function?

if it does, how could i use it?

0 Kudos
3 Replies

Contributor III

Regarding using "printf" in S32DS

I attempted this with the MPC5602D processor after creating a new project using "newlib".

I still got a compile error regarding "sbrk.c" .

Subsequent research led me to change __HEAP_SIZE

from zero to 4096 in Project_Settings\Linker_Files\mem.ID

I was then at least able to get the program to build.

Apparently newlib uses memory access and requires the HEAP, so

you can't set it to zero, which appears to be the default.

FYI: In case anyone else has this same problem.

Reference:  Linker errors when using the "new" operator

0 Kudos

NXP Employee
NXP Employee

Hello  tao

Please open the project properties from <Project> menu-> Properties, then go to C/C++ Build->Settings-> Target Processor, and select ‘newlib_nano Debugger Console(-specs=nano.specs –specs=rdimon.specs)’ as Library Support.

With this library, the string of printf() will be output onto debugger console. 

Library support.png

Best Regards


0 Kudos

Contributor II

Thanks for your reply.

The problem is how could i print string via uart ?

In CW, redefine one function "TERMIO_PutChar" to one "uart_tx" function would realize it, how could i do it in s32DS.

ps: I have find one way to realize this function in keil, but i still want to know how to do it in S32DS.

only one func should be define in keil, here is the code.

int fputc(int ch,FILE *f)



      while(UART_GetFlagStatus(UART2,UART_Flag_TC)!= RESET);

      return ch;        


tao fu

0 Kudos