How about setting up debugging with BlackMagic Probe

What could be included in further releases, or for the forum.
User avatar
RogerClark
Posts: 5465
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby RogerClark » Fri May 01, 2015 11:33 am

Rick,

I've had a go at compiling BMP from the repo you linked to https://github.com/blacksphere/blackmagic, using Windows and MinGW

But libopencm3 won't compile :-(

I'll give it a go tomorrow on Linux tomorrow

User avatar
RogerClark
Posts: 5465
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby RogerClark » Sun May 03, 2015 10:20 am

Unfortunatly that repo doesn't compile under Linux either.

Lots of linker errors about code not fitting but also

cdcacm.c undefined reference to trace_buf_drain

I don't think its worth trying to debug BMP.

Its easies just to use Texane-stlink, at least to start with albeit it uses prioprietary hardware.


I'm going to try to setup the Eclipse CDT Standalone debugger on a Linux machine, but it looks like I have to do a full install of Eclipse CDT first - shame the standalone debugger cant seem to installed "standalone" ;-)

I will let you know how I get on.

User avatar
Rick Kimball
Posts: 722
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby Rick Kimball » Sat May 16, 2015 11:07 am

So I went ahead and made the BMP code work for the generic stm32f103c8 boards. You can find a downloaded that contains pre compiled binaries and source code here: viewtopic.php?f=37&t=122

I think I've done poorly in my attempts to explain why BMP is a good thing, I'm going to add some reasons why this is the best approach for both upload and debugging. Listed in no particular order (BMP == Black Magic Probe Firmware):

  • BMP is a commercial product that happens to provide their code as open source.
  • BMP takes the place of 3 binaries you are maintaining as part of this port.
    • You don't need st-write because BMP will let you load files.
    • You don't need the texanne/st-util on the host side to do debugging, the gdb server is built into the BMP firmware.
    • The DFU-Util isn't required to put code on the board now.
    • The only required host side code is already provided (arm-none-eabi-gdb). It is part of the linaro arm gcc you get when you install the Due compiler.
  • BMP isn't proprietary like the ST-Link device. ST has never released the internal protocol for the ST-Link device. The texane code and openocd were able to add support after someone reverse engineered the usb protocol for st-link. This could change in the future.
  • BMP provides both flash write upload and debug on the same interface.
  • BMP provides a Virtual COM port for free. Those cheap ebay st-link clones don't, they are st-link v2 not v2.1. When you use a virtual com port and a hardware USart on your Arduino code you benefit in these ways:
    • USBSerial in the libmaple isn't free. It takes FLASH, RAM, and CPU cycles away from your code. It has to service the USB data and heartbeat requests on a very strict schedule and will take time away from with other interrupt handling.
    • When you reset your target board, you lose any Serial connections. If you are in a terminal emulator, it will go away.
    • The USBserial code uses RAM and Flash you could be using for your program. The USart code is much smaller and is only using CPU when data is sent or received. When no serial data is flowing, no cpu is used.
    • You don't need to buy an FTDI/CH302/CP210x/PL2303HX/generic usb to serial dongle.
  • You never have to twiddle boot pins to be able to program the device. BMP has the ability to connect under reset, which is like pulling the BOOT0 pin high.
  • BMP was originally written on the stm32f103c series. This is the exact same hardware we are using.
  • You can bootstrap your development environment from nothing. All the source code is available for everything.
  • BMP is written using libopencm3. The libopencm3 project might be a good alternative to libmaple going forward. With the same API it supports more STM32 series than libmaple. In addition, it has also been ported to other ARM coretx-m chips from other vendors (NXP, TI).
  • I'm sure I could come up with more if you aren't convinced :)

Anyways, I'm going to modify platform.txt and boards.txt to support this.

-rick
Last edited by Rick Kimball on Sun May 17, 2015 2:47 am, edited 1 time in total.
-rick

User avatar
RogerClark
Posts: 5465
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby RogerClark » Sun May 17, 2015 12:47 am

I think for most people to be able to do this, you're going to need to document in detail how to build BMP for various devices, and program the hardware as well as how to connect the BMP, and how to use it

This would need to be done for Windows as well as Linux, as the majority of users are on Windows

I've had very little feedback from my thread about how we can get a cross-platform version of a GUI to GDB, so I suspect at the moment not many people want to do this, or its just in the "too hard" basket.

Its a shame, because I think In Circuit debugging would be a huge benefit to everyone.

Its also a chicken and egg situation, I don't think people are buying the hardware, e.g. STLink, (or another board to run BMP on), as at the moment there isn't an easy way to use it. And... because hardly anyone has the hardware, there isnt much impetus to get he SW side sorted out.

User avatar
Rick Kimball
Posts: 722
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby Rick Kimball » Sun May 17, 2015 12:52 am

My vision for this code is that people just buy one of those boards and upload the supplied binary to it using a serial device. The IDE would do the rest of the work. My goals are pretty limited right now. Step 1, provide a burn bootloader to a "BMP" programmer that does just that. Step 2, provide a menu item that lets you upload using BMP in addition to stlink and serial.

-rick
-rick

User avatar
RogerClark
Posts: 5465
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: How about setting up debugging with BlackMagic Probe

Postby RogerClark » Sun May 17, 2015 3:35 am

Rick

Sounds good. I did think about the Burn Bootloader option, but I'm not sure how thats patched into the IDE.

I took a look in the 3rd party spec doc https://github.com/arduino/Arduino/wiki ... cification

and it was useless

Burn Bootloader

TODO...


:lol:

But I see in the same doc it has
tools.avrdude.bootloader.pattern=[......]
[.....]


so I guess its a question of reverse engineering what the AVR does

Interestingly the IDE is really buggy about this, if you select an invalid combination of board and programmer you get a load of java messages

Error while burning bootloader.
java.lang.NullPointerException

etc
etc


which isn't a good look


Return to “Ideas & suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest