How to debug code?

How do you debug a freeRTOS code? I am working with µVision and on a code I did not write. I am trying to step through the code, so I can understand it better, but very early in the code I can’t step any further. Is this normal? I am a complete newbie and don’t understand anything.

No it is not normal. FreeRTOS is ‘just’ C code. The only complexity when debugging is the multithreading may cause some confusion. For example, if you put a break point in a function that is called from multiple tasks when the break point is hit you have to know which task you are in. Also if stepping through the code is performed by the debugger placing a break point on the next line, and a context switch occurs during the debugging step (which some debuggers won’t allow anyway because they don’t process interrupts while single stepping) then you may switch from one task to another that is calling the same function without knowing it.

I am not sure that this is what happens. I carefully observed it now and the stepping freezes as soon as the osKernelInitialize() function is reached. The system works, but I can’t see what it is doing. The event recorder also does not record anything although the event counter lists a few hundred events. Problem is that when I try to jump to the definition of osKernelInitialize(), it tells me that cmsis_os2.h contains an incorrect path. But I guess this is some Keil-related issue and I need to seek support there.

Edit: I just found out that, contrary to the notion of my superordinate, there is no freeRTOS used at all in this application. It is completely written for RTX5. Glad, that I have sorted that out…