AN4989 Rev 3
83/118
AN4989
Printf debugging
117
Add printf Code
Above int main(void) (USER CODE 0 section), add:
extern void initialize_monitor_handles(void);
Then configure the semihosting system call: In int main(void) before the while(1) loop
(USER CODE 1 section) add:
Initialise_monitor_handles();
Then inside the while(1) loop, add:
Printf(“Hello World!\n”);
HAL_Delay(1000);
Click
Project -> Build Project
to compile and link everything.