-
-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/wch link support #2061
base: main
Are you sure you want to change the base?
Feature/wch link support #2061
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do please update all the copyright strings across all the files to include the current year date. Eg 2023-2025
instead of just 2023
.
This is only a preliminary review - we still have two files to go through, but this is looking great so far.
src/command.c
Outdated
if (!scan_result) | ||
if (!scan_result) { | ||
gdb_out("SWD scan found no devices.\n"); | ||
#if defined(ENABLE_RVSWD) && defined(PLATFORM_HAS_RVSWD) | ||
#if CONFIG_BMDA == 1 | ||
scan_result = bmda_rvswd_scan(); | ||
#else | ||
scan_result = false; | ||
#endif | ||
if (!scan_result) | ||
gdb_out("RVSWD scan found no devices.\n"); | ||
#endif | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how nested this is getting, perhaps lets invert this logic by extracting the post-scan actions into their own function (this allows all scan routines to stop duplicating those same actions) so we can check if (scan_result)
and then return via that post-scan routine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some ideas to help with that and make it more future proof too, but for now some minor refactor in that direction wouldn't hurt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored the auto scan command with a for loop, this is not what I suggested I had in mind, though that would be an extension of this
This is suboptimal for the case with only 2 interfaces, but if we keep adding new ones this will eventually pay off
Let me know if it's ok by you
I have a CH32V103 and CH32V307 device to play around with. I have been able to flash the feature/wch-link-support on a blue-pill board. DOCS:
For reference and a note to self, and maybe other players:
meson setup build --cross-file cross-file/bluepill.ini \
-Dtargets=cortexm,riscv32,riscv64,gd32,ch32,ch32v,sam,stm,ti \
-Drvswd_support=true
meson compile -C build
cd build
ninja boot-bin
st-flash --flash=0x20000 write blackmagic_bluepill_bootloader.bin 0x08000000
st-flash --flash=0x20000 write blackmagic_bluepill_firmware.bin 0x08002000
|
I found some documentation on the transport layer, maybe it is helpful. |
You should never ever need to do this - these files provide defaults and you can override anything they specify on the
Unsure what this is exactly trying to achieve, but we rather recommend instead using the project udev rules as there are two serial interfaces and addressing them by serial number when there is more than one probe attached to a host becomes important. |
Thank you @dragonmux, I have updated the comment. |
Thanks for the interest! a couple notes on your comment though.
|
The order for the wch-link is no its way from China takes some time. Thanks for clarifying |
There is a bit banging implementation, in #1399 . |
That PR is already 2 years pending, is there a way I can help in moving this forward? I would love to help but if there is no one from maintainer side that is willing to help it will be to much of an uphill battle I think.. Discuss on Discord maybe? |
The main issue that PR has seen has been Perigoso's ability to commit time to it (through no fault of their own) - it's a very interesting PR and we're very much on board with getting it merged in once it's actually ready. If some more people can test it and show it all working properly that will help too. We have now properly marked it as deferred to v2.1 (we are in a feature freeze for v2.0 which is not long from being released in full), and hopefully between that and this PR we'll be able to get all the necessary support merged in for v2.1 in fairly short order, volunteer time permitting. We're happy to keep providing reviews and being a guiding hand for the process. |
I am grateful for any spare time anyone has put in. |
Required, no, not really, but testing would be very welcome :) right now the only things missing before getting what is done already properly submitted is just spit and polish. SDI implementation will be worked on after these get merged, right now just RVSWD is implemented. Note that this is just the protocol implementation, target support will come after, you're welcome to work on it for targets you have on hand. |
Also, #1399 is indeed 2 years old, but not pending, more like work in progress, it's very much up to date with upstream :) |
8d102ff
to
54ebb95
Compare
Since spec v0.13 there is an explicit version value (15) to identify dm/dmi's that do not conform with any available specs
Identify but allow non-standard DMI versions but only process standard explicitly know DM versions
This gives the swd scan function an equivalent signature to the other scan commands allowing us to group them for the auto scan command
54ebb95
to
a0daa1d
Compare
Detailed description
This is the first part of #1399 which will be broken up into smaller PR's
This adds support for the WCH-Link debug probe by WCH, it's a naive implementation based on a rough reverse engineer of the protocol, which is not publicly documented
Your checklist for this pull request
Closing issues