IDE: MCUXpresso IDE v11.0.1 [Build 2563] [2019-09-01]
Platform: MIMXRT1020-evk eval board
What do I need to do to get std::cout and printf output to go down the USB serial UART connection please (instead of to the semihost MCUXpresso console tab)?
I created a fresh new C++ project (zipped and attached):
New C/C++ Project
Select C++ Project
Leave everything else default.
Then in the main() function in source/MIMXRT1021xxxxx_Project.cpp:
// In UART mode, PRINTF output is seen on the USB serial port (TeraTerm)
// In semihost mode, PRINTF output is seen in the MCUXpresso Telnet Console tab.
PRINTF("Hello World from PRINTF\r\n");
// PROBLEM: In UART mode, printf and cout output is _not_ seen on the USB serial port (TeraTerm) or the MCUXpresso Telnet Console tab.
// In semihost mode, printf and cout output is seen in the MCUXpresso Telnet Console tab.
printf("Hello word from printf\r\n");
std::cout << "Hello world from std::cout\r" << std::endl;
Then build and debug as normal, but:
SDK Debug Console
Try both Semihost console or UART console, which seem to just set SDK_DEBUGCONSOLE to 0 or 1 respectively.
I cannot see any output on the USB port for the printf/cout calls when in UART mode.
In semihost mode PRINTF/printf/cout output is seen in the MCUXpresso console tab.
* if SDK_DEBUGCONSOLE defined to 0,it represents select toolchain printf, scanf. <-- In this case PRINTF = printf
* if SDK_DEBUGCONSOLE defined to 1,it represents select SDK version printf, scanf. <-- In this case PRINTF = DbgConsole_Printf
* if SDK_DEBUGCONSOLE defined to 2,it represents disable debugconsole function.
So how do we get std::cout/printf calls to go out through the USB/UART please?
I am especially interested in std::cout although I suspect either both work or both don't.