Closed LovelyA72 closed 9 months ago
I have seen OpenOCD crash when an WCH-Link was used that was not in RISC-V mode, or had the latest firmware installed on it via the MounRiver IDE.
Can you show a screenshot of the device manager with "View -> Device By Container" of your WCH-Link? In the "details" view, what PID and VID does it have?
E.g.,
After installing the driver it stopped hard crashing. But it still can not upload.
Uploading .pio\build\uno\firmware.elf
Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2023-09-22-10:36)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
Warn : Transport "sdi" was already selected
Ready for Remote Connections
[wch_riscv.cpu.0] Target successfully examined.
** Programming Started **
Error: error writing to flash at address 0x00000000 at offset 0x00000000
embedded:startup.tcl:1162: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1227
at file "embedded:startup.tcl", line 1162
*** [upload] Error 1
Seems like https://github.com/Community-PIO-CH32V/platform-ch32v?tab=readme-ov-file#important-notices to me then.
Thank you so much! It now works properly. It will still be nice to be able to exit gracefully with error message when there's a driver issue instead of hard crashing.
Graceful exit would indeed be nice, however that's something WCH / MounRiver must fix, since those are their binaries. They also don't upstream their OpenOCD changes yet (although it violates the GPL), and source code releases appear only very sparingly.
I think it will be nice to offer the user choice between official closed source openocd fork or the open source minichlink from ch32v003fun. Because using the closed source fork might be some people's deal breaker.
This already works using upload_protocol = minichlink
in the platformio.ini
, I tested this with a WCH-LinkE (loaded WinUSB drivers via Zadig on Windows) and a CH32V003. That tool might however not support all chips, and its GDB is still not properly usable from within PlatformIO (#28, https://github.com/cnlohr/ch32v003fun/issues/201).
CURRENT: upload_protocol = minichlink
minichlink -w .pio\build\ch32v003f4p6_evt_r0\firmware.bin 0x08000000 -b
Interface Setup
Image written.
Found WCH Link
WCH Programmer is LinkE version 2.11
Chip Type: 003
Setup success
Flash Storage: 16 kB
Part UUID : ab-c8-ab-cd-13-de-bc-49
PFlags : ff-ff-ff-ff
Part Type (B): 07-13-bb-91
Read protection: disabled
====== [SUCCESS] Took 6.73 seconds ======
I am not able to upload a fresh project to my CH32V307VCT6 board
Context: 3221225477 in Windows is 0xC0000005 error which is an access violation error. Which means that the uploader hard crashed during the upload process.
my config:
upload log (partial):