打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Keil ARM

参考资料:http://www.keil.com/support/man/docs/jlink/jlink_trace_itm_viewer.htm

 

 

1.Target Options -> Debug -> Settings(JLink) -> Debug里ort选择SW模式

2.在Target Options -> Debug -> Settings(JLink) -> Trace里选择Enable

3.Core freq设为120MHz(以LPC1788为例)

4. 设置ITM Port的值如下所示

5.在工程中添加.c文件如下

#include "stdio.h"#define ITM_Port8(n)    (*((volatile unsigned char *)(0xE0000000+4*n)))#define ITM_Port16(n)   (*((volatile unsigned short*)(0xE0000000+4*n)))#define ITM_Port32(n)   (*((volatile unsigned long *)(0xE0000000+4*n)))#define DEMCR           (*((volatile unsigned long *)(0xE000EDFC)))#define TRCENA          0x01000000struct __FILE { int handle; /* Add whatever you need here */ };FILE __stdout;FILE __stdin;int fputc(int ch, FILE *f) {  if (DEMCR & TRCENA) {    while (ITM_Port32(0) == 0);    ITM_Port8(0) = ch;  }  return(ch);}

6.用Debug模式运行工程,Debug (printf) Viewer中即可以查看printf的输出信息。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Keil Debug(printf) Viewer的使用
使用RealView MDK进行SW调试和实时跟踪STM32
STM32中重定向printf到SWO口
用“UL”避免Keil C51大整数常量运算溢出错误
Keil 5使用JLink直接调试正在运行的CPU
MDK配合J
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服