Skip to content

Read or set MCU SRAM_CODE_MODE#113

Open
laoo wants to merge 2 commits into
ch32-rs:mainfrom
laoo:mem-split-pr
Open

Read or set MCU SRAM_CODE_MODE#113
laoo wants to merge 2 commits into
ch32-rs:mainfrom
laoo:mem-split-pr

Conversation

@laoo

@laoo laoo commented May 26, 2026

Copy link
Copy Markdown

Hi!
I know how it looks.
Yes, I don't have a clue how to program in rust and yes it is vibe coded.
But I just needed to be able to switch between various memory split models using wlink just like official WCH tools are able to.
So I plugged WCH-link to my USB Packet viewer, connected a devboard with CH32V307 and dumped transmission from few sets and gets of memory assignments.
Then I chatted with GPT-5.3-Codex and it parsed the logs, broke down the transmission, found that for this function is responsible a pair of 0x0d/0x17 and 0x0d/0x18 commands and added implementation of new mem-split CLI command.
I tested it on a bunch of CH32V30X chips I have and it works. I don't have CH32V20X so I don't know how it will behave there, especially as GPT decided to use old 0x0d/0x04 and 0x0d/0x05 commads documented in protocol.md for it.
If someone would like to test it I made a release on my fork.
I have no idea whether it resulted with a good rust so I won't be worried if this PR will be declined but it would be great to add such function to main based on my research. I can add dumps of USB comminication and scripts to parse it when needed.
In case of a review I'd be happy to help but only I can do is to give it to the chat and hope that it will produce something ok-ish enough, as I said I don't speak rust :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant