Skip to main content
Visitor II
February 2, 2021
Question

Which ST-LINK tool is recommended for Linux?

  • February 2, 2021
  • 6 replies
  • 14381 views

Hello,

I'm trying to get up to speed with STM32 development with Linux. I've downloaded the STM32CubeIDE as a flatpak, but it looks for an "ST-LINK" utility.

Is there a recommended "official" tool for Linux?

I am aware of the F/OSS st-link utility at GitHub, I'm wondering if this is the "official" recommendation. (If yes, I do have a number of questions regarding ST-LINK connections to my board. But I thought I'd try the "official" way of doing things before confusing everyone with questions about non-standard tools :) )

I'm using an STM32-H743ZI2 devboard.

Thanks & Cheers

    This topic has been closed for replies.

    6 replies

    Graduate II
    February 2, 2021

    You can run Stm32CubeProgrammer and friends on linux, but probably the right java version is needed. You can use openocd, pyocd and bl*ckm*gic with Stlinks> V1.

    FBert.1Author
    Visitor II
    February 3, 2021

    Hello Uwe,

    thanks a ton!

    STM32CubeProgrammer can connect "under reset", apparently. After connecting once under reset, it can connect again and again, even after power cycle. This is good, but has me worried a little, because apparently it did more than just "connect", it must have modified settings on the board. Not exactly what I'd be expecting from "connect".

    In any case, this means that the problem is not (primarily) ST's anymore, it's 3rd party tools that need some attention.

    I really want an F/OSS tool, so I'll give the others you ennumerated a try, in particular openocd.

    Thanks again & Cheers,

    F.

    Graduate II
    February 3, 2021

    The problem is to connect the debugger when it is (deep) sleeping. The debugger once attached can set bits in the DBGMCU to help connect next time. As I am biased, try in reverse order :)

    FBert.1Author
    Visitor II
    February 3, 2021

    Ah, so that would explain why st-link still isn't able to connect although the CubeProgrammer is.

    I'm reading my way up your magic then :)

    FBert.1Author
    Visitor II
    February 3, 2021

    Do I understand this correctly that I need to flash the BM firmware onto the st-link device? How do I flash the device then, using a gdb through the BM interface? (We can also move this discussion elsewhere if it's more appropriate...)

    Graduate II
    February 3, 2021

    With bl*ckm*gic hosted ( bl*ckm*gic compiled for the PC) you can run on original STlink V2 and V3. Only if you want to get rid of the restrictions of the ST firmware, you need to reflash.

    FBert.1Author
    Visitor II
    February 3, 2021

    To give a follow-up, BM host mode says:

    # src/...
    INFO: Trying Stlink reset
    Please update Firmware

    After a firmware upgrade to V3J7M3 conenction to ST-LINK, it now says:

    # src/...
    Listening on TCP: 2000

    which, I take it, means that the connection works. The st-link utility also appears more friendly:

    # st-info --probe 
    Found 1 stlink programmers
     version: V3J7
     serial: 303032413030334633343338353130433334333133393339
     hla-serial: "\x30\x30\x32\x41\x30\x30\x33\x46\x33\x34\x33\x38\x35\x31\x30\x43\x33\x34\x33\x31\x33\x39\x33\x39"
     flash: 2097152 (pagesize: 131072)
     sram: 131072
     chipid: 0x0450
     descr: H74x/H75x

    But BM was the only tool that told me it's the firmware that appears to be the problem, so you definitely have my Karma points for that :) I'm also very interested in the scripting and remote-flashing capabilities of BM.

    (Why is bl4ckm4gic a banned word?!)