
AT32 Printf Debug Demo
2019.08.05
12
Rev 1.0.2
2.3.4.3 Printf mapping
int fputc(int c, FILE *f)
{
if (c == '\n')
{
SER_PutChar('\r');
}
return (SER_PutChar(c));
}
int SER_PutChar (int c)
{
ITM_SendChar(c);
return (c);
}
2.3.5 Debug and download
Compile the code and downloaded it to the MCU, and enter debug environment to call up the virtual
terminal window through
View->Serial Windows->Debug (printf) Viewer
, then run the code, and
“Hello World” is visible in the terminal interaction window. (Figure 5)
Figure 4. Keil virtual terminal window path