I tried to incorporate that cli_uart_drv.c example into my project. But it doesn’t compile.
I’m getting:
10:08:39 **** Build of configuration Debug for project NewFreeRTOS ****
make -j7 all
...
10:20:51 **** Incremental Build of configuration Debug for project NewFreeRTOS ****
make -j7 all
arm-none-eabi-gcc "../Core/Src/cli_uart_drv.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xB -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/cli_uart_drv.d" -MT"Core/Src/cli_uart_drv.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/cli_uart_drv.o"
../Core/Src/cli_uart_drv.c:63:11: error: 'UART_InitTypeDef' has no member named 'OneBitSampling'; did you mean 'OverSampling'?
63 | .Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,
| ^~~~~~~~~~~~~~
| OverSampling
../Core/Src/cli_uart_drv.c:63:36: error: 'UART_ONE_BIT_SAMPLE_DISABLE' undeclared here (not in a function); did you mean 'UART_ONE_BIT_SAMPLE_DISABLED'?
63 | .Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| UART_ONE_BIT_SAMPLE_DISABLED
../Core/Src/cli_uart_drv.c:64:11: error: 'UART_InitTypeDef' has no member named 'ClockPrescaler'
64 | .Init.ClockPrescaler = UART_PRESCALER_DIV1,
| ^~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:64:36: error: 'UART_PRESCALER_DIV1' undeclared here (not in a function); did you mean 'TIM_ETRPRESCALER_DIV1'?
64 | .Init.ClockPrescaler = UART_PRESCALER_DIV1,
| ^~~~~~~~~~~~~~~~~~~
| TIM_ETRPRESCALER_DIV1
../Core/Src/cli_uart_drv.c:65:6: error: 'UART_HandleTypeDef' {aka 'struct __UART_HandleTypeDef'} has no member named 'AdvancedInit'
65 | .AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,
| ^~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:65:36: error: 'UART_ADVFEATURE_NO_INIT' undeclared here (not in a function)
65 | .AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,
| ^~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c: In function 'vUart1MspInitCallback':
../Core/Src/cli_uart_drv.c:83:43: error: 'RCC_PERIPHCLK_USART1' undeclared (first use in this function); did you mean 'RCC_PERIPHCLK_USB'?
83 | xClockInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
| ^~~~~~~~~~~~~~~~~~~~
| RCC_PERIPHCLK_USB
../Core/Src/cli_uart_drv.c:83:43: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/cli_uart_drv.c:84:20: error: 'RCC_PeriphCLKInitTypeDef' has no member named 'Usart1ClockSelection'; did you mean 'UsbClockSelection'?
84 | xClockInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
| ^~~~~~~~~~~~~~~~~~~~
| UsbClockSelection
../Core/Src/cli_uart_drv.c:84:43: error: 'RCC_USART1CLKSOURCE_PCLK2' undeclared (first use in this function); did you mean 'RCC_LPTIM1CLKSOURCE_PCLK'?
84 | xClockInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| RCC_LPTIM1CLKSOURCE_PCLK
../Core/Src/cli_uart_drv.c:106:24: error: 'GPIO_InitTypeDef' has no member named 'Alternate'
106 | GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
| ^
../Core/Src/cli_uart_drv.c:106:37: error: 'GPIO_AF7_USART1' undeclared (first use in this function)
106 | GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
| ^~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c: In function 'vInitUartEarly':
../Core/Src/cli_uart_drv.c:143:14: warning: implicit declaration of function 'HAL_UART_RegisterCallback'; did you mean 'HAL_DMA_RegisterCallback'? [-Wimplicit-function-declaration]
143 | ( void ) HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_MSPINIT_CB_ID, vUart1MspInitCallback );
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| HAL_DMA_RegisterCallback
../Core/Src/cli_uart_drv.c:143:58: error: 'HAL_UART_MSPINIT_CB_ID' undeclared (first use in this function)
143 | ( void ) HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_MSPINIT_CB_ID, vUart1MspInitCallback );
| ^~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:144:58: error: 'HAL_UART_MSPDEINIT_CB_ID' undeclared (first use in this function)
144 | ( void ) HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_MSPDEINIT_CB_ID, vUart1MspDeInitCallback );
| ^~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c: In function 'xInitConsoleUart':
../Core/Src/cli_uart_drv.c:162:61: error: 'HAL_UART_MSPINIT_CB_ID' undeclared (first use in this function)
162 | xHalRslt |= HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_MSPINIT_CB_ID, vUart1MspInitCallback );
| ^~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:163:61: error: 'HAL_UART_MSPDEINIT_CB_ID' undeclared (first use in this function)
163 | xHalRslt |= HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_MSPDEINIT_CB_ID, vUart1MspDeInitCallback );
| ^~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:174:65: error: 'HAL_UART_TX_COMPLETE_CB_ID' undeclared (first use in this function)
174 | xHalRslt |= HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_TX_COMPLETE_CB_ID, txCompleteCallback );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:176:65: error: 'HAL_UART_ERROR_CB_ID' undeclared (first use in this function); did you mean 'HAL_UART_ERROR_FE'?
176 | xHalRslt |= HAL_UART_RegisterCallback( &xConsoleHandle, HAL_UART_ERROR_CB_ID, rxErrorCallback );
| ^~~~~~~~~~~~~~~~~~~~
| HAL_UART_ERROR_FE
../Core/Src/cli_uart_drv.c:177:21: warning: implicit declaration of function 'HAL_UART_RegisterRxEventCallback'; did you mean 'HAL_UARTEx_RxEventCallback'? [-Wimplicit-function-declaration]
177 | xHalRslt |= HAL_UART_RegisterRxEventCallback( &xConsoleHandle, rxEventCallback );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| HAL_UARTEx_RxEventCallback
../Core/Src/cli_uart_drv.c:183:21: warning: implicit declaration of function 'HAL_UARTEx_SetTxFifoThreshold' [-Wimplicit-function-declaration]
183 | xHalRslt |= HAL_UARTEx_SetTxFifoThreshold( &xConsoleHandle, UART_TXFIFO_THRESHOLD_8_8 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:183:69: error: 'UART_TXFIFO_THRESHOLD_8_8' undeclared (first use in this function)
183 | xHalRslt |= HAL_UARTEx_SetTxFifoThreshold( &xConsoleHandle, UART_TXFIFO_THRESHOLD_8_8 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:188:21: warning: implicit declaration of function 'HAL_UARTEx_SetRxFifoThreshold' [-Wimplicit-function-declaration]
188 | xHalRslt |= HAL_UARTEx_SetRxFifoThreshold( &xConsoleHandle, UART_RXFIFO_THRESHOLD_8_8 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:188:69: error: 'UART_RXFIFO_THRESHOLD_8_8' undeclared (first use in this function)
188 | xHalRslt |= HAL_UARTEx_SetRxFifoThreshold( &xConsoleHandle, UART_RXFIFO_THRESHOLD_8_8 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c:194:21: warning: implicit declaration of function 'HAL_UARTEx_EnableFifoMode' [-Wimplicit-function-declaration]
194 | xHalRslt |= HAL_UARTEx_EnableFifoMode( &xConsoleHandle );
| ^~~~~~~~~~~~~~~~~~~~~~~~~
../Core/Src/cli_uart_drv.c: In function 'rxErrorCallback':
../Core/Src/cli_uart_drv.c:224:14: warning: implicit declaration of function 'xTaskNotifyIndexedFromISR'; did you mean 'xTaskNotifyAndQueryFromISR'? [-Wimplicit-function-declaration]
224 | ( void ) xTaskNotifyIndexedFromISR( xRxThreadHandle,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| xTaskNotifyAndQueryFromISR
../Core/Src/cli_uart_drv.c: In function 'vRxThread':
../Core/Src/cli_uart_drv.c:295:13: warning: implicit declaration of function 'xTaskNotifyWaitIndexed'; did you mean 'xTaskNotifyWait'? [-Wimplicit-function-declaration]
295 | if( xTaskNotifyWaitIndexed( 1, 0, 0xFFFFFFFF, &ulNotifyValue, pdMS_TO_TICKS( 30 ) ) == pdTRUE )
| ^~~~~~~~~~~~~~~~~~~~~~
| xTaskNotifyWait
../Core/Src/cli_uart_drv.c: In function 'txCompleteCallback':
../Core/Src/cli_uart_drv.c:329:14: warning: implicit declaration of function 'vTaskNotifyGiveIndexedFromISR'; did you mean 'vTaskNotifyGiveFromISR'? [-Wimplicit-function-declaration]
329 | ( void ) vTaskNotifyGiveIndexedFromISR( xTxThreadHandle, 1, &xHigherPriorityTaskWoken );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| vTaskNotifyGiveFromISR
../Core/Src/cli_uart_drv.c: In function 'vTxThread':
../Core/Src/cli_uart_drv.c:405:22: warning: implicit declaration of function 'xTaskNotifyStateClearIndexed'; did you mean 'xTaskNotifyStateClear'? [-Wimplicit-function-declaration]
405 | ( void ) xTaskNotifyStateClearIndexed( NULL, 1 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| xTaskNotifyStateClear
../Core/Src/cli_uart_drv.c:412:26: warning: implicit declaration of function 'ulTaskNotifyTakeIndexed'; did you mean 'ulTaskNotifyTake'? [-Wimplicit-function-declaration]
412 | ( void ) ulTaskNotifyTakeIndexed( 1, pdTRUE, portMAX_DELAY );
| ^~~~~~~~~~~~~~~~~~~~~~~
| ulTaskNotifyTake
make: *** [Core/Src/subdir.mk:43: Core/Src/cli_uart_drv.o] Error 1
"make -j7 all" terminated with exit code 2. Build might be incomplete.
10:20:52 Build Failed. 20 errors, 10 warnings. (took 1s.174ms)
Sorry for posting this long error list. But examples that don’t compile are not so pleasant