Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Speed up bus turnaround for blackpill-f4 like other platforms #1690

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

ALTracer
Copy link
Contributor

Detailed description

  • This is not a feature, but may affect external/out-of-tree features (like direction GPIO for bus turnaround).
  • The existing problem is a long function call to gpio_mode_setup() in the process of high-performance bitbanging of SWD on blackpill-f4 family of platforms.
  • This PR solves the problem by porting inline code / macros existing in other platforms.

Testing on fix/tap-timing branch with a blackpill-f411ce in max frequency (~8MHz) against a STM32MP157_CM4 shows an increase of performance of loading a 64 KiB binary into RETRAM from 156 to 180 KiB/s. Impact may be less noticeable when using Flash-based targets, or using this BMF with BMDA as proxy.

I'll mention that stlinkv3 also toggles a GPIO wired to direction pin of a bidirectional level translator in the respective macros.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native) and should not affect it
  • It builds as BMDA (make PROBE_HOST=hosted) and should not affect it
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

Enhances #1688 (PR, not an Issue)

Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

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

This looks good and provides some nice consistency with the other platforms. There are a couple of review items concerning signed-unsigned conversion to sort, but with the assumption that you've tested this with a Black Pill and it works, we've got no problems merging this once those are sorted.

src/platforms/common/blackpill-f4/blackpill-f4.h Outdated Show resolved Hide resolved
src/platforms/common/blackpill-f4/blackpill-f4.h Outdated Show resolved Hide resolved
src/platforms/common/blackpill-f4/blackpill-f4.h Outdated Show resolved Hide resolved
@dragonmux dragonmux added this to the v2.0 release milestone Nov 27, 2023
@dragonmux dragonmux added Enhancement General project improvement BMP Firmware Black Magic Probe Firmware (not PC hosted software) Foreign Host Board Non Native hardware to runing Black Magic firmware on labels Nov 27, 2023
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

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

LGTM, merging. Thank you for the contribution!

* Manipulate STM32F4 GPIO MODER registers directly (a read-modify-write)
  instead of going through function calls like `gpio_mode_setup()`
* Add the two alternative pinouts to pre-cooked macros
@ALTracer
Copy link
Contributor Author

Adjusted per review items, squashed into one; and rebased to latest main.
Tested on PROBE_HOST=blackpill-f411ce ALTERNATIVE_PINOUT=1 BMP_BOOTLOADER=1 as well as default pinout against a gd32f103cb target (bluepillplus), everything seems to work -- JTAG/SWD, max frequency and lowered, BMF and BMDA and BMDA non-HL modes. Performance improvement estimates not taken.

@dragonmux dragonmux merged commit d662543 into blackmagic-debug:main Dec 29, 2023
6 checks passed
@ALTracer ALTracer deleted the blackpill-f4-swd branch January 6, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BMP Firmware Black Magic Probe Firmware (not PC hosted software) Enhancement General project improvement Foreign Host Board Non Native hardware to runing Black Magic firmware on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants