ch32-rs / wlink

An open source WCH-Link library/command line tool written in Rust.
Apache License 2.0
157 stars 26 forks source link

Feature Request: Read Protection #14

Closed gicking closed 1 year ago

gicking commented 1 year ago

Hello,

is it possible to enable and disable the CH32Vxx flash read-out protection (see image below)? I understand that - at least for CH32V003 - protection is enabled by default, so I assume this must be possible somehow...?

grafik

For your advice thanks a lot in advance!

Greetings from Germany, Georg

andelf commented 1 year ago

It requires some reverse engineering. I'll check this.

septs commented 1 year ago

OpenOCD source code: https://github.com/xu7wong/openocd_wchlink

from https://www.wch.cn/bbs/thread-91946-1.html (chinese conversation)

archive: openocd-wchlink.bundle.zip

andelf commented 1 year ago

@gicking @septs After digging into the WCH-LinkUtility UI, Flash protect/unprotect is only supported by CH32V003/V103/V20x/V30x/X035.

This is implemented in the newest main branch. You can check if it works.

I haven't got a CH32X035. 😢 So CH32X035 is not supported yet.

gicking commented 1 year ago

hi,

sorry for the long delay! I bricked my CH32V003 and had to wait for a replacement chip.

I just tried protect/unprotect on the (new) CH32V003 and I can confirm that it works in my setup (Linux Ubuntu 22.04 with WCH-LINKE-R0-1v3. Thanks a lot!

Currently I have no other device to test it with, so should I close this issue...?

andelf commented 1 year ago

@gicking Thanks. I'll close this. I tested this on my CH32V003-EVT.

smaharj1 commented 7 months ago

@andelf is CH32X035 supported yet? I tried to unprotect for X035, and it did not do anything.

andelf commented 7 months ago

@smaharj1 unprotect & protect changes since old version of wlink. So I spent some time digging into the new version.