2 * Copyright 2017 - 2019 NXP
\r
3 * All rights reserved.
\r
6 * SPDX-License-Identifier: BSD-3-Clause
\r
8 #ifndef _FSL_DEBUG_CONSOLE_CONF_H_
\r
9 #define _FSL_DEBUG_CONSOLE_CONF_H_
\r
11 /****************Debug console configuration********************/
\r
13 /*! @brief If Non-blocking mode is needed, please define it at project setting,
\r
14 * otherwise blocking mode is the default transfer mode.
\r
15 * Warning: If you want to use non-blocking transfer,please make sure the corresponding
\r
16 * IO interrupt is enable, otherwise there is no output.
\r
17 * And non-blocking is combine with buffer, no matter bare-metal or rtos.
\r
18 * Below shows how to configure in your project if you want to use non-blocking mode.
\r
19 * For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols".
\r
20 * For KEIL, click "Options for Target…", define it in "C/C++->Preprocessor Symbols->Define".
\r
21 * For ARMGCC, open CmakeLists.txt and add the following lines,
\r
22 * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING")" for debug target.
\r
23 * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING")" for release target.
\r
24 * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C
\r
25 * Complier->Preprocessor".
\r
28 #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
\r
29 /*! @brief define the transmit buffer length which is used to store the multi task log, buffer is enabled automatically
\r
31 * non-blocking transfer is using,
\r
32 * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
\r
33 * If it is configured too small, log maybe missed , because the log will not be
\r
34 * buffered if the buffer is full, and the print will return immediately with -1.
\r
35 * And this value should be multiple of 4 to meet memory alignment.
\r
38 #ifndef DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN
\r
39 #define DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN (512U)
\r
40 #endif /* DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN */
\r
42 /*! @brief define the receive buffer length which is used to store the user input, buffer is enabled automatically when
\r
43 * non-blocking transfer is using,
\r
44 * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
\r
45 * If it is configured too small, log maybe missed, because buffer will be overwrited if buffer is too small.
\r
46 * And this value should be multiple of 4 to meet memory alignment.
\r
49 #ifndef DEBUG_CONSOLE_RECEIVE_BUFFER_LEN
\r
50 #define DEBUG_CONSOLE_RECEIVE_BUFFER_LEN (1024U)
\r
51 #endif /* DEBUG_CONSOLE_RECEIVE_BUFFER_LEN */
\r
53 /*!@ brief Whether enable the reliable TX function
\r
54 * If the macro is zero, the reliable TX function of the debug console is disabled.
\r
55 * When the macro is zero, the string of PRINTF will be thrown away after the transmit buffer is full.
\r
57 #ifndef DEBUG_CONSOLE_TX_RELIABLE_ENABLE
\r
58 #define DEBUG_CONSOLE_TX_RELIABLE_ENABLE (1U)
\r
59 #endif /* DEBUG_CONSOLE_RX_ENABLE */
\r
62 #define DEBUG_CONSOLE_TRANSFER_BLOCKING
\r
63 #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
\r
65 /*!@ brief Whether enable the RX function
\r
66 * If the macro is zero, the receive function of the debug console is disabled.
\r
68 #ifndef DEBUG_CONSOLE_RX_ENABLE
\r
69 #define DEBUG_CONSOLE_RX_ENABLE (1U)
\r
70 #endif /* DEBUG_CONSOLE_RX_ENABLE */
\r
72 /*!@ brief define the MAX log length debug console support , that is when you call printf("log", x);, the log
\r
73 * length can not bigger than this value.
\r
74 * This macro decide the local log buffer length, the buffer locate at stack, the stack maybe overflow if
\r
75 * the buffer is too big and current task stack size not big enough.
\r
77 #ifndef DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN
\r
78 #define DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN (128U)
\r
79 #endif /* DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN */
\r
81 /*!@ brief define the buffer support buffer scanf log length, that is when you call scanf("log", &x);, the log
\r
82 * length can not bigger than this value.
\r
83 * As same as the DEBUG_CONSOLE_BUFFER_PRINTF_MAX_LOG_LEN.
\r
85 #ifndef DEBUG_CONSOLE_SCANF_MAX_LOG_LEN
\r
86 #define DEBUG_CONSOLE_SCANF_MAX_LOG_LEN (20U)
\r
87 #endif /* DEBUG_CONSOLE_SCANF_MAX_LOG_LEN */
\r
89 /*! @brief Debug console synchronization
\r
90 * User should not change these macro for synchronization mode, but add the
\r
91 * corresponding synchronization mechanism per different software environment.
\r
92 * Such as, if another RTOS is used,
\r
94 * #define DEBUG_CONSOLE_SYNCHRONIZATION_XXXX 3
\r
95 * in this configuration file and implement the synchronization in fsl.log.c.
\r
97 /*! @brief synchronization for baremetal software */
\r
98 #define DEBUG_CONSOLE_SYNCHRONIZATION_BM 0
\r
99 /*! @brief synchronization for freertos software */
\r
100 #define DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS 1
\r
102 /*! @brief RTOS synchronization mechanism disable
\r
103 * If not defined, default is enable, to avoid multitask log print mess.
\r
104 * If other RTOS is used, you can implement the RTOS's specific synchronization mechanism in fsl.log.c
\r
105 * If synchronization is disabled, log maybe messed on terminal.
\r
107 #ifndef DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION
\r
108 #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
\r
109 #ifdef FSL_RTOS_FREE_RTOS
\r
110 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS
\r
112 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
\r
113 #endif /* FSL_RTOS_FREE_RTOS */
\r
115 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
\r
116 #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
\r
117 #endif /* DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION */
\r
119 /*! @brief echo function support
\r
120 * If you want to use the echo function,please define DEBUG_CONSOLE_ENABLE_ECHO
\r
121 * at your project setting.
\r
123 #ifndef DEBUG_CONSOLE_ENABLE_ECHO
\r
124 #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 0
\r
126 #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 1
\r
127 #endif /* DEBUG_CONSOLE_ENABLE_ECHO */
\r
129 /*********************************************************************/
\r
131 /***************Debug console other configuration*********************/
\r
132 /*! @brief Definition to printf the float number. */
\r
133 #ifndef PRINTF_FLOAT_ENABLE
\r
134 #define PRINTF_FLOAT_ENABLE 0U
\r
135 #endif /* PRINTF_FLOAT_ENABLE */
\r
137 /*! @brief Definition to scanf the float number. */
\r
138 #ifndef SCANF_FLOAT_ENABLE
\r
139 #define SCANF_FLOAT_ENABLE 0U
\r
140 #endif /* SCANF_FLOAT_ENABLE */
\r
142 /*! @brief Definition to support advanced format specifier for printf. */
\r
143 #ifndef PRINTF_ADVANCED_ENABLE
\r
144 #define PRINTF_ADVANCED_ENABLE 0U
\r
145 #endif /* PRINTF_ADVANCED_ENABLE */
\r
147 /*! @brief Definition to support advanced format specifier for scanf. */
\r
148 #ifndef SCANF_ADVANCED_ENABLE
\r
149 #define SCANF_ADVANCED_ENABLE 0U
\r
150 #endif /* SCANF_ADVANCED_ENABLE */
\r
152 /*! @brief Definition to select virtual com(USB CDC) as the debug console. */
\r
153 #ifndef BOARD_USE_VIRTUALCOM
\r
154 #define BOARD_USE_VIRTUALCOM 0U
\r
156 /*******************************************************************/
\r
158 #endif /* _FSL_DEBUG_CONSOLE_CONF_H_ */
\r