I am trying to retarget printf() function for STM32F411RET microcontroller in ARM GCC toolchain environment which uses Newlib for standard C library.
When I search for how to retarget printf(), many people says I need to implement _write() or _write_r(). And it seems both working.
But I still have questions about them:
When I look through the document of Newlib, it says I can implement
write()to output files, but it doesn't look working. It looks like we can implement_write()but this function never be mentioned in the document. What happend towrite()? does an underscore make anything different?In which situation
_write_r()is preferable than_wirte()? I don't understand the concept of reenterncy in C. Any examples?
Thanks for reading this.