Open thirstyone opened 1 year ago
write-mem is not for "write-flash". You can check out the chip manual for memory split.
I am looking at Figure 1-2. Memory address map. So, what are the valid addresses for write-mem (and btw, what are the valid addresses for write-reg?) So, there's no way to alter a few bytes in the flash with wlink?
https://github.com/ch32-rs/wlink/blob/59459e298906ec41283595cbe3ac86dd08b6cac9/src/dmi.rs#L495-L508
It's more complex. Flash requires erasing by pages and programming by sectors.
You cannot expect a command line tool to flash with complex erase and program sequence. But you can always use it as a library to do it.
something strange is going on. the first time I did wlink dump 0x08003fc0 64 i got:
Then immediately I did it the second time: wlink dump 0x08003fc0 64 I got:
See the changes in chip id? then I did wlink write-mem 0x08003fc0 0:
23:57:28 [INFO] WCH-Link v2.11 (WCH-LinkE-CH32V305) 23:57:28 [INFO] Attached chip: CH32V003 (ChipID: 0xffffffff) 23:57:28 [INFO] Write memory 0x00000000 to 0x08003fc0
Then I rechecked it with wlink dump 0x08003fc0 64 and got:So, I tried once again: wlink write-mem 0x08003fc0 10 and got
After checking with wlink dump 0x08003fc0 64 I got:
What is going on with chip-id? am I doing something wrong?