Tools – OS-Aware Debugging

The greatest annoyance that I’ve ever encountered when developing embedded software is when I have to guess at what the software is doing. Back in the day, the best insight a developer could get into their application was to blink an LED and correlate it to the code that was executing. Today’s processors and development tools don’t just let you see what is happening in the software but are also OS-Aware.

embOS OS-Aware Debugging in Embedded Studio

OS-Aware debugging is integrated debugging that provides access to OS structures and data so that a developer can better understand how the operating system is behaving and using microcontroller resources. OS-Aware debugging is being implemented in more and more toolchains and can provide developers with several key insights into their applications.

First, OS-Aware debugging can provide a developer with an overview of the tasks that are currently available, their run status and their priority level. This can let developers verify that all the tasks they expect to be in the system are still present and at the appropriate priority level.

Second, OS-Aware debugging can provide execution information such as the number of times a task has been executed. Developers can review this information to make sure that the task run ratio between different tasks is appropriate. For example, if a UART transmit task should execute in a 1:1 ratio with a UART receive task, any other ratio should be a red flag that something is not working as expected.

Finally, the most important feature around OS-Aware debugging is that the stack information for each task is available. The stack information contains the current maximum stack usage, the stack size along with where the stack is located in memory. A big issue that many developers using an RTOS face is how to properly size their task stacks. It isn’t uncommon for me to stumble across an application that has a 1kb allocated to a task that is blinking an LED and using only 68 bytes of the stack! Developers need to perform a worst case stack analysis and run-time testing with those worst conditions can help a developer properly size the stack.

OS-Aware is an important debugging tool that developers need to not just know about but also employ in their own development cycles. It can provide a developer with information about their applications that was never available before and can be very useful in optimizing memory usage and run-time performance.