stm32l1: Use DBGMCU_IDCODE for part detection#2177
Open
anonymous0719 wants to merge 1 commit intoblackmagic-debug:mainfrom
Open
stm32l1: Use DBGMCU_IDCODE for part detection#2177anonymous0719 wants to merge 1 commit intoblackmagic-debug:mainfrom
anonymous0719 wants to merge 1 commit intoblackmagic-debug:mainfrom
Conversation
Otherwise STM32L152RC on stm32l152c-discovery is recognized with only 4k
a6fb4aa to
d0de91e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Otherwise STM32L152RC on stm32l152c-discovery is recognized with only 4k
Detailed description
This PR fixes incorrect device identification on the
stm32l152c-discoveryboard.Currently, STM32L152RC may be detected with an incorrect
part_id, which leads to it being recognized with only 4k, causing the wrong memory layout/flash sizing to be used.The fix is to populate
target->part_idby reading the MCU'sDBGMCU_IDCODEregister (masked to the device ID field), instead of relying onap->partno. This provides a more reliable and accurate identification for STM32L1 devices. I don’t have the stm32l152c-discovery board available to test locally, but the change is minimal and matches the downstream fix.Also as some context: we’ve been developing a tool that scans downstream forks to find valuable commits that haven’t been merged back upstream, and your repo was one of the best examples we found. This commit stood out as a small but important fix, so we manually reviewed it and are submitting it here as a PR in case it’s useful for the upstream project.
If you feel this change is not desired or there’s a better upstream approach, we’d really appreciate any suggestions — both for this patch and for improving our tool’s filtering logic. Thanks for your review!
Your checklist for this pull request