Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


You are viewing a reply to Migration from Keil to AC6  

Migration from Keil to AC6

Hi Bernard,

I need your help once again!

Now my problem regards the redirection of printf to UART2.

My MCU is a STM32F103VDT and I use UART2 to print debug on serial console.

On Keil I used this code to redirect the printf trough UART2:

int fputc(int ch, FILE *f)
{
/* Place your implementation of fputc here */
/* e.g. write a character to the USART */

if ((char)ch == ‘\n’) /* Add a LF before \n — LF -> CR LF */
{
HAL_UART_Transmit(&huart2,(uint8_t*)”\r”,1,1);
}

HAL_UART_Transmit(&huart2,(uint8_t*)&ch,1,1); // 1 tick waiting (1ms) enough for 87us/byte at 115200

return ch;
}



But now this code not works when I compile with System WorkBench AC6.

Exploring the forum I found a hint regarding the redirection of UART.

It’s suggest to use this code to redirect the printf (I add my code into the function):

void __io_putchar(uint8_t ch)
{
/* Place your implementation of fputc here */
/* e.g. write a character to the USART */

if ((char)ch == ‘\n’) /* Add a LF before \n — LF -> CR LF */
{
HAL_UART_Transmit(&huart2,(uint8_t*)”\r”,1,1);
}

HAL_UART_Transmit(&huart2,(uint8_t*)&ch,1,1); // 1 tick waiting (1ms) enough for 87us/byte at 115200

//return ch;
}


But this code not works.

Any suggestion?

Thanks