参考资料: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 0x01000000 struct __FILE { int handle; /* Add whatever you need here */ };
FILE __stdout;
FILE __stdin; int fputc(int ch, FILE *f) {
if (DEMCR & TRCENA) {
while (ITM_Port32() == );
ITM_Port8() = ch;
}
return(ch);
}

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

Keil ARM-CM3 printf输出调试信息到Debug (printf) Viewer的更多相关文章

  1. 使用OutputDebugString输出调试信息

    在编写控制台程序的时候我们经常会使用printf输出调试信息,使我们了解程序的状态,方便调试,但是当编写非控制台程序的时候这种方法就行不通了,那我们应该怎么办?上网查了一些方法,大致就如下几种 使用L ...

  2. 在MFC中,使用控制台Console输出调试信息

    1.在MFC的应用类的InitInstance()函数里添加: AllocConsole(); 有时候需要调整这行代码在InitInstance函数的位置 2.继续添加以下代码 freopen(&qu ...

  3. js操作dom---创建一个域来输出调试信息

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  4. shell输出调试信息

    [shell输出调试信息] 1.使用trap命令 trap命令用于捕获指定的信号并执行预定义的命令. 其基本的语法是: trap 'command' signal 其中signal是要捕获的信号,co ...

  5. Delphi中使用Dos窗口输出调试信息

    在项目文件 *.DPR (Project->View Source)  里加上{$APPTYPE   CONSOLE} 然后,在需要输出处加上 Writeln(‘your debug messa ...

  6. 【OT1.0 + TP3.2】开启trace调试、输出调试信息、开启自定义菜单

    1.开启trace调试 A- 后台系统设置 show-page-trace = 1 B-config.php文件.配置 show-page-trace = true 2.输出调试信息 很奇怪,OT竟然 ...

  7. Delphi RAD Berlin OutputDebugString 输出调试信息

    Delphi RAD Berlin Event Log.OutputDebugString 输出调试信息,仅在win VCL下可以用.OutputDebugString(PChar('hellowor ...

  8. 跟踪Makefile输出调试信息

    /********************************************************************* * 跟踪Makefile输出调试信息 * 说明: * 有时 ...

  9. Qt 使用#define+qDebug()输出调试信息

    /******************************************************************************************* * Qt 使用 ...

随机推荐

  1. Ldap实现AD域认证

    1.java Ldap基础类 package com.common; import java.io.FileInputStream; import java.io.IOException; impor ...

  2. multiprocessing中进程池,线程池的使用

    multiprocessing 多进程基本使用 示例代码1 import time import random from multiprocessing import Process def run( ...

  3. JSP/Servlet开发——第十章 Ajax与JQuery

    1. 认识Ajax: ◆在传统的 Web 应用中,每次请求服务器都会生成新的页面,用户在提交请求后,总是要等待服务器的响应,如果前一个请求没有得到响应,则后一个请求就不能发送. ◆由于这是一种独占式的 ...

  4. PHP实现全自动化邮件发送 phpmailer

    PHPmailer           composer地址 function SendMail($msg,$theme,$content) { $mail = new \PHPMailer\PHPM ...

  5. Java核心技术36讲----------Exception和Error有什么区别

    1.异常知识点学习实例 代码如下: package fromnet; /** * 参考链接:https://blog.csdn.net/qq_18505715/article/details/7319 ...

  6. GDB简单使用

    GDB简单使用 更多请参考:https://www.cnblogs.com/HKUI/p/8955443.html https://www.cnblogs.com/skyofbitbit/p/3672 ...

  7. 第四节 Go数据结构之栈

    一.什么是栈 这是杭州地铁1号线线路图.大卫哥考考大家,地铁列车如何调头? 我也不卖关子了,列车通常是用"人字轨道"来变换车道. 列车先从A轨道开进"人字轨道" ...

  8. linux redhat NFS网络共享搭建

    nfs网络共享 测试环境: 服务端:redhat6.7 ip:192.168.1.100 客户端:redhat6.7 ip:192.168.1.110 一.服务端 1.创建共享文件夹 权限666即可 ...

  9. Tips & Tricks Learned Releasing an Hybrid App Using Steroids.js

    http://marcgg.com/blog/2014/04/09/phonegap-steroids-hybrid-native-app-tips/

  10. PHP.49-TP框架商城应用实例-前台1-公共布局、制作首页

    公共布局包括 1.页头.页脚{layout} 正文:{__COMMENT__} 导入:<layout name="layout"> 2.商品导航{nav.html} = ...