blackmagic-debug / blackmagic

In application debugger for ARM Cortex microcontrollers.
GNU General Public License v3.0
3.29k stars 774 forks source link

Fix: Shrink SRAM sizes of STM32F0 #2005

Open ALTracer opened 16 hours ago

ALTracer commented 16 hours ago

Detailed description

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