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

Improved chipid checks and printouts #1188

Merged
merged 4 commits into from
Sep 16, 2021

Conversation

andysan
Copy link
Contributor

@andysan andysan commented Sep 8, 2021

This pull request addresses the following issues in the chipid code:

  • Dumps of the stlink_chipid_params struct didn't include the flash_size_reg field.
  • Comparisons between legacy hard-coded param structs and the new config files was done incorrectly and included a string pointer in the comparison. As a consequence, those comparisons always failed and incorrectly printed an error message.
  • STLINK_FLASH_TYPE_UNKNOWN wasn't treated as a legal flash type value despite being used by unknown_device.chip.

N.B.: None of the chpid configs currently contain a valid flash_size_reg field, so comparisons will still fail after this patch.

The current chipid params comparison code is based on a simple
memcmp. This doesn't work since the structure contains a string
pointer. Replace it with a simple field-by-field comparison.
The chipid configuration parser currently emits a warning when it
encounters a file with the flash type set to
STLINK_FLASH_TYPE_UNKNOWN. In practice, this means that the warning
will always be printed since 'unknown_device.chip' uses this
value. Make STLINK_FLASH_TYPE_UNKNOWN a permitted value in the config
file parser.
src/stlink-lib/chipid.c Outdated Show resolved Hide resolved
Co-authored-by: Grzegorz Szymaszek <gszymaszek@short.pl>
@Nightwalker-87 Nightwalker-87 changed the title Improve chipid checks and printouts Improved chipid checks and printouts Sep 16, 2021
@Nightwalker-87 Nightwalker-87 merged commit beffed4 into stlink-org:develop Sep 16, 2021
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants