Author Topic: Flash and debug a CH32V003 with only a Pico + GDB  (Read 4170 times)

0 Members and 1 Guest are viewing this topic.

Offline tanjentTopic starter

  • Newbie
  • Posts: 2
Flash and debug a CH32V003 with only a Pico + GDB
« on: April 26, 2023, 10:15:04 pm »
Howdy, I've got some firmware for a Raspberry Pi Pico up and running that enables full GDB programming and debugging of a CH32V003 without any proprietary hardware or software (no WCH-Link, no modified OpenOCD).

Give it a try here - https://github.com/aappleby/PicoRVD
 
The following users thanked this post: paf, newbrain, willmore

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 5078
  • Country: nz
Re: Flash and debug a CH32V003 with only a Pico + GDB
« Reply #1 on: April 27, 2023, 02:39:16 am »
Cool!

Hello, Tanjent. Good work on reverse-engineering the protocol too.
 

Offline gatk555

  • Newbie
  • Posts: 5
  • Country: us
Re: Flash and debug a CH32V003 with only a Pico + GDB
« Reply #2 on: April 29, 2023, 06:49:09 am »
Nice.  Have you thought about making the firmware "self-hosting" - a version that runs on the WCH32V003?  Then in future it may be possible to buy a development board that is pre-flashed with this: a simple way into microcontroller development, similar to what can be done today with an Arduino board, and bare-chip Arduino "cores".  The only Arduino part that is really needed is the ArduinoISP sketch for firmware flashing and afterwards that framework can be forgotten.  Use of your firmware could be similar, but even less costly: 5-10X?
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 5078
  • Country: nz
Re: Flash and debug a CH32V003 with only a Pico + GDB
« Reply #3 on: April 29, 2023, 07:24:23 am »
Nice.  Have you thought about making the firmware "self-hosting" - a version that runs on the WCH32V003?  Then in future it may be possible to buy a development board that is pre-flashed with this: a simple way into microcontroller development, similar to what can be done today with an Arduino board, and bare-chip Arduino "cores".  The only Arduino part that is really needed is the ArduinoISP sketch for firmware flashing and afterwards that framework can be forgotten.  Use of your firmware could be similar, but even less costly: 5-10X?

CH32V003 doesn't have a USB interface so there's no way to use one to mediate between a host PC and a CH32V003 board to be programmed/debugged.
 

Offline gatk555

  • Newbie
  • Posts: 5
  • Country: us
Re: Flash and debug a CH32V003 with only a Pico + GDB
« Reply #4 on: April 30, 2023, 07:24:16 am »
I read the data sheet, but saw no need to go into much detail.  USB/serial converters are widely used and very inexpensive,  Or there is the more interesting possibility of bit-banging low-speed USB.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 5078
  • Country: nz
Re: Flash and debug a CH32V003 with only a Pico + GDB
« Reply #5 on: April 30, 2023, 08:12:49 am »
I read the data sheet, but saw no need to go into much detail.  USB/serial converters are widely used and very inexpensive,  Or there is the more interesting possibility of bit-banging low-speed USB.

THE PI PICO IS BEING USED AS A USB/SERIAL CONVERTER.

And protocol converter.

A generic USB/serial converter won't work, you need WCH's special one. And you need a hacked OpenOCD too.

This Pi Pico software is speaking WCH's custom 1-wire protocol on one side and standard OpenOCD on USB on the other side.

That is the whole point here.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf