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
Very Hot Topic (More than 25 Replies) How to debug with Black Magic Probe (BMP)? (Read 3133 times)
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
How to debug with Black Magic Probe (BMP)?
Sep 27th, 2020 at 8:24pm
Print Post  
Despite everything is set to Debug (see screenshot), using a BluePill-BMP to debug another BluePill board, the sketch is just uploaded but a breakpoint is not hit.
What is going wrong?

« Last Edit: Sep 27th, 2020 at 8:25pm by arduino1 »  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #1 - Sep 28th, 2020 at 9:34am
Print Post  
Thanks for the report.

Would it be possible to attach the build log as shown at the top of the page (with Verbose and Show Build properties checked)?

If you could also attach the Micro Build log after trying to attach the debugger and any other debug output shown it will help us see what the problem is more clearly.
  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #2 - Sep 28th, 2020 at 4:02pm
Print Post  
In order to flash I have to set Boot0 to 1. Afterwards to run the sketch Boot0=0.
The Blink program runs after resetting.

Breakpoint is not hit.
Micro Build log in following message.
  

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


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #3 - Sep 28th, 2020 at 4:03pm
Print Post  
Micro built log
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #4 - Sep 28th, 2020 at 4:37pm
Print Post  
Thanks, can you also enable the below options and re-send?

vMicro > Compiler > Show Build Properties
vMicro > Compiler > Verbose

Any output when using the debugger is also very helpful.
  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #5 - Sep 28th, 2020 at 7:34pm
Print Post  
This can't work for debugging because for flashing I have to set Boot0=1, then afterwards Boot0=0 and pressing reset button to run the program. 
The BMP is connected only to the 4-pin adapter of the target Blue Pill.
Are there additional connections required to avoid the need to switch the Boot0 jumper?
« Last Edit: Sep 28th, 2020 at 7:38pm by arduino1 »  
Back to top
 
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #6 - Sep 28th, 2020 at 8:39pm
Print Post  
After having added in the advanced configurations "HardwareSerial" to "Remote Transport" (maybe I had changed also something more) the propgram is uploaded and run with Boot0=0 permanently (no switching necessary anymore).
But the breakpoint is not hit.
In the Micro Build log there is the line
Temporary breakpoint 1 at 0x8002566: file 20.8.9\cores\maple\main.cpp, line 38.
Line 38 reads "setup();"
However, that file according to its date has not been changed for months. 
So, something seems to go wrong here.
  
Back to top
 
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #7 - Sep 29th, 2020 at 7:40am
Print Post  
I guess I have to give up.
Once the breakpoint was hit using "BMP" and "ARM".
But not working anymore.
Too many ununderstood options. Additionally there are those Jumpers on the Blue pill.
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #8 - Sep 29th, 2020 at 10:20am
Print Post  
Thanks for the information so far.

Boot Jumpers - I am not aware of a workaround for this at present (but may depend on bootloader), so you have to perform the upload, move the jumper, reset the board, then press Debug > Attach to Process

20.8.9\cores\maple\main.cpp, line 38.
This implies you are trying to debug the core itself, if this is the case the optimization should be set to None on the vMicro > Debug Menu.  This file hasn't changed for a long time as it is part of the STM core.

The Remote Transport will have no effect on Hardware debugging as this is a setting reserved for the vMicro Serial Debugger.

To help us understand all of the environmental settings involved here, can you please supply:
1) Attach the logs requested previously
2) Confirm which BMP Firmware you have loaded onto the Blue-Pill acting as an BMP
3) Confirm which Bootloader Firmware you are using on the target Blue-Pill




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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #9 - Sep 29th, 2020 at 12:47pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #10 - Sep 30th, 2020 at 3:50pm
Print Post  
Simon, you have said:
"so you have to perform the upload, move the jumper, reset the board, then press Debug > Attach to Process"
Could you specify the jumper settings for upload and for debugging?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #11 - Sep 30th, 2020 at 4:11pm
Print Post  
Its just the standard Boot0 Jumper settings (1 for upload, 0 and reset to run the code).
  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #12 - Oct 1st, 2020 at 4:03pm
Print Post  
I think I have a BMP running on a Bluepill, afrer all.
I can use it from the GDB command line, and the target starts blinking.
But in vmicro it does not work.
Attached is a sreenshot with the error blink.exe not found.
This is the output from the Debug log.
=thread-group-added,id="i1"
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140228-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
=cmd-param-changed,param="pagination",value="off"
Das Programm "" wurde mit Code 42 (0x2a) beendet.

« Last Edit: Oct 1st, 2020 at 4:04pm by arduino1 »  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #13 - Oct 1st, 2020 at 4:17pm
Print Post  
Thanks for the update.  To perform debugging in vMicro you need to set the Build Configuration to Debug (shown as Release at the top of your image)

Please attach:
1) The command line you launched this with manually
2) Set the vMicro > Upload > Verbose to ON, and try attaching in vMicro.  Then attach the output from the Output > Micro Build Window

  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #14 - Oct 1st, 2020 at 5:29pm
