Skip to content

Conversation

maribu
Copy link
Member

@maribu maribu commented Nov 12, 2019

Contribution description

De-duplicated code by adding a common configuration for setting the programmer/debugger/serial. This also brings some new programmer support to other boards.

Testing procedure

Programmering, debugging and make term should still work as previously

Issues/PRs references

None. (But some follow up PRs are needed to also apply the config for other boards. But to keep testing to a reasonable amount, I purposely left a bunch of boards out for now.)

@maribu maribu requested review from benpicco, aabadie and smlng and removed request for benpicco, aabadie and smlng November 12, 2019 14:57
@maribu maribu added Area: boards Area: Board ports Area: build system Area: Build system Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Nov 12, 2019
@maribu
Copy link
Member Author

maribu commented Nov 12, 2019

Those are the boards not yet included in the PR. So the claimed de-duplication will finally yield some reducing in lines of code, when the transition is complete.

        modified:   boards/msbiot/Makefile.include
        modified:   boards/stm32f0discovery/Makefile.include
        modified:   boards/stm32f3discovery/Makefile.include
        modified:   boards/stm32f429i-disc1/Makefile.include
        modified:   boards/stm32f4discovery/Makefile.include
        modified:   boards/stm32f723e-disco/Makefile.include
        modified:   boards/stm32f769i-disco/Makefile.include
        modified:   boards/stm32l0538-disco/Makefile.include
        modified:   boards/stm32l476g-disco/Makefile.include


# this board uses openocd by default
DEBUG_ADAPTER ?= stlink
STLINK_VERSION ?= 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specific configuration is lost with the current change: the default is to use st-link2.1. I know the distinction no longer exists is OpenOCD master and some people are trying to merge the config (#11824) but the default version of OpenOCD is still 0.10 on release/LTS Linux distros.
At least, this PR should not change this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bluepill/blackpill has no integrated st-link. Instead, the user will have to provide an external st-link. Thus, to me it makes sense to have it default to version 2.1, which is the more common hardware. Users that use an old versions of the st-link and at the same time an old version OpenOCD can still set this manually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally with how we should deal with ST-Link, don't worry. It's just that the default version is changed. What I'm saying is that, for clarity, this should be in its own commit or in its own PR. Because for the moment, the commit doesn't mention the reason why it's removed (the default st-link version).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the change of the ST-Link version as own commit on top and added the reasoning to the commit message details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thus, to me it makes sense to have it default to version 2.1, which is the more common hardware.

Is it though? The common cheap ST-Link probe reports as STLINK V2J34S7 (API v2) VID:PID 0483:3748.

Unfortunately it seems like both by ST-Link (v2) probes are broken (can't flash with either config) but replacement from China is on it's way.

I wish OpenOCD would make another release already so we could just use interface/stlink.cfg and not care about the version difference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I have the same cheap programmers and they are (or at least were prioir to the BMP upgrade) v2.1. I bought like 40 of those for students from different vendors and every vendor had his own PCB design with a different pinout. It was quite a mess to make Black Magic Probes out of them due to the different pinouts. Apparently they also differ in software...

I'll adapt to keep it v2 for now and we can later clean up, if OpenOCD ever starts making new releases again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works with those probes with STLINK_VERSION ?= 2-1 than you can keep it - I'm just saying I can't flash it with either version with my probes, so I can't tell if it makes a difference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like the reset signal is not properly send, likely due a misconfiguration in the ST-Link firmware. I had the same issue with mine. Try pressing and holding the reset button and release the button when OpenOCD is trying to connect the bluepill during "make flash". That should work

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 16, 2019
@maribu
Copy link
Member Author

maribu commented Nov 17, 2019 via email

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the Nucleo & dfu-util changes.
I trust @maribu the ST-Link version change makes sense.

The version is only relevant for OpenOCD 0.10 anyway (which unfortunately is the latest released version).
When building from source, a common config can be used.

See #12228

@maribu
Copy link
Member Author

maribu commented Nov 25, 2019

@benpicco: Sorry for the long delay. I actually wanted to revert the version change, but forgot about this PR. I'll do it now.

@maribu
Copy link
Member Author

maribu commented Nov 25, 2019

OK. I just dropped the last commit that added the version change. Hopefully, OpenOCD just starts creating release again at some point in time. By then, this can be safely dropped without any regressions for some users.

@maribu
Copy link
Member Author

maribu commented Nov 25, 2019

@benpicco: Is your ACK still valid?

@benpicco
Copy link
Contributor

Without the version change there is nothing controversial about this.

@benpicco benpicco merged commit 7f40b13 into RIOT-OS:master Nov 25, 2019
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
@maribu maribu deleted the stm32-programmer branch February 6, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants