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: Shrink SRAM sizes of STM32F0 #2005

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

ALTracer
Copy link
Contributor

Detailed description

  • Not a feature.
  • The existing problem is incorrect SRAM size declared in stm32f1.c for STM32F0 families, 20 KiB, which matches neither of them (but might have been copied from STM32F103). This interacts badly with RTT auto search.
  • This PR adjusts ram_size values to whatever documented in reference manuals, just like flash size.

Tested on 32F072B-Disco to no longer trigger lots of SWD access resulted in fault, retrying every time mainloop calls poll_rtt() and that crosses 0x20004000 boundary of a 16 KiB SRAM F072RB device to "search" for control blocks up to 0x20005000.
I think also the DUT BMF (which I ported there as a f072-if derivative) got stuck when this bug was triggering, judging by the morse blinky stopping.
My problem is specifically advertising 20 KiB on a 16 KiB device; for 32 KiB devices it's probably less of an issue (like stack not readable). I know there is mon rtt ram 0x20000000 0x20004000 as a workaround, and it indeed works, but BMD is supposed to be automatic, with no configuration.

However, on per grid pics from ST website there are more variations on SRAM/Flash than 2 TRMs contain, and I did not feel like downloading all 12 datasheets to try to match the 5 part IDs to them, but note that there is F_SIZE at 0x1FFF_F7CC for a 16-bit flash size in kibibytes that someone could try to read as a better alternative to static flash capacity associations.

Size increase on native is +40 bytes because the constants are no longer identical: 4,6,8,16,32 not 20.

Your checklist for this pull request

Closing issues

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.

We presume these were taken from the TRMs, so looks good to us - merging once this has been rebased on main. Thank you for the contribution!

@dragonmux dragonmux added this to the v2.0 release milestone Dec 16, 2024
@dragonmux dragonmux added the Bug Confirmed bug label Dec 16, 2024
@ALTracer ALTracer force-pushed the fix/stm32f0-ramsize branch from 64d3699 to c5a2166 Compare December 16, 2024 09:24
@dragonmux dragonmux merged commit c5a2166 into blackmagic-debug:main Dec 16, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants