In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the ways to print debugging information in the IAR ITM mechanism. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
There are several ways to print debugging information:
1. Serial port printing:
Map fputc to UART and print debug information through the USB-TLL adapter board.
The official code provided by STM32F103:
/ * * @ brief Retargets the C library printf function to the USART. * @ param None * @ retval None * / PUTCHAR_PROTOTYPE {/ * Place your implementation of fputc here * / / * e.g. Write a character to the USART * / USART_SendData (EVAL_COM1, (uint8_t) ch); / * Loop until the end of transmission * / while (USART_GetFlagStatus (EVAL_COM1, USART_FLAG_TC) = = RESET) {} return ch;}
1. Print through the Jlink simulator:
The cortex-M3 kernel supports the ITM mechanism, and debugging information can be printed through Jlink. ITM-related functions are defined in core_cm3.h, and you need to remap fputc to ITM to implement printf.
Note:
ITM needs to use the SWD emulation port (and needs to be connected to SWO), rather than the usual Jlink emulation port.
The Port0 port of ITM needs to be activated to capture information
The clock needs to be configured in accordance with the clock of the development board.
The API SWD is as follows:
The fputc mapping code is as follows:
/ * * @ brief Retargets the C library printf function to the USART. * @ param None * @ retval None * / PUTCHAR_PROTOTYPE {# ifdef DEBUG_USART1 / * Place your implementation of fputc here * / / * e.g. Write a character to the USART * / USART_SendData (USART1, (uint8_t) ch); / * Loop until the end of transmission * / while (USART_GetFlagStatus (USART1, USART_FLAG_TC) = = RESET) {_ _ NOP ();} return ch # endif # ifdef DEBUG_ITM / * Place your implementation of fputc here * / / * e.g. Write a character to the ITM * / ITM_SendChar ((uint32_t) ch); return ch;#endif}
The IAR configuration is as follows:
Use SWD
Simulation:
Type the data logical breakpoint at the randomvalue variable and use the Timeline window to view the randomvalue. Print random number variables randomvalue to Terminal IO window
This is the end of this article on "what are the ways to print debugging information in the IAR ITM mechanism". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.