AnsweredAssumed Answered

ConsoleIO printf problem

Question asked by Andrew Parlane on Apr 25, 2014
Latest reply on Apr 29, 2014 by Andrew Parlane



I'm new to the Kinetis family of chips, code warrior and processor expert. However am reasonably experienced in embedded software.


I'm having trouble getting printf to work on my FRDM-K20D50M board.


Setting up the Serial_LDD component to use UART0 on PTB16 and PTB17. Then using:

AS1_SendBlock(AS1_DeviceData, "hello world\n", 12);


This works fine.


I then add a consoleIO component, and try:



This doesn't work.


Stepping through it I end up in:

C:\Freescale\CW MCU v10.5\MCU\ARM_GCC_Support\ewl\EWL_C\src\stdio\printf.c


Sticking breakpoints in the generated CsIO1.c __write_console and _write functions. They are never hit.

Instead the code goes through fwrite(), with the file pointer: stdout. However I can't see anywhere that sets up stdout to point to my UART.


In addition in the generated CsIO1.c the code uses: UART1_BASE_PTR. Whereas my serial component is configured to UART0.


I noted that at the path that usses ARM_EABI_Support, there is:

C:\Freescale\CW MCU v10.5\MCU\ARM_EABI_Support\ewl\EWL_C\src\printf.c


This printf.c has a lot more code, including: printf_console, which references __write_console.


It compiles and uses this file when I select the freescale tools instead of ARM tools. However this still doesn't work, however it does get into CsIO1.c this time. It may be the UART1_BASE_PTR that breaks it here.


I'm sure I'm missing something obvious, but I just can't see it. Any ideas?