-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pr cmsis dap rebase #2
Pr cmsis dap rebase #2
Conversation
Add Serial Wire Debug Port interface driver API and bit-bang driver. The driver requires a simple Hardware Interface Circuits (HICs), where signals CLK, DOUT, DIN, ENn, OE_ENn, RESETn are connected to board GPIOs and buffered signals SWD_CLK and SWD_DIO to the target. Signal OE_ENn controls the direction of the Serial Wire (SWD_DIO), ENn the buffers SWD_CLK possibly others and enables/disables HIC. Signed-off-by: Johann Fischer <[email protected]> Signed-off-by: Johann Fischer <[email protected]>
Add CMSIS-DAP compatible controller which is a handler between the host interface and SWD driver. The controller follows CMSIS-DAP reference implementation. It expects a request buffer from the host interface, splits it to simple transfers and forwards to the DP driver, and finally returns a response buffer to the host. Interface to the host can be implemented with USB HID device support. Controller implements only SW-DP support and is tested with pyOCD and ADIv5.x. Signed-off-by: Johann Fischer <[email protected]>
Add cmsis dap sample using USB HID as interface. Signed-off-by: Johann Fischer <[email protected]>
this also fixes a bug where the packet size returned was only 17 byte. Signed-off-by: Johan Carlsson <[email protected]>
if a host client crashes or does not disconnect probe would otherwise hang. allow a new connection without raising errors. Signed-off-by: Johan Carlsson <[email protected]>
removed const from callback to make it easier to handle request and respose like the other code would. Signed-off-by: Johan Carlsson <[email protected]>
Signed-off-by: Johan Carlsson <[email protected]>
@@ -17,6 +17,13 @@ config CMSIS_DAP_PACKET_COUNT | |||
help | |||
Maximum packet buffers for request and response data. | |||
|
|||
config CMSIS_DAP_PACKET_SIZE | |||
int "Maximum packet size for request and response data." |
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 Kconfig has to be removed because this value is used to set wMaxPacketSize field in CONFIGURATION descriptor.
The endpoints are bulk, therefore the only valid options (Universal Serial Bus Specification Revision 2.0 5.8.3 Bulk Transfer Packet Size Constraints) are:
- 8, 16, 32 or 64 on Full-Speed device (or High-Speed capable device operating at Full-Speed)
- 512 on High-Speed device operating at High-Speed
Legacy USB stack (i.e. not device-next) is not really suitable for properly handling High-Speed (the problem is with High-Speed device operating at Full-Speed). The next stack is better on this.
While the 8/16/32/64 max packet size choice can seem arbitrary to the application software, there are cases where the USB device controller does not support all of the options. Due to this is better for the USB stack to handle the endpoint sizes.
For the old stack probably the best that can be done is probably just use 64 for Full-Speed and 512 when CONFIG_USB_DC_HAS_HS_SUPPORT
is defined. This will exhibit the problem with High-Speed operating at Full-Speed, but fixing that in legacy stack seems infeasible.
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.
Would it be enough to set the default based USB_DC_HAS_HS_SUPPORT
and add a help text?
Or do you think the risk of misconfiguration is too high?
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 don't think it should be Kconfig at all. There are already way too many Kconfigs that can give you essentially-broken-but-compiling code and this is going to be just another one.
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 Kconfig option is not exclusive for USB transport. You have to adapt it according to your transport layer needs.
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.
Right, the idea was to potentially have DAP over BLE at some point.
730e783
to
1022090
Compare
@jfischer-no We talked about the speed of probes that use zephyr_gpio instead of writing to registers directly. |
Just tested on the Raspberry Pi Pico (rp_2040), which needs the new DAP command I implemented and it works fine! |
config CMSIS_DAP_PROBE_VENDOR | ||
string "Probe vendor" | ||
default "Zephyr" | ||
|
||
config CMSIS_DAP_PROBE_NAME | ||
string "Probe name" | ||
default "CMSIS-DAP" | ||
|
||
config CMSIS_DAP_BOARD_VENDOR | ||
string "Target board vendor" | ||
default "" | ||
|
||
config CMSIS_DAP_BOARD_NAME | ||
string "Target board name" | ||
default "" | ||
|
||
config CMSIS_DAP_DEVICE_VENDOR | ||
string "Target device vendor" | ||
default "" | ||
|
||
config CMSIS_DAP_DEVICE_NAME | ||
string "Target device name" | ||
default "" | ||
|
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.
These options are more problematic than others in terms of multi-instance support.
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.
AFAICT, the cmsis_dap.c part only supports one instance. Maybe we can defer that multi-instance support to a later PR entirely.
@jfischer-no thanks for the review! I'll try to fulfill the requests, but it might take a while to separate the commits. |
b079234
to
a922397
Compare
Signed-off-by: Maximilian Deubel <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
This is a requirement for CMSIS-DAPv2 Signed-off-by: Maximilian Deubel <[email protected]>
79ded34
to
bb8ab24
Compare
@jfischer-no @tmon-nordic please have another look. I tended to the request where I had an idea to fix. Might need more input if more things need to be fixed. |
bb8ab24
to
418876d
Compare
This patch refactors the usage of MS OS 2.0 descriptors in the WebUSB sample. The function subset header was removed since it is not allowed for non-composite devices. Also, a new random GUID was added for automatic driver installation. Signed-off-by: Maximilian Deubel <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
00f8c5b
to
7b4e00d
Compare
7b4e00d
to
c22584c
Compare
36daa53
to
15569a2
Compare
Applied to upstream PR with significant changes. |
No description provided.