Debugging embedded software is one of my least favorite behaviors, and unfortunately, it is necessary. Fortunately, advances in technology and toolchain innovation have spawned a host of new technologies that have greatly accelerated the debugging process. Let's take a look at some of these methods, starting with traditional breakpoint debugging and more advanced instrument tracking techniques.
Tip 1# - Traditional breakpoint debugging
Every developer is familiar with traditional debugging techniques, setting breakpoints, executing code, and then stepping through the code for monitoring while monitoring registers and variable values. Breakpoint debugging is the most used technique I have seen. However, the results are not very optimistic, because breakpoint debugging is less efficient and usually produces suboptimal results.
That being the case, why do you use breakpoint debugging so frequently? The main reason seems to be that breakpoint debugging is easy to use, easy to understand, and developers are optimistic that breakpoints are the right tool for work. This optimism requires verification. Breakpoints can damage the real-time performance of the system, and at the same time suck the developer into a black hole, making it endlessly stepping through the code and blindly looking for a solution to the problem.
Tip 2#- IDE value map
Today, almost all modern debuggers and IDEs allow developers to monitor the value of variables stored in memory. The developer can select the memory location and the value refresh rate and then start the debugging session. Some IDEs have the ability to monitor the values ​​built into the IDE, while others rely on external software.
Value monitoring is very useful, and it brings more value if the monitored data is linked to a graphical representation. Drawing a value map of real-time data is extremely useful for discovering unexpected changes and verifying the generation of a particular waveform. For example, a three-phase brushless DC motor (BLDC motor). Developers who want to monitor the current and voltage of each motor bracket need to drive a very specific waveform formed by the motor. Drawing the current and voltage of each motor bracket allows the developer to see what is happening in real time.
Tip 3#-From printf to SWO
In the high-end ARM Cortex-M series of accessories, such as the M3/M4, it provides developers with additional debugging capabilities, namely the Serial Wire Viewer (SWV). The SWV also includes standard serial line debugging in addition to the serial line output (SWO). SWO can be used to do cool things like program retrieval counters, event counters, and data tracking. Developers can also customize them to set the information they want to transfer in SWO.
Many developers typically set up printf in order to get debug information from their embedded systems. In fact, instead of using a serial port pin in a microcontroller, developers can use SWO to reroute printf information through the debugger. Using the debugger in this way saves the need for a dedicated serial interface while eliminating the time and effort to develop UART and USB devices. The overhead originally used by the application is now removed through SWO and debug hardware, reducing the valuable clock cycles that are likely to be used by the application code.
Tip 4#-RTOS Tracking
Trying to see the nature of a real-time operating system (RTOS) through a representation can be quite challenging. Developers don't want to disrupt the performance of real-time systems, but they still need some way to understand the behavior of the system. This is also a trick that Blinky LEDs often use, but more recent tracking tools have been added to the developer's toolbox. For example, free commercial RTOS tools such as TraceX, SystemView, and tracealyzer.
The tracking tool allows developers to perform tracking analysis when the RTOS is idle, or when tasks are entered and exited. Developers can monitor system anomalies, response times, execution times, and many other key details needed to properly develop an embedded system. The coolest feature of the RTOS tracking tool is that they show what's going on inside the system. Reviewing and timing diagram monitoring in real-time or in log files allows developers to determine a level of confidence to gauge whether the system will function as expected or to help them identify minor problems that would otherwise take a significant amount of time Look for.
Tip 5 #- Using Instruction Tracking Technology (ETM / ETB / ETM)
Sometimes the debugging problems that developers face are only the lowest level of problems that can be imagined in the processor. The existence of tracking technology can monitor a single instruction executed by the processor. This low level tracking is very useful for monitoring branch coverage when testing and validating software. Debugging tools for instruction tracking are different from those used by developers for serial line viewing and are slightly more expensive.
Conclusion
Debugging tools and technologies have grown rapidly over the past few years, especially for high-end microcontrollers. In general, engineers are visual creatures, and tool vendors are looking for ways to stimulate visuals to reveal what exactly happens in a real-time system. Configuring the debugging tool may require some preliminary work, but it takes a little more time to design and spend less time debugging, which is really a worthwhile investment. Developers should at least be familiar with the different debugging tools and features available so that when problems arise and the system needs to be debugged, they can choose the right tool to complete the task. Have you used other techniques that can help engineers debug their systems faster and more efficiently?
Original: Debugging the Cortex-M MCU
Author: Jacob Beningo
Translator: Liu Diwei Review: Liu Xiangyu
The pin refers to the connection between the internal circuit of the integrated circuit (chip) and the peripheral circuit, and the pin constitutes the interface of the chip. According to the function, the pins of AT89S52 can be divided into four categories: main power supply, external crystal oscillator or oscillator, multi-function I/O port, and control, strobe and reset.
Terminal Pins,Terminal Hardware Pin,High Precision Terminal Pins,Terminal Pins For Pcb
Sichuan Xinlian electronic science and technology Company , https://www.sztmlchs.com