Uwaga! Program na mikrokontrolerze nie będzie pracował poza sesją debugowania!
1.w main.c
/* USER CODE BEGIN Includes */ #include <string.h> #include <stdio.h> /* USER CODE END Includes */
2.w main.c
/* USER CODE BEGIN PFP */ extern void initialise_monitor_handles(void);
3. Project -> Properties -> C/C++ General -> Paths and Symbols -> Source Location -> /[nazwa projektu]/Core -> Edit Filter -> Src/syscalls.c
4. Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Linker -> Libraries
Libraries: rdimon
5. Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Linker -> Miscellaneous
Other flags: -specs=rdimon.specs
6. Run -> Debug Configurations… -> Debugger
-
- Debug probe: ST-LINK (OpenOCD)
- Reset mode: Software system reset
7. Run -> Debug Configurations… -> Startup
Initialization Commands: monitor arm semihosting enable
8. w main.c w main():
/* USER CODE BEGIN 1 */ initialise_monitor_handles();
Gotowe. Teraz umieszczając w kodzie printf() wyjście pojawi się w konsoli debuggera.
Źródło: https://www.youtube.com/watch?v=V16v9O5USF4