Embedded OS entry notes-use RTX as a case: 10. Support for RTX debugging of Keil

Source: Internet
Author: User
Embedded OS entry notes-use RTX as a case: 10. Support for RTX debugging of Keil

Debugging is an important part of software development. For embedded development, this part is actually dependent on the support of some hardware resources (hardware debugger. Debugging of traditional embedded systems depends on breakpoint and single step through ). However, the arm cortex-M series chip has strong support for coresight chip debugging. It is actually a small debugging hardware. As an arm standard, it is embedded in the ARM chip. With the help of arm's own debugger ulink-pro, you can implement very powerful debugging functions such as code coverage, code analysis, and code performance analysis. Cortex-M chips of different architectures support different coresight components. For details, refer to the official website.


As an arm software development tool, Keil naturally has a lot of support for debugging. Here we will briefly introduce how Keil supports RTx and OS-aware debugging (OS-aware debugging ). There are two main functions:System and process observation window(System and thread viewer), the other isEvent window(Event Viewer ).

Here we use the stm32f4discovery Board as an example.

1. System and thread Viewer)

First, this function is similar to other cortex-M chips to view memory values (Memory window or watch window). RTOS stores related process information in the memory, then the system and process observation window will extract information from the memory area. Other RTOS developers can also use this function.


The usage is very simple. First, enter the debugging mode.

In the View menu, confirm that periodic window update is selected:

Finally, in the OS support bar of the Debug menu, click system and thread Viewer:


Then we can see this window:

This is the system and process window, which provides the basic settings of the RTX system, such as the stack size, time slice settings, and basic information of the process, such as the process ID, process priority, current Process status, process Delay Time, process wait event value, current event value, and stack applicability. This window also updates the status of each process in real time, which is very useful.

For example, if all the processes are in the wait_sem (waiting for semaphores) State and only OS _idle_demon is in the running state, it is likely that the process enters the Deadlock State. During debugging, you can learn more about the real-time process.


2. Event Viewer)

Most people may have noticed the Event Viewer option in OS support When configuring the system and process window in step 1. Check it to enable this debugging function. However, this debugging function requires the support of swv (Serial wire viewer.

First, exit the debugging mode, click target option, select the debug column, and click the Settings button on the right of the debugger selection bar:



Click the trace column to enable trace, periodic and exctrc options. For other configurations, see:



Then go to the debug mode and run the task. The event window is displayed:



Clearly records the processes that are running at a specific time point and switches between them.


If you select to enable the three functions in the upper-right corner: Task info, cursor, and show cycles, and move the cursor to any process, the process information box appears:


This information includes the event that the process starts to end in the current time slice, and the maximum and minimum time slice of the process. The most important thing is this called. The data is the number of running processes, which is equivalent to the data of profiler. We can find the process with the highest number of running times and optimize the program accordingly.


3. Other RTX debugging skills

RTX provides a function to return the current time (in the unit of time set by RTX, the initial time is the time when RTX starts initialize, that is, the moment OS _sys_init ):

Current_time = OS _time_get ();

Some performance debugging functions can also be implemented by reading the current operating system time, but this requires additional debugging code written into the code.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.