![]() If ((file != STDOUT_FILENO) & (file != STDERR_FILENO)) This is conventionally contained in syscalls.c. Since I only wanted printf(), I only needed to populate the _write() function, which I did as follows. I used STM32CubeMX to setup USART1 ( huart1) as a serial port. If a declaration of any of the above functions appears in your own code, your substitute routine will override the declaration in the library and be used instead of the default (non-functional) routine. These functions are implemented witihin the GCC C library as stub routines with "weak" linkage. Int _write(int file, char *data, int len) ![]() The GCC C library makes calls to the following functions to perform low-level I/O : int _read(int file, char *data, int len) The way I got printf (and all other console-oriented stdio functions) to work was by creating custom implementations of the low-level I/O functions like _read() and _write(). I got the first method from this page working on my STM32F072.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |