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: target discovery logic in stm32l4 #2040

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

ALTracer
Copy link
Contributor

@ALTracer ALTracer commented Jan 6, 2025

Detailed description

  • This is a couple bugfixes.
  • The existing problem exhibits as invalid CCM RAM size on STM32G474CE.
  • The PR solves it by changing the target->priv field behind typecasts to target->target_storage correct one.

Dereferencing that priv and typecasting it to stm32l4_priv_s results in unpredictable CCM sizes in BMDA and large sizes in BMF. It's for cortexm_priv_s, and the rest of this driver uses target_storage, so fix the last use of it.
Other dereferences of both priv and target_storage in other TUs seem to be okay per Qt Creator lookups (check them!)

Also, *device is not going to be NULL, it can be the 18th sentinel entry, but its device_id can be zero -- so correct the no-match branch condition which should trigger a second LUT walk.

Tested on gd32f103cb bluepillplus as bluepill.ini/stlink platform and stm32g474ceu target, BMDA as well. Gentoo gcc-13, crossdev. In particular, RTT autosearch no longer hangs up faulting in nonexistent CCM and retrying for ages.

Your checklist for this pull request

Closing issues

@dragonmux dragonmux added this to the v2.0 release milestone Jan 6, 2025
@dragonmux dragonmux added Bug Confirmed bug Regression Bug caused by a regression labels Jan 6, 2025
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!

* Extract the device entry recorded during _probe, in _attach, from ->target_storage not ->priv (AP)
* Check for nonzero device_id, because *device is either sentinel or a valid pointer into LUT
@ALTracer ALTracer force-pushed the fix/stm32l4-detect branch from a459b1c to 74fd17d Compare January 6, 2025 03:09
@dragonmux dragonmux merged commit 74fd17d into blackmagic-debug:main Jan 6, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug Regression Bug caused by a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants