3

I'm working with an STM32 ARM Cortex MCU. It supports a protocol called SWD (serial-wire debugging). Looking around on the web, I've found arm-none-eabi-gcc which seems to be a decent compiler, but on the hardware side I haven't really found a proper way to work with it.

I haven't been able to find an SWD programmer / debugger that is officially supported on Linux. The closest I've found was stlink which looks like a poorly maintained project. Can you please tell me what's the right way to go if I would like to work with this MCU and want to use Linux on my computer?

Venemo
  • 18,515
  • 13
  • 84
  • 125

2 Answers2

3

OpenOCD is supported, reliable and works just as well on Linux and Windows. I use it every day to program and debug the F0, F1 and F4 devices using SWD (not JTAG).

If you're an Eclipse user then the latest version of the GNU ARM Eclipse plugin will even automate the OpenOCD command line for you. I wrote a number of articles hoping to help new users on my blog.

Hardware-wise, if you're using the discovery boards then you have the requisite ST-Link support on board and don't need anything else. Otherwise there's the official ST-Link/v2 dongle and also some dodgy clones on a well known auction site.

Andy Brown
  • 11,766
  • 2
  • 42
  • 61
  • Thanks! OpenOCD does indeed sound promising. Does it work with the ST-link debugger hw? Does it support other controllers aside from STM32? – Venemo Jul 23 '15 at 09:38
  • Yes I use it every day with the official ST-Link hardware (and I tested it successfully with the dodgy clones). It supports all manner of hardware, not just the STM32. – Andy Brown Jul 23 '15 at 13:28
  • Thank you Andy. I'll take a look at the articles at your blog. :) – Venemo Jul 26 '15 at 20:43
  • I've tried OpenOCD and it's completely unreliable sometimes the breakpoints don't work. It gets confused if there are multiple cores. It seems to cache some results sometimes and watchpoints don't work at all. The flashing almost always fails and [this issue appears to be known and not fixed for 8+ years](https://forum.sparkfun.com/viewtopic.php?p=59998#p59998). That was with the Raspberry Pi Pico, but I can't imagine it's batter for other chips. – asynts Feb 16 '22 at 10:32
1

Well, texane/stlink is a properly maintained project and I use it on daily basis. Segger J-Link supports Linux as well. I have GCC ARM toolchain setup, with eclipse as my default IDE. I'm using both JLinks and STLinks for both JTAG and SWD interfaces. I wrote few articles on my blog some time back, and I can post the links if you want to.

SamR
  • 384
  • 3
  • 12
  • Stlink has more than a hundred bugs open on github and many of them are not even answered by the author. I wouldn't call that proper maintenance. Anyway, please do post the links from your blog. :) – Venemo Jul 23 '15 at 06:04