本帖最后由 huangcunxiake 于 2016-8-27 10:02 编辑
使用Keil开发STM32F4 Discovery板的时候,使用printf函数,并且,输出信息重定向到debuger中的debug viewer中,从而,增加调试手段。
Objective
The ARM Cortex-M architecture includes a facility for sending/receiving user data through special debug ports. This facility is well suited for typical printf() debug practices, where a typical serial port is utiliced. In theses cases, the idea is to write in my program something like this, [size=1em][color=white !important][size=1em]?
#include voidmain (void) {
printf("Hello, world!");
}
|
and use the “Debug (printf) viewer” option avaible in Keil MDK-ARM (and other environments) to show a terminal where messages are received. See bellow These are my notes in order to get this mechanism working on the STM32F4 Discovery kit using the Keil environment. Some vocabulary. ITM: SWV: Serial Wire Viewer
St-Link/V2 upgrade and driversThe STM32F4 Discovery includes a built-in St-link/v2 debug interface. According with its manual, the SWV facility is available in this interface and the hardware lines are propagated in the schematic of the Discovery kit. Steps: 2 – Install drivers (?Uninstall previous driver from the control panel) 3- Upgrade St-Link/v2 interface of the discovery running the ST-LinkUpgrade.exe utility Configuring a Keil project(But not working completly OK) Assuming you have a working example for the previous debugger version. (Try to) follow these steps: 1 – Open your project and open the “target options” dialog 2 – Select the second “St-link debugger”
3 – Select “settings” and set options according to the next images.
(Here, be carefull with the speed of the core). (This a trick for flashing the microcontroller)
|