-
Notifications
You must be signed in to change notification settings - Fork 717
Pull in CMSIS-DAP support from upstream Zephyr #1823
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
Conversation
9f6aa90 to
cf2d542
Compare
drivers/dp/swdp_ll_pin.h
Outdated
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.
HAL should be used here, and in code below.
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 is from upstream zephyr - it's not the right place to change it here.
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.
It should be fixed in a follow-up PR in upstream, that would be cherry-picked as fromlist to this PR.
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.
@masz-nordic Could you give me some pointers on how to do that? nrf_gpio_cfg uses quite a few more cycles then just setting the PIN_CNF register directly. Speed is of utmost importance for this part.
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.
Could you post disassembly here? Is nrf_gpio_pin_port_decode not getting optimized enough?
We can add new functions if needed.
cf2d542 to
46e27dc
Compare
| #if defined(CONFIG_SOC_SERIES_NRF52X) || defined(CONFIG_SOC_SERIES_NRF53X) | ||
| NRF_GPIO_Type * reg = base; | ||
|
|
||
| reg->OUTSET = BIT(pin); |
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.
Can be replaced with nrf_gpio_port_out_set
| #if defined(CONFIG_SOC_SERIES_NRF52X) || defined(CONFIG_SOC_SERIES_NRF53X) | ||
| NRF_GPIO_Type * reg = base; | ||
|
|
||
| reg->OUTCLR = BIT(pin); |
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.
Can be replaced with nrf_gpio_port_out_clear
| #if defined(CONFIG_SOC_SERIES_NRF52X) || defined(CONFIG_SOC_SERIES_NRF53X) | ||
| NRF_GPIO_Type * reg = base; | ||
|
|
||
| return ((reg->IN >> pin) & 1); |
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.
nrf_gpio_pin_read
|
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
|
Is this going to be obsolete by upmerge? |
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]> (cherry picked from commit 3cf630f)
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]> (cherry picked from commit 7c9259a)
This also fixes a bug where the packet size returned was only 17 byte. Signed-off-by: Johan Carlsson <[email protected]> (cherry picked from commit e46e723)
If a host client crashes or fails to disconnect, the probe will hang. Allow a new connection without raising errors. Signed-off-by: Johan Carlsson <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit f5ccc3c)
Move low-level GPIO functions to a separate file and use GPIO driver API if low-level GPIO support is not available for the platform. Allows alternative pin configuration using only two pins, clk and dio. Improve binding description. Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 3ef2c66)
Add API to read count bits from SWDIO into data LSB first. Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 3e8f9fb)
Implement wait for SWJ pins command. Signed-off-by: Maximilian Deubel <[email protected]> (cherry picked from commit 6522dd7)
Add support for DAP_INFO string elements. Signed-off-by: Maximilian Deubel <[email protected]> (cherry picked from commit 58d9d88)
Add ID_DAP_UART_* command definitions and react properly to unsupported UART commands. Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit e31cdc0)
DAP SWD sequence command is a requirement to support CMSIS-DAPv2. Raise supported version to "2.1.0". Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 9a9afb0)
…rface Add CMSIS DAP sample using USB as interface. Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 94f48c7)
Use k_timepoint_t for timeout handling in the swj_pins function. Signed-off-by: Maximilian Deubel <[email protected]> (cherry picked from commit 05a45a1)
Hardcode the lookup table for SWDP requests. This is an optimization to save some space. Documentation was added to understand the values. Signed-off-by: Maximilian Deubel <[email protected]> (cherry picked from commit f1b6073)
This patch adds documentation for the SWDP API. Signed-off-by: Maximilian Deubel <[email protected]> Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 96112ad)
This patch updates the SWD clock calculation to the latest behavior of DAPLink. Upstream PR: zephyrproject-rtos/zephyr#74969 Signed-off-by: Maximilian Deubel <[email protected]>
Since CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is tied to the slow RTC clock for the nRF53, use the default SYSCLK of 64MHz instead. Upstream PR: zephyrproject-rtos/zephyr#74969 Signed-off-by: Maximilian Deubel <[email protected]>
This patch changes GPIO initialization to be in PORT_OFF state by default. Also, if no transceiver is attached to the signals, the GPIOs are configured to be disconnected to preserve power. I tested this on a prototype board where we are going to have a debugger in a low-power context. Signed-off-by: Maximilian Deubel <[email protected]>
472e5f8 to
ebd0545
Compare
|
We have a version of this as a patch on hello.nrfcloud/firmware. Since this is upstream, it will reach us eventually. |
No description provided.