cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger steps and runs slowly

alexmungan
Associate II

I started learning embedded systems recently, and have been using the Nucleo-F303RE board with the STM32CubeIDE toolchain. Recently, I compiled a program and started stepping through it in the debugger. Everything worked fine as always. I started to modify a single line of code, but decided not to make any changes as I wanted to run the debugger again first. Despite being the exact same program, it took much longer to reach the breakpoint in main from the startup ... maybe 10 seconds instead of 1.5 seconds. Single stepping through a line or a single instruction worked, but was clearly must slower than before. Stepping over a function that writes maybe 10 registers took about 10 seconds. When I let the program run freely, it was no longer reaching a breakpoint in my SysTick handler, even though it was before. How can I get the debugger to work?

I tried cleaning the project and rebuilding, but that didn't work. I tried another simple program to make sure the board or ST_Link wasn't somehow the problem and that DID work ... so it seems to be specific to this project, but it did work earlier?? I made a new project from cubeMX from scratch and copied the application source and header files and recompiled and the problem persists. 

I'm not sure how to proceed.

7 REPLIES 7
TDK
Super User

Don't edit files while debugging or line numbers can change and affect breakpoints.

If an interrupt isn't happening, the program is likely doing something else instead. Let it run and hit "pause" to see where execution is at.

If you feel a post has answered your question, please click "Accept as Solution".

I had terminated the debug session when I started editing. Either way, I had created a whole new project, copied the code, and rebuilt the project, and the debugger still is being slow and no interrupt is being fired. 

As for the interrupt -- yes, I have clicked pause. The program is endlessly spinning in a empty while(1) { } loop in main, which does nothing but wait for this interrupt. I am not single stepping -- I am letting the debugger run free as I know the environment will not check for interrupts if single stepping instr by instr. Interrupts are enabled. ... etc. As I said, it seemed to have worked completely as expected before. Now, it is running really slowly and no interrupt. 

Show your project. Show some context for what you're doing. Look for typos. Maybe you have a breakpoint in a file that isn't even part of the project.

The problem is somewhere and you'll need to show enough information to spot it. Otherwise we're just guessing.

> the environment will not check for interrupts if single stepping instr by instr

This isn't true.

If you feel a post has answered your question, please click "Accept as Solution".

I attached 3 source files. The code is the beginnings of a minimal rtos kernel from a youtube lesson. 

TDK
Super User

It looks like you create two threads and never start the kernel.

> minimal rtos kernel from a youtube lesson

Link it.

If you feel a post has answered your question, please click "Accept as Solution".

 

Youtube Lesson 


It looks like you create two threads and never start the kernel.


The project is incomplete, and only partially implemented. I wanted to step through the debugger for the code I had so far. The SysTick interrupt should fire as far as I can tell, and I don't know why the debugger is so slow. 

Pavel A.
Super User

Try to refresh, clean and completely rebuild. Do full erase of the STM32 before debugging new firmware.