Well, as the title states, I've been having trouble setting breakpoints in my code for RP2040. I have a small snippet of code to just set up a PWM module and make it start running. When I start it I put the breakpoint at the beginning, when declaring variables (first image) . But when I try to debug the code, it automatically moves it to the code line 83, no matter where I do put the breakpoint (second image). I got the first hint on the debug console of the second image, where it states "automatically using hardware breakpoints for read-only addresses".
So I decided to do a little research. I tested it without using VSCode, just on the terminal. I set Openocb and gdb-multiarch and I set manually the breakpoint on line 73 (like in VSCode). As expected, it didn't work and when wrote "b 73" it automatically placed it in the line 83 (image 3).
At this point I run out of ideas, I checked the datasheet about flash memory but it is obviously a RW type of memory. It is true that it has a write protect option, but I'm not sure that's the reason it doesn't let placing software breakpoints in there.
I also tried to initialise some variables beforehand in the code, but that doesn't seem to fix the issue (if I add 10 lines of code, the breakpoint gets pushed 10 lines down).
Any idea why is this happening?
Top comments (0)