Print Post  
(GDB) output (Vmicro built output attached. When I switch the Boot0 Jumper and attach, the .exe file not found error pops up): 
H:\blackmagic>arm-none-eabi-gdb J:\temp\arduino_build_982994\Blink.ino.elf
H:\dev_tools\gcc-arm-8\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
GNU gdb (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 8.3.0.20190709-git
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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"...
Reading symbols from J:\temp\arduino_build_982994\Blink.ino.elf...
(gdb) target extended-remote COM6
Remote debugging using COM6
(gdb) mon s
Target voltage: 1.97V
Available Targets:
No. Att Driver
1      STM32F1 (clone) medium density M3
(gdb) att 1
Attaching to program: J:\temp\arduino_build_982994\Blink.ino.elf, Remote target
0x1ffff3b6 in ?? ()
(gdb) att 2
A program is being debugged already.  Kill it? (y or n) n
Not killed.
(gdb) att 1
A program is being debugged already.  Kill it? (y or n) n
Not killed.
(gdb) load
Loading section .text, size 0x25b0 lma 0x8000000
Loading section .ARM.exidx, size 0x8 lma 0x80025b0
Loading section .data, size 0x830 lma 0x80025b8
Loading section .rodata, size 0x354 lma 0x8002de8
Start address 0x8000170, load size 12604
Transfer rate: 30 KB/sec, 840 bytes/write.
(gdb) b main
Breakpoint 1 at 0x8001da8: file M:\Arduino_Sketchbook\hardware\Arduino_STM32\STM32F1\cores\maple\main.cpp, line 38.
(gdb) continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, main () at M:\Arduino_Sketchbook\hardware\Arduino_STM32\STM32F1\cores\maple\main.cpp:38
38          setup();
(gdb) continue
Continuing.

Program received signal SIGINT, Interrupt.
0x08001e76 in micros () at 8
58          do {
(gdb)
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #15 - Oct 2nd, 2020 at 11:00am
Print Post  
Thanks for the output, and it says it failed to upload the code to the target board at the end of the output.

I have checked my setup with 2 x STM Blue Pills:-
1) BMP Firmware as described in this Article
2) The Roger Clarke Core + Blink Sketch uploaded via Serial to the second board (checked this ran before adding debugging complexity)
3) Both Boards Boot0 Jumper set to 0
4) Once both connected and powered up, I used Debug > Attach To Process to begin the debugging session.

It all works as expected on my machines.

The reason VS may not be starting the debugging could be the wiring between the two boards, or power supply to either board in the first instances.
(If VS doesn't "see" the target through the debugger it will fail, unlike the command line which only needs to see the debugger to start)

Can you confirm you have them wired together as in the diagram below? (I had a similar error when the SWD connections were reversed)


NOTE: To get it to land on the breakpoint in the main.cpp, I had to Attach the debugger, set the breakpoint, then reset the target board.
  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #16 - Oct 2nd, 2020 at 1:23pm
Print Post  
It worked. I had to used that core before (but meanwhile also did other installations like Mingw32). I have not tested yet with the Maple core that I would need.
Remark: One does not need to press Reset nor Attach to process after uploading. It smoothly runs through without that.
Question: Is there a SWO communications pin?
Other BMP compilations do have that, but so far I had no luck with SWO output....
This keeps me up for a week now... paid Vmicro since it stopped working.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #17 - Oct 2nd, 2020 at 1:41pm
Print Post  
Glad to hear its working, and thanks for the feedback about the jumpers, and your support.

Reviewing the STM32F1 Pinout it appears to be on Pin PB3 (39):
https://components101.com/sites/default/files/component_pin/STM32-Blue-Pill-Deve...
« Last Edit: Oct 2nd, 2020 at 1:41pm by Simon@Visual Micro »  
Back to top
IP Logged
 
arduino1
Junior Member
**
Offline


Posts: 75
Joined: Feb 12th, 2015
Re: How to debug with Black Magic Probe (BMP)?
Reply #18 - Oct 2nd, 2020 at 2:52pm
Print Post  
Great! The LA shows output from the PB3 port, but where to connect that one to the BMP? When I connect to PA2 of the BMP, I see "raw" output on the BMP-UART interface port. But how to see the decoded output? 
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: How to debug with Black Magic Probe (BMP)?
Reply #19 - Oct 2nd, 2020 at 3:35pm
Print Post  
Reviewing the BMP Firmware configuration for the STLink Firmware (in use in this case):

Code
Select All
/* On F103, only USART1 is on AHB2 and can reach 4.5 MBaud at 72 MHz.*/
#define SWO_UART				USART1
#define SWO_UART_DR				USART1_DR
#define SWO_UART_CLK			RCC_USART1
#define SWO_UART_PORT			GPIOA
#define SWO_UART_RX_PIN			GPIO10
 



From my understanding this means it is on Port A (GPIOA register), Pin 10 (GPIO10), so A10 labelled on the board, or PA10 on this image:
https://components101.com/sites/default/files/component_pin/STM32-Blue-Pill-Deve...

Could you confirm for us what software you are using to read the SWO information? (the STLink Utility?)
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint