I am trying to figure out how to use the printf function to print to the serial port.
My current setup is STM32CubeMX generated code and SystemWorkbench32 with the STM32F407 discovery board.
I see in stdio.h that the printf prototype is defined as:
int _EXFUN(printf, (const char *__restrict, ...)
_ATTRIBUTE ((__format__ (__printf__, 1, 2))));
What does it mean? Where is the exact location of this function definition? What would be general point of finding out how to use this kind of function to output?
Best Answer
I got the first method from this page working on my STM32F072.
http://www.openstm32.org/forumthread1055
As stated there,
I used STM32CubeMX to setup USART1 (
huart1
) as a serial port. Since I only wantedprintf()
, I only needed to populate the_write()
function, which I did as follows. This is conventionally contained insyscalls.c
.