The discussion of standard IO dynamic switching among semihost, UARTx, and NULL on STM32
Hello here,
I had done a quick hack based on the syscalls.c from AC6 and liviu Ionescu’s work. As I said, it is a quick hack, but works well. In the application code, invoke
freopen(“/dev/null”,”w”,stdout);
freopen(“/dev/semihosting”,”w”,stdout);
freopen(“/dev/ttyS2”,”w”,stdout);
freopen(“/dev/ttyS3”,”w”,stdout);
to redirect the standard Output to null, semihosting , UART2 , UART3 etc.
Null means to drop all of the data to standard Output.
I have the zip file attached here, in hoping to help someone.
Again, as I said, this is a hack, the code was far away from clean and neat, and only support stdout. Of course, the similar way can apply to stdin. It is welcome for peoples to refine the code and provide a clean neat and enhanced version.
-Andy