Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Fix: hardcode GD32VW553 memory map#2199

Open
ALTracer wants to merge 115 commits intoblackmagic-debug:mainfrom
ALTracer:fix/gd32vw553-map
Open

Fix: hardcode GD32VW553 memory map#2199
ALTracer wants to merge 115 commits intoblackmagic-debug:mainfrom
ALTracer:fix/gd32vw553-map

Conversation

@ALTracer
Copy link
Contributor

@ALTracer ALTracer commented Mar 5, 2026

Detailed description

  • No new features.
  • The existing problem is incorrect memory map introduced by me in Feature: detect GD32VW553 #2186.
  • This PR solves it by hardcoding fixed sizes of SRAM and Flash for GD32VW553. No flash driver yet.

Tested on "LCSC-boards LCKFB-GD32VW553-HMQ6", now that it arrived, via blackpill-f411ce.

Apparently 0x1ffff7e0 reads as 0xFF, so normal autodetection code gets 65536 KiB for each, this is wrong.
User Manual and Datasheet state that there are either 4 MiB or 2 MiB of SiP flash in these parts, and 320 KiB of SRAM (last 32 KiB are "shared" mysteriously, with Wi-Fi or BLE maybe). Let's just go by that. Flash is readable.

Before:

ID code 0x10307a6d: Nuclei Systems RISC-V DTM.
ID code 0x790007a3: Gigadevice BSD.
RISC-V debug v0.13/v1.0 DMI
RISC-V debug v0.13 DM
Hart has 4 data registers and 2 progbuf registers
...
Attempting 32-bit read on misa
Hart 0: 32-bit RISC-V (arch = 00000307), rv32igcbp ISA (exts = 0010912f), vendor = a36, impl = 30700
Hart has 8 trigger slots available
-> riscv32_probe
Stub for detection of GD32VW553. DBG_ID=0x418, RAM=65535, flash=65535
***  1   GD32VW5 rv32igcbp
RAM   Start: 0x20000000 length = 0x3fffc00
RAM   Start: 0x08000000 length = 0x3fffc00

After:

ID code 0x10307a6d: Nuclei Systems RISC-V DTM.
ID code 0x790007a3: Gigadevice BSD.
RISC-V debug v0.13/v1.0 DMI
RISC-V debug v0.13 DM
Hart has 4 data registers and 2 progbuf registers
...
Attempting 32-bit read on misa
Hart 0: 32-bit RISC-V (arch = 00000307), rv32igcbp ISA (exts = 0010912f), vendor = a36, impl = 30700
Hart has 8 trigger slots available
-> riscv32_probe
Stub for detection of GD32VW553. DBG_ID=0x418, RAM=320, flash=4096
***  1   GD32VW5 rv32igcbp
RAM   Start: 0x20000000 length = 0x50000
RAM   Start: 0x08000000 length = 0x400000

Your checklist for this pull request

Closing issues

@dragonmux dragonmux added this to the v2.1 release milestone Mar 6, 2026
@dragonmux dragonmux added Enhancement General project improvement Bug Confirmed bug labels Mar 6, 2026
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.

Paired with what you've shared on Discord this seems reasonable - just needs a small clean-up and then we'll be happy to merge it. Shame that using the FLASHSIZE register won't work! But such are the realities of parts not setting things up right and such..

With the small tweak made, we'll be happy to merge this.

gojimmypi and others added 26 commits March 8, 2026 09:20
…p USB, timing, and setting up the correct vector table address
@ALTracer ALTracer force-pushed the fix/gd32vw553-map branch 2 times, most recently from ab823c1 to 9a54668 Compare March 22, 2026 13:49
hardesk and others added 16 commits March 22, 2026 16:15
TI added multiple layouts for the registers depending on a part. Implementing and maintaining it all is too much effort (and code) with dubious value.
@ALTracer ALTracer force-pushed the fix/gd32vw553-map branch from 9a54668 to aa0a072 Compare March 22, 2026 19:25
@ALTracer ALTracer force-pushed the fix/gd32vw553-map branch from aa0a072 to 6f901ad Compare March 22, 2026 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Confirmed bug Enhancement General project improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants