cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx does not generate syscalls.c

m8r-xuulk51
Associate II
Posted on November 17, 2016 at 08:57

Dear all,

I have an STM32F746G-DISCO and wanted to get started with printing some text with printf() over the virtual serial COM-port USART1 which is connected via the ST-Link v2.1 with a USB-cable to the PC.

I used STM32Cube FW_F7_V1.5.1 to generate my project for SystemWorkbench STM32. I configured the USART1 port to be used.

 Then I copied all relevant code from the UART_Printf - example from STM32F746ZG-Nucleo\Examples\UART\UART_Printf.

However, nothing gets printed to the serial terminal console on my PC.

After a long time, I figured out what was wrong: STM32CubeMX does not generate the syscalls.c !

Can you please fix this in STM32CubeMx?

Or add an option there to generate it?

Or at least clearly document it in the USART_Printf() example?

I hope this post, at least, helps any other newcomers to solve this problem with printf() over the serial VCP.

5 REPLIES 5
Imen.D
ST Employee
Posted on November 17, 2016 at 10:28

Dear User,

Thanks for highlighting this issue.

Please note that your feedback is reported internally for checking.

We apologize for any inconvenience this may cause and thank you for your understanding.

Best Regards

STM32.Forum

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Jeanne Joly
Senior III
Posted on May 05, 2017 at 09:45

Hi

Ross.Mike

,

Sorry for the late answer. It seems that this post is no more valid as on the lastest CubeMX release, we don't encounter this issue.

I advise you to upgrade your CubeMX release with the latest (if not already done!).

BR. Eric

Posted on May 05, 2017 at 12:35

you would be mistaken. the stm32cubemx application does not generate or include syscalls.c into its generated projects, at least as late as 4.20.1

if a person wants to print anything they need to find that file somewhere in the repository and include it themselves

Posted on May 05, 2017 at 15:34

In case of printf() only _write function is needed from syscall.c

You can define it as follow just after __io_putchar() definition :

int _write(int file, char *ptr, int len)

{

int DataIdx;

for (DataIdx = 0; DataIdx < len; DataIdx++){ __io_putchar( *ptr++ );}

return len;

}

Hope it help 

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Posted on May 18, 2017 at 07:52

I'm sorry, but you're mistaken: even STM32CubeMX 4.21.0 does not generate the syscalls.c file for any simple STM32F746G-Disco Project I tried. You have to copy it manually from one of the examples (for ex. ...\STM32Cube\Repository\STM32Cube_FW_F7_V1.7.0\Projects\STM32746G-Discovery\Examples\BSP\SW4STM32\syscalls.c)

ST should fix this in the STM32CubeMX code generator for SW4STM32.