Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) RP2040 debugging (Read 317 times)
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
RP2040 debugging
Apr 28th, 2025 at 1:02pm
Print Post  
Hello, I'm have a problem with debugging on a RP2040 with a RPI Debug Probe. Debugging has previously worked but now will load, pause and resume but will not stop on a breakpoint. Inserting __breakpoint(); works. I was originally trying on my own board but to rule that out I've created a simple sketch on a pico that exhibits the same issue. Any ideas ?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #1 - Apr 28th, 2025 at 1:05pm
Print Post  
Thanks for the report, have you set more than 2 breakpoints in the sketch?

Can you also attach the XA0376B.ino_DebugOpenOCD.log logfile from the build folder for us to review?
  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #2 - Apr 28th, 2025 at 6:16pm
Print Post  
Hi found file in   C:\Users\fmc\AppData\Local\Temp\VMBuilds\XA0376B\rp2040_rpipico\Debug
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #3 - Apr 28th, 2025 at 6:19pm
Print Post  
Tried one and two breakpoints, no more.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #4 - Apr 29th, 2025 at 12:32pm
Print Post  
Thanks for the logs and detail, we have replicated this and the important setting appears to be the "Debug Level" set on the vMicro Menu.

From the log it has been set to "All" but the option for "Debug Port" has not been set.

Option 1: 
Set the "Debug Port" to "Serial, and build and upload again, and starting a debug session.
Do you find the sketch stops on the breakpoint as set in the INO file?

Option 2:
Set the "Debug Level" and "Debug Port" to "None", and build and upload again, and starting a debug session.
Do you find the sketch stops on the breakpoint as set in the INO file?
« Last Edit: Apr 29th, 2025 at 12:36pm by Simon@Visual Micro »  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #5 - Apr 29th, 2025 at 3:03pm
Print Post  
option 1: WORKS.
Launching Debugger...
Program Running 'XA0376B'
User Experience: The serial debugger was delayed waiting for an incoming line of data. tips: Use WhenHit>=millis to limit the packet data rate. Dont overload the serial by sending your own serial from a fast loop. If the Serial.print() command is used between breakpoints, then ensure that a line termnator is sent using .println() or .print("\r\n"). Optionally, use #if defined(VM_DEBUG) to add code that is only active when debugging. (if this is expected then switch this user experience message off in tools>options>visual micro>micro debug)
14:43:53.719    XA0376B.ino, line 15      loop()
XA0376B is paused at XA0376B.ino, line 15, loop()
XA0376B Running
14:44:00.435 [up:17s:741ms perf:0ms]   XA0376B.ino, line 17      loop()
XA0376B is paused at XA0376B.ino, line 17, loop()
XA0376B Running
14:44:04.698 [up:21s:999ms perf:100ms]   XA0376B.ino, line 15      loop()
XA0376B is paused at XA0376B.ino, line 15, loop()

Set port to disabled and level to none.
Serial debug still works.
Changing back to debug probe it worked first time, 2 breakpoints set and stopped at both. Closed VS, reopened, didn't work back to pause only no breaking.
tried swapping between serial and debug-probe ant debug-probe 'occasionally' works ?

Info : RP2040 Flash Probe: 33554432 bytes @0x10000000, in 8192 sectors
Info : Padding image section 1 at 0x10012cc8 with 56 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x10012d00 .. 0x10012fff
** Programming Finished **
** Verify Started **
** Verified OK **
     The upload process has finished.
# Copy build result to 'Project>Property Pages>Intermediate Directory'
# Destination: "file:///C:/Users/fmc/OneDrive/Projects/vMicro/DBGTST/XA0376B/obj/ARM/Debug/"

 
// MI Debugger Properties
{
  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "C:\Users\fmc\AppData\Local\Temp\VMBuilds\XA0376B\rp2040_rpipico\Debug",
  "MIDebuggerPath": f\bin\arm-none-eabi-gdb.exe",
  "MIDebuggerArgs": "",
  "debugServerPath": "C:\\ProgramData\\vmicro\\tools\\openocd-rpi-0.12.0.20240923\bin/openocd.exe",
  "debugServerArgs": "-d2 -l .ino_DebugOpenOCD.log}\" -s \"C:\ProgramData\vmicro\tools\openocd-rpi-0.12.0.20240923/scripts/\" -f s-dap.cfg\" -c \"adapter speed 5000\" -f cfg\" -c \"adapter speed 5000; init; reset halt\"",
  "setupCommands": [],
  "program": no.elf",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  },
  "showDisplayString": true
}

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #6 - Apr 29th, 2025 at 3:09pm
Print Post  
Sorry please keep this thread to only the Hardware Debugging with the Debug Probe, so it remains focused and readable.  The Serial Debugger works in a very different way to the Hardware Debugging the thread was started with.

Can you confirm what happens if you leave Hardware Debugging enabled and change the options as requested?
  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #7 - Apr 29th, 2025 at 3:20pm
