Retargeting printf in a baremetal project to use a UART

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

Retargeting printf in a baremetal project to use a UART

Jump to solution
1,814 Views
oscargarciaabad
Contributor III

Hello all,

 

I'm developing a new project with a FRDM-KL46Z. In this project I am using no O.S.

This project is under kinetis design studio 1.1.1.

 

Does anybody know how can I make printf to use a UART for printing?

 

Thanks a lot!

 

Regrads,

 

Oscar.

Labels (1)
0 Kudos
Reply
1 Solution
1,249 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Oscar:

Colleague Erich Styger posted a tutorial about this in his blog. It is for KDS v1.0.1 Beta, but I think it should apply for version v1.1.1:

printf() and scanf() with GNU ARM Libraries | MCU on Eclipse


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
1,249 Views
oscargarciaabad
Contributor III

Hello Edriano and Jorge,

First of all: Many thanks for your help.

Edriano, I'm afraid that inizialization in KDS 1.1.1 works diferent.

Jorge, your solution works fantastic!

Best regards,

Óscar.

0 Kudos
Reply
1,250 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Oscar:

Colleague Erich Styger posted a tutorial about this in his blog. It is for KDS v1.0.1 Beta, but I think it should apply for version v1.1.1:

printf() and scanf() with GNU ARM Libraries | MCU on Eclipse


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,249 Views
Edrianocarlos
Contributor IV

Hi.

I am using FRDM64. but i think it will be similar.

You can starting looking at.

hardware_init.c

void dbg_uart_init(void)

{

    uint32_t i;

    /* enable clock for PORTs */

    for (i = 0; i < HW_PORT_INSTANCE_COUNT; i++)

    {

        CLOCK_SYS_EnablePortClock(i);

    }

    configure_uart_pins(BOARD_DEBUG_UART_INSTANCE);

    DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUD, kDebugConsoleUART);

}

then you can take care the UART configurations. Most of then are in the Board folder.