-
-
Notifications
You must be signed in to change notification settings - Fork 780
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 RISC-V support #1399
base: main
Are you sure you want to change the base?
Conversation
177c4be
to
095148d
Compare
095148d
to
d2969a1
Compare
d2969a1
to
259a359
Compare
762c495
to
f9232ca
Compare
f9232ca
to
3df1a41
Compare
3df1a41
to
7e548c9
Compare
7e548c9
to
9ac6516
Compare
Please rebase this on feature/esp32-c3-support when you get a chance. |
This is a PR I would not mind testing, But it needs rebasing. |
You can test as is, it should compile and work (and would be welcome!), that said it does need rebasing, but I'm tight on free time for a bit. Maybe at the begining of the new year. |
828ef60
to
820b35c
Compare
@koendv Got some time and rebased this on main. Unfortunately the last commit is extremely experimental and not in a state for a clean rebase, so I just reverted the files to the state on the original PR, meaning it reverts some probably important changes on the current main, beware! It should work for scan of CH32 Risc-V chips with the WCH-LinkE, I just tested. |
On Fri, 15 Dec 2023 10:22:30 -0800 Rafael Silva ***@***.***> wrote:
@koendv Got some time and rebased this on main. Unfortunately the
last commit is extremely experimental and not in a state for a clean
rebase, so I just reverted the files to the state on the original PR,
meaning it reverts some probably important changes on the current
main, beware! It should work for scan of CH32 Risc-V chips with the
WCH-LinkE, I just tested.
OK. Appreciated.
koen
|
820b35c
to
0b08aec
Compare
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.
Apparently we started a review and then failed to ever actually post it, so here we are - it's incomplete, but a start.
@@ -51,6 +51,7 @@ static bool cmd_help(target_s *t, int argc, const char **argv); | |||
|
|||
static bool cmd_jtag_scan(target_s *target, int argc, const char **argv); | |||
static bool cmd_swd_scan(target_s *target, int argc, const char **argv); | |||
static bool cmd_rvswd_scan(target_s *target, int argc, const char **argv); |
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.
This should probably be defined contingent on ENABLE_RISCV
and we'd suggest that, at least for now, this be limited to BMDA. Iff we can figure out how to implement the protocol in the firmware we can then de-restrict it by removing the suggested check for PC_HOSTED
.
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.
That makes sense, I will consider how to gate this when it's more complete, there will still be a native implementation
break; | ||
} | ||
bmda_probe_info.usb_link->interface = idx; | ||
descriptor = interface_desc; |
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.
Is this not missing a break;
after this assignment?
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 believe this was copied from JLink, which also looks like it's missing a break, I refactored it here, but it's pending on testing still.
c94ceed
to
bbdc854
Compare
In case it is helpful to make things move forward , please find attached ( as an example, there is a driver written in basic c++ here : https://github.com/mean00/swindle/blob/main/swindle/src/bmp_rvTap.cpp , it could be used as a starting point to write a native BMP driver. It is full of #define macros due to popular demand. It works with CH32V2 and CH32V3) Thank you. |
Thank you very much @mean00, I'm planing on picking this up again soon, but it might take some time to get back up to speed |
Used to mark codes that are not part of the JEP106 or any other standard but are used internally by BMD to identify targets that don't provide a usable identification codes
write_char writes a single char into a char buffer at the provided offset, returns the offset incremented by 1 Memory safety safeguards are in place, if no buffer is provided, a buffer size of 0 is given, or the offset is out of bounds of the buffer, the buffer is not accessed, but the offset is still incremented Target use case is using in special print functions behaving similar to snprintf
bbdc854
to
4dfef3c
Compare
…ogbuf when sysbus and abstract memory access is not available
4dfef3c
to
06e298d
Compare
06e298d
to
2a30df5
Compare
Detailed description
Support support for WCH RISC-V family of MCUs
WCH uses a custom DTM (Debug Transport Module) for their RISC-V MCUs, RVSWD a 2 wire SWD "like" protocol (not SWD), and a SDI 1 wire protocol
RVSWD is currently not publlicly documented, part of this implementation is the reverse engineering of the protocol, resulting documentation will be hosted here
Sigrok protocol decoder for RVSWD here
SDI documentation has been recently published, but implementation of will probably come as a separate PR
The only SDI MCU at the moment is the CH32V003, all other WCH RISC-V MCUs use RVSWD
As part of the process support for the WCH-Link debug probe by WCH is also implemented, it's a naive implementation based on a rough reverse engineer of the protocol, which too is not publicly documented
This PR might be broken down in the future
As this PR is built on top of feature/esp32-c3-support it might be hard to read, try this diff (feature/esp32-c3-support <- feature/wch-support)
Discord thread
Your checklist for this pull request
make PROBE_HOST=native
)make PROBE_HOST=hosted
)Closing issues
This PR is targeted at v2.0 milestone
Depends on #292 and feature/esp32-c3-support
Closes #1576