Have been worked a few projects with KDS and MCUXprosso, and currently using MCUXpresso 11.1.1 and Kinetis SDK 2.7, I found myself still having problems on how to use printf() to send data to a UART console.
There are three ways to configure a project regarding printf() to UART console
- Create a new project from Quickstart Panel -> Create or import a project -> New project
- Change the configuration from Quickstart Panel -> Miscellaneous -> Quick Settings>>
- Make changes on Project -> Property -> C/C++ Build -> Settings -> Tool Settings -> Preprocessor
It is convenient to have multi-places for some key configurations, but it is confusing as well. For instance, you could have identical Preprocessor settings but projects behave in different ways.
Here is the procedure to create a project with printf() which I have had problem with. And I cannot find any solid information on how to use standard IO library printf for uart console in MCUXpresso configuration.
Step 1 – Create a new project from MCUXpresso Quick Panel

Step 2 - Choose right SDK software components
case 1:

case 2:

In my case, since I just use UART for connecting to Tera Term VT100 screen, so I simply do:
1. Select FreeRTOS
2. Select all Drivers
3. Select all CMSIS Drivers
4. On Utilities, I have done two ways:
(1). Select none
(2). Select Serial manager shown above
Step 3 - Advanced configurations (tried multi cases, got the same result)
case 1: use Redlib (nohost)

case 2: use NewlibNano (nohost)

Step 4 - Check the configurations from Project Property

It is confusing that the UART is not selected as I have done so in Step 2, but it can be reconfigured.

I checked the configuration from Quicksettings, and it is correct here.
Step 5 - Run the project and see the result

Result: printf() did not send anything to the UART (without set SERIAL_PORT_TYPE_UART=1).
"MCUXpresso & Kinetis K64 MCU" shown in the console captured in the screenshot below is done by UART_WriteBlocking() for checking UART configuration.
Step 6 - Modify Preprocessor by adding SERIAL_PORT_TYPE_UART=1, and run the project and see the same result

Result is the same.
The UART can be read or written properly with other functions, but printf() cannot route information to the UART, and I have tried with different configurations and I am unable to make it work.
The way I have made printf() work properly on UART/TeraTerm is via semihosting, which I not sure why I have to do that.
A project working properly should look like:


What did I miss here?
Thanks.