Print Post  
Not sue if it helps, a screenshot from when it works.
« Last Edit: Apr 29th, 2025 at 3:34pm by Simon@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #8 - Apr 29th, 2025 at 3:36pm
Print Post  
Thanks, we have changed the screenshot so its viewable in the thread.

What Board options worked when you took this screenshot?
  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #9 - Apr 29th, 2025 at 3:49pm
Print Post  
I didn't change any settings between serial / hardware.
Both times port disabled and level none.

"C:\Users\fmc\Pictures\Screenshots\Screenshot2025-04-29164013.png"
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #10 - Apr 29th, 2025 at 3:53pm
Print Post  
Ok, thanks for clarifying the solution that worked was to disable the Board Option for the Debug Level.

Is this now reliable (when not switching between Serial and Hardware Debugging)?

We just wanted the resolution to be clear in case other users' ran into the same issue when using the Hardware Debugging.
  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #11 - Apr 29th, 2025 at 3:57pm
Print Post  
No, it's not fixed it occasionally will stop at breakpoints, it seems only to happen if I run the serial debugger and then the debug-probe.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #12 - Apr 30th, 2025 at 9:09am
Print Post  
Thanks for the update and the additional logs yesterday.

Can you try:
1) Put the RPi Debug Probe into BOOTSEL Mode (Hold the boot button down whilst connecting it to the USB Lead, the case may need popping open)
2) Run the attached command in the command line
3) Save the output or attach a screenshot so we can ensure we are running the same firmware/silicon for our testing
« Last Edit: Apr 30th, 2025 at 9:11am by Simon@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #13 - Apr 30th, 2025 at 9:21am
Print Post  
tool\4.0.1-8ec9d6f\picotool.exe info -a
Program Information
none

Fixed Pin Information
none

Build Information
none

Device Information
type:        RP2040
revision:    B2
flash size:  2048K
flash id:    0xE660C0D1C77A172F
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #14 - Apr 30th, 2025 at 11:42am
Print Post  
Thanks for the detail.

Can you try changing the vMicro > Debugger > Optimization to "No Optimization" and then try rebuilding, uploading and debugging again?

From our tests this is far more reliable and the debugger no longer gets stuck within delay() any more.
  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #15 - Apr 30th, 2025 at 12:12pm
Print Post  
Hi, no difference, clean and rebuild, tried running and program attach, no change.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: RP2040 debugging
Reply #16 - Apr 30th, 2025 at 9:22pm
Print Post  
Apologies for that not being the solution.

On the v4.5.2 Board Package
If you open vMicro > Project Properties > Micro General Section > Configuration Extra Flags, and enter the text "-fno-lto", then save and reupload the project, this should resolve the issue from further testing and investigation.

Alternatively rolling the board package back to v4.4.4 should resolve the issue.
« Last Edit: Apr 30th, 2025 at 10:30pm by Simon@Visual Micro »  
Back to top
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #17 - Apr 30th, 2025 at 11:12pm
Print Post  
Hi, that didn't work so tried some others ... 4.0.1 is the last version that WORKS  Smiley
  
Back to top
 
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #18 - yesterday at 6:33am
Print Post  
Hi, so, my test project debugs OK under 4.0.1 but going back to my real-world project the debugger seems to fail to launch ?

For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
Note: automatically using hardware breakpoints for read-only addresses.
0x000000ea in ?? ()
Debugger was unable to continue the process.
  
Back to top
 
IP Logged
 
FrankieM
Junior Member
**
Offline


Posts: 18
Joined: Mar 9th, 2023
Re: RP2040 debugging
Reply #19 - yesterday at 7:36am
Print Post  
Deleted all breakpints and restarted, it at-least connects but seems to 'lock up':

Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
Note: automatically using hardware breakpoints for read-only addresses.
0x000000ea in ?? ()

Thread 1 "rp2040.core0" hit Breakpoint 1, main () at \rp2040\main.cpp:83
83          set_sys_clock_khz(F_CPU / 1000, true);
Failed to select multidrop rp2040.dap0

I can't exit debug, have to use taskmgr to kill openocd and sometimes arm0-none.....

Dropped adapter speed to 250k [I'm still using the same pico and debugprobe as in test-project] ?
It seems to get further and WILL stop at a breakpoint in setup but fails to hit the second breakpoint.


Note: automatically using hardware breakpoints for read-only addresses.
0x000000ea in ?? ()

Thread 1 "rp2040.core0" hit Breakpoint 1, main () at \rp2040\main.cpp:83
83          set_sys_clock_khz(F_CPU / 1000, true);

Thread 1 "rp2040.core0" hit Breakpoint 2, setup () at C:\Users\fmc\OneDrive\Projects\vMicro\XA0476B/XA0476B.ino:119
119            Init_NVM();                                                                                                      // Check validity
Failed to select multidrop rp2040.dap0
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint