cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the Azure RTOS ThreadX Semaphore example

MStew.1
Associate III

Hello,

in the Semaphore example(https://community.st.com/s/article/how-does-the-threadx-semaphore-work) there is this step:

Open Core\Src \main.c – you can copy and paste the code below, but please notice the" USER CODE BEGIN", to properly place the code snippet:

/* Private user code ---------------------------------------------------------*/
 
/* USER CODE BEGIN 0 */
 
#define USE_UART_PRINT
 
void __io_putchar(char ch) {
 
#ifdef USE_UART_PRINT
 
   // Code to write character 'ch' on the UART
 
   HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 10);
 
#else
 
   ITM_SendChar(ch);
 
#endif
 
}
 
/* USER CODE END 0 */

The question I have is why is this step and piece of code needed? I understand the previous steps and the code that I need to add in the \app_threadx.c file. But this part I am not sure and it is not explained in the guide.

Can anyone please tell why this part is needed?

Thank you

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Haithem Rahmani
ST Employee

Hi,

this is needed to redirect the printf() output to the serial port.

regards

Haithem

View solution in original post

3 REPLIES 3
Haithem Rahmani
ST Employee

Hi,

this is needed to redirect the printf() output to the serial port.

regards

Haithem

MStew.1
Associate III

Ah ok thank you!

solved

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.