kinetis frdm-k22f printf redirection

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

kinetis frdm-k22f printf redirection

844 Views
shkim9
Contributor II

when i download kinetis sdk (via sdk generator), there is demo apps.

and default printf function in demo app's output is directed to UART1.

i want to redirect printf function to SWO output (j-link). but i can't find it.

MCUXpresso configtool has no SWO feature (peripherals)

and also SDK generator does not have it.

so, for redirect printf output to SWO,

Is there a way to generate code using the tool (MCUXpresso, SDK generator, .... ) ?
or is there any sample project using SWO ?
** IDE : IAR embedded workbench
** Debugger : J-Link SWD connection
** target board : FRDM-K22F
0 Kudos
3 Replies

695 Views
shkim9
Contributor II

SWO pin not connected.

i think if this pin is connected, it may be operate.

j-link connector

j-link.png

FRDM-K22F connector

frdm-k22f.png

0 Kudos

695 Views
BlackNight
NXP Employee
NXP Employee

That very much depends on your standard I/O library implementation.

I'm using MCUXpresso IDE 10.3.1 and it has an option to redirect printf() to SWO, see section "SWO (Single Wire Output" in New NXP MCUXpresso IDE V10.3.0 Release | MCU on Eclipse.

For IAR you could copy that code or you might use the code snippets from Tutorial: Using Single Wire Output SWO with ARM Cortex-M and Eclipse | MCU on Eclipse .

I hope this helps,

Erich

0 Kudos

695 Views
shkim9
Contributor II

thanks Erich Styger.

i try build project on MCUXpresso IDE.

as you mentioned, check redirect option and create new project.

(but, there is no "SWO" related options)

check redirect.PNG

and printf still not work.

i think the macro defined in "serial_manager.h" is wrong.

"SERIAL_PORT_TYPE_SWO" should be "1".

serial_manager.PNG

but if i change this value to "1" (and "SERIAL_PORT_TYPE_UART" are "0" ), build error occurs.

fatal error: serial_port_swo.h: No such file or directory

i can't find "serial_port_swo.h" anywhere.

it seems to be generated by MCUXpresso IDE.

Is there a better way?
** additionally, Kinetis SDK has no "serial_port_swo.h" file.
The figure below shows the sdk directory. There is no "serial_port_swo.h".
kinetis sdk.png
thanks.
0 Kudos