Open escherstair opened 5 months ago
Almost every SDK examples uses PRINTF macro to forward debug messages. As an example https://github.com/nxp-mcuxpresso/mcux-sdk-examples/blob/e69523c33fbf902d3e49963eca5372678efa69fc/evkbimxrt1050/freertos_examples/freertos_hello/freertos_hello.c#L65
This macro is expanded based on SDK_DEBUGCONSOLE https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/utilities/debug_console/fsl_debug_console.h#L39-L42
SDK_DEBUGCONSOLE
But when DEBUGCONSOLE_REDIRECT_TO_SDK is selected, the implementation follows this chain: PRINTF >> DbgConsole_Printf >> ... >> SerialManager_WriteBlocking https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/serial_manager/fsl_component_serial_manager.c#L1713-L1720 and then Serial_UartWrite https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/serial_manager/fsl_component_serial_port_uart.c#L287 then HAL_UartSendBlocking https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/uart/fsl_adapter_iuart.c#L327 and this falls to UART_WriteBlocking https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/drivers/iuart/fsl_uart.c#L681
DEBUGCONSOLE_REDIRECT_TO_SDK
PRINTF
DbgConsole_Printf
SerialManager_WriteBlocking
Serial_UartWrite
HAL_UartSendBlocking
UART_WriteBlocking
I would like knowing if NXP designed this kind of macro expansion so that is there an easy way to have it falling back to some functions from FreeRTOS implementation https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/drivers/iuart/fsl_uart_freertos.c
Almost every SDK examples uses PRINTF macro to forward debug messages. As an example https://github.com/nxp-mcuxpresso/mcux-sdk-examples/blob/e69523c33fbf902d3e49963eca5372678efa69fc/evkbimxrt1050/freertos_examples/freertos_hello/freertos_hello.c#L65
This macro is expanded based on
SDK_DEBUGCONSOLE
https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/utilities/debug_console/fsl_debug_console.h#L39-L42But when
DEBUGCONSOLE_REDIRECT_TO_SDK
is selected, the implementation follows this chain:PRINTF
>>DbgConsole_Printf
>> ... >>SerialManager_WriteBlocking
https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/serial_manager/fsl_component_serial_manager.c#L1713-L1720 and thenSerial_UartWrite
https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/serial_manager/fsl_component_serial_port_uart.c#L287 thenHAL_UartSendBlocking
https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/components/uart/fsl_adapter_iuart.c#L327 and this falls toUART_WriteBlocking
https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/drivers/iuart/fsl_uart.c#L681I would like knowing if NXP designed this kind of macro expansion so that is there an easy way to have it falling back to some functions from FreeRTOS implementation https://github.com/nxp-mcuxpresso/mcux-sdk/blob/78064ea443c7f4523e995e4b7f4ef8b9bfb47974/drivers/iuart/fsl_uart_freertos.c