platform-ch32v icon indicating copy to clipboard operation
platform-ch32v copied to clipboard

minichlink debug support

Open maxgerhardt opened this issue 2 years ago • 6 comments

With https://github.com/Community-PIO-CH32V/platform-ch32v/commit/d451c465657bf796c1f6b57f0f0b710ab09e6d4c, we can now upload via minichlink. We can also start minichlink's GDB server and connect to it, however, the step into and step over controls in VSCode are broken because minichlink just hangs on the GDB step command. Thus, we depend on https://github.com/cnlohr/ch32v003fun/issues/158.

Other oddities like not supporting load were worked-around with the preload load mode in PlatformIO.

It's also an open question on how to do a reset as GDB command.

maxgerhardt avatar Jun 09 '23 14:06 maxgerhardt

With the most recent version I am getting errors on trying to upload (I had been using the using Link-E) On debian linux.

Executing task: platformio run --target upload --environment genericCH32V305RBT6 --upload-port /dev/ttyACM0 

Processing 
genericCH32V305RBT6 (board: genericCH32V305RBT6; platform: ch32v; framework: noneos-sdk)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing git+https://github.com/Community-PIO-CH32V/tool-minichlink.git#master
git version 2.39.2
Cloning into '/home/tim/.platformio/.cache/tmp/pkg-installing-s34sw55g'...
warning: Could not find remote branch master to clone.
fatal: Remote branch master not found in upstream origin
Error: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', 'master', 'https://github.com/Community-PIO-CH32V/tool-minichlink.git', '/home/tim/.platformio/.cache/tmp/pkg-installing-s34sw55g']

 *  The terminal process "platformio 'run', '--target', 'upload', '--environment', 'genericCH32V305RBT6', '--upload-port', '/dev/ttyACM0'" terminated with exit code: 1.

Seems a bit random when this is happening... Choosing "Run without debugging" seems to still upload. Hitting the upload button causes this error.

tmolteno avatar Jun 15 '23 11:06 tmolteno

I think the problem is that the branch is called "main". Modifying this in the line in the .platformio directory,

platforms/ch32v/platform.json:      "version": "https://github.com/Community-PIO-CH32V/tool-minichlink.git#master",

to

platforms/ch32v/platform.json:      "version": "https://github.com/Community-PIO-CH32V/tool-minichlink.git#main",

Allows the upload to proceed further. Uploading now works.

tmolteno avatar Jun 15 '23 12:06 tmolteno

Thanks for the info, I'll investigate this later.

maxgerhardt avatar Jun 15 '23 12:06 maxgerhardt

Might already be fixed with 131d250034d057222b27b8b75cb557290e333845, can you reinstall the platform cleanly?

rm -rf ~/.platformio/platforms/ch32v
rm -rf ~/.platformio/packages/tool-minichlink

And, this is not documented yet, but you need to have libusb installed with I think brew on Mac so that the program can startup at all.

maxgerhardt avatar Jun 15 '23 15:06 maxgerhardt

Seems to work now. Thanks

tmolteno avatar Jun 15 '23 21:06 tmolteno