Environment: MCUXpresso, K81 target, Segger J-Link debug probe,
Reference: MCUXpresso IDE and Semihosting
With Semihosting the printf output appears in the MCUXpresso Console, as expected. However, when I switch to UART (Quick Settings -> SDK Debug Console -> UART Console) no output is seen on the LPUART. With UART selected, no output is sent to the MCUXpresso Console, as expected.
I have checked that the SDK_DEBUGCONSOLE define is correctly set (Quick Settings -> Defined Symbols).
I have also checked that the LPUART settings (In my case this is LPUART2 on PTD2/3.) are good.
BTW, LPUART Debug output works just fine with my projects on IAR EWARM, so I know the physical HW is OK.
已解决! 转到解答。
Oops! Found the problem, it is not directly related to the routing of the debug console. It's about printf(). The code uses DEBUG_PRINT(), defined as follows:
define DEBUG_PRINT(fmt, ...) printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
I.e. it uses printf instead of PRINTF. (Only PRINTF will work as it's defined as DbgConsole_Printf)
Oops! Found the problem, it is not directly related to the routing of the debug console. It's about printf(). The code uses DEBUG_PRINT(), defined as follows:
define DEBUG_PRINT(fmt, ...) printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
I.e. it uses printf instead of PRINTF. (Only PRINTF will work as it's defined as DbgConsole_Printf)