通过printf的输出调试Cortex-M3的CPU上,在摊位BKPT指令+混淆JTAG和SW端口 [英] Output debug via printf on a Cortex-M3 CPU, stalls at BKPT instruction + confusion about JTAG and sw ports

查看:375
本文介绍了通过printf的输出调试Cortex-M3的CPU上,在摊位BKPT指令+混淆JTAG和SW端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须连接到 JTAG连接器在我的船上,一个Keil的ULINK2 USB仿真器盒哪些工作正常的和Cortex-M3 CPU板上(TI /的Stellaris / LuminaryMicro LM3S系列)。看来,无论一个JTAG和SWJ-DP端口共享这些CPU相同的引脚(从而对您的电路板连接器)。一个似乎没有ITM(printf的)能力,其他的。

I have a Keil ULINK2 USB emulator box attached to the JTAG connector on my board, which is working fine with the Cortex-M3 CPU onboard (TI/Stellaris/LuminaryMicro LM3S series). It seems that both a JTAG and a SWJ-DP port share the same pins (and thus connector on your board) on these CPUs. One appears not to have ITM (printf) capability, the other does.

在previous固件人们一直使用标准输入输出至UART(串口),但我需要串口腾出来,这样调试消息不发送其他数据干扰/从串行端口接收到/,因此,我需要跟踪消息到别处去。可悲的是我只有在该主板上一个串口。我认为这CPU在ITM(跟踪)功能意味着我可以直接发送调试printf的消息,我的调试器/ IDE(Keil公司uVision)。该TI / CPU的Stellaris调用文档此功能串行线JTAG调试端口(SWJ-DP),为此支持,我看了,肯定是在Keil uVision IDE实现的功能。

The previous firmware people have always used stdio to UART (serial port), but I need the serial port freed up so that debug messages do not interfere with other data being sent/received to/from the serial port, thus I need for trace messages to go elsewhere. Sadly I only have one serial port on this board. I thought that the ITM (Trace) feature in this CPU meant that I could send debug printf messages directly to my debugger/IDE (Keil uVision). The TI/Stellaris CPU documentation call this feature 'Serial Wire JTAG Debug Port (SWJ-DP)', support for which, I have read, is definitely a feature implemented in the Keil uVision IDE.

添加一个printf消息给我的code使我的code锁定,当我开始调试。看守所似乎是在这里它们链接到我的应用程序,在功能_sys_open的RTL库,在BKPT指令:

Adding a printf message to my code causes my code to lock up when I start debugging. The lockup seems to be here in the RTL libraries which are linked into my application, in the function _sys_open, at the BKPT instruction:

                 _sys_open:
  0x00009D7A B50E      PUSH     {r1-r3,lr}
  0x00009D7C E9CD0100  STRD     r0,r1,[sp,#0]
  0x00009D80 F7FFFC0F  BL.W     strlen (0x000095A2)
  0x00009D84 9002      STR      r0,[sp,#0x08]
  0x00009D86 4669      MOV      r1,sp
  0x00009D88 2001      MOVS     r0,#0x01
>>0x00009D8A BEAB      BKPT     0xAB
  0x00009D8C BD0E      POP      {r1-r3,pc}

上面似乎是$ C称为$ C的一部分,由 __ rt_lib_init_stdio_1

The above appears to be part of code called by __rt_lib_init_stdio_1.

这是怎么回事?我不知道BKPT做什么。我认为它提出了一个软件断点应该再由调试器处理?应该不是的Keil / ARM ULINK2软件和硬件已经被配置成这样?有一些诀窍使调试工作的printf使用Keil JTAG / SW端口?

What is going on? I don't know what BKPT does. I assume it raises a software breakpoint which should then be handled by the debugger? Shouldn't the Keil/ARM ULINK2 software and hardware already be configured for this? Is there some trick to making debug printf work with Keil JTAG/sw ports?

我不确定是SW和JTAG端口之间的区别是什么。申银万国指究竟,我相信它是指对电路板上,其中JTAG是无迹可寻支撑的经典,但更有限的模式JTAG物理连接器两种可能的模式之一,SW模式增加了跟踪支持,不添加任何引脚的JTAG连接器布局?但是,这是嵌入式系统,它们是神秘的是常态。我是新来的Cortex-M3的发展,很多这种东西是新的给我,因为旧的ARM7TDMI天。但凯尔uVision打印此消息出来:ITM只适用于软件的端口,而不是与JTAG。为sw,你必须对你的电路板设计不同的物理端口? (我使用的是定制设计的应用板,而不是开发入门板。)

I am unsure what the difference between an sw and JTAG port is. sw means what exactly, I believe it refers to one of two possible modes for the JTAG physical connector on a board, where JTAG is a classic but more limited mode without trace support, and sw mode adds trace support without adding any pins to the JTAG connector layout? But this is embedded systems, where being cryptic is the norm. I am new to Cortex-M3 development, and a lot of this stuff is new to me since the old ARM7TDMI days. But the Keil uVision prints this message out: "ITM works only with SW port, not with JTAG". Is SW a different physical port that you have to design on your board? (I am using a custom designed application board, not a development starter board.)

[周围的Googling让我在这样的事实, _sys_open 和一些杂 __ use_no_semihosting_swi 和其他东西都密切参与在这个难题,在ROM中BRKPT说明可能会在一些SWI ARM变种(软件中断)ARM指令。]

[Googling around lets me in on the fact that _sys_open and some pragma __use_no_semihosting_swi and something else are intimately involved in this puzzle, BRKPT instructions in ROM might be some ARM variant on the SWI ('software-interrupt') ARM instruction.]

推荐答案

这一次是我的一个不懂得STDIO不落实,而是你必须提供自己的实现,通常一个名为内部完成重新定位。C。文件名是纯粹的习惯,但是是有据可查的(因为它原来)Keil公司uVision内/ RTLIB文档

This one was a failure on my part to understand that stdio is not implemented, but rather you must provide your own implementation, usually done inside a file called "retarget.c". The filename is pure convention, but is well documented (as it turns out) inside Keil's uVision/RTLIB documentation

这篇关于通过printf的输出调试Cortex-M3的CPU上,在摊位BKPT指令+混淆JTAG和SW端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