With our nRF Connect SDK we introduced the usage of a Real-Time Operating System. This system is called Zephyr and strives to be the best-in-class RTOS for connected resource-constrained devices, built to be secure and safe. It helps you develop your applications by abstracting away hardware- and scheduling complexity, allowing critical processes to finish in a deterministic fashion with limited developer interaction. A lot of developers are used to scheduling these tasks by themselves and do all the bare-metal programming. What we need in order to get the same degree of insight in this way of programming is to see all threads while debugging. At a certain level of complexity it isn’t feasible anymore to spam our code with printf() and guess what the program is doing. When debugging a RTOS application it is very likely that by the time we halt the system the application will be in the idle task and we won’t be able to see much of what’s going on within the different threads or which would start next.
We want to know which thread is active and which is waiting when we debug our application. Multiple threads competing for the same semaphore might lead to some of them not executing at all just because they trigger at similar times. Seeing this, inspecting the call stack and the registers of any thread is key.
In short, we want thread awareness in our debugger.
In the video of this Blog, I’ll show you how to use SEGGER’s Ozone debugger for Thread aware debugging on a very basic example.
What you will need to follow along:
//Text for the .config file:
//Commands for the command prompt:
cd zephyr\samples\basic\threads --> to navigate to the example
west boards --> To see all the board names
west build --board=nrf52833dk_nrf52833 --> to build the board. Change "nrf52833dk_nrf52833" to your Board name
//Text for the Ozone Console to Activate the RTOS awareness for Zephyr
I also produced a short follow up video on how to do this using the SEGGER Embedded Studio IDE.