分享

How to printf() to PC through J-Link?

 amine 2010-07-14
if you are using a Cortex-M3 device and CMSIS, you can easily use the ITM_Sendchar(c) function, defined in CMSIS core_cm3.h.
The ITM output (channel 0 for printf) is captured from the J-Link through SWO sampling, this must be configured (dependant on your IDE).

On ARM7/9 there is a method called semihosting, a printf is redirected through armlib to the debugger, how this works with J-Link the Segger guys should be able to help :-)
In Keil uVision on ARM7/9 and there is the Real Time Agent doing this work, and the CMSIS for Cortex. Note, for STM32F10x the stm32f10x_dbg.ini (found i.e. in STLibBlinky) must be added to debug settings. In uVision you can watch the serial output when debugging in the RTA or ITM window under Serial Windows.

In IAR the printf's are captured through semihosting and sent to the Terminal. On CM3 the semihosting can also be used, or printf through ITM.

The advantage on ITM is, that the core does not need to be "stopped" when printing a message.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多