Skip to content
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

Raspberry Pi Pico (RP2040) support #1083

Merged
merged 13 commits into from
Feb 26, 2021
Merged

Raspberry Pi Pico (RP2040) support #1083

merged 13 commits into from
Feb 26, 2021

Conversation

flit
Copy link
Member

@flit flit commented Feb 21, 2021

This PR includes a number of changes and additions.

Major changes:

  • RP2040 targets: rp2040_core0, rp2040_core1, rp2040 (alias for core 0). Only one core can be accessed at a time for now, pending full multi-drop SWD support.
  • picoprobe support thanks to @newbrain.

Other changes:

  • The CMSIS-DAP protocol version is read.
  • Added jtag_sequence() debug probe API.
  • Added swd_sequence() debug probe API.
  • Refactored the SWJSequenceSender class to allow sending fragments of sequences and perform any single step of the SWD <—> dormant <—> JTAG transitions.
  • Flash algo generation improvements, used to generate the RP2040 flash algo from https://github.com/rp-rs/flash-algo.

@lgtm-com
Copy link

lgtm-com bot commented Feb 21, 2021

This pull request introduces 3 alerts when merging 3614167 into 7dccf5c - view on LGTM.com

new alerts:

  • 3 for Unused import

# ------------------------------------------- #
def open(self):
# Only one configuration considered
self._dev.set_configuration()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see flit#4

@newbrain
Copy link
Collaborator

newbrain commented Feb 22, 2021

Ah, nice to see it all coming together.
I have unfortunately found a problem on Linux with Picoprobe, see my comment above.
I made a PR on the feature branch, and did not notice this one!

@lgtm-com
Copy link

lgtm-com bot commented Feb 22, 2021

This pull request introduces 3 alerts when merging d9fa5c8 into 7dccf5c - view on LGTM.com

new alerts:

  • 3 for Unused import

@@ -0,0 +1,8 @@
# 2e8a:0004 Raspberry Pi picoprobe
# https://github.com/raspberrypi/picoprobe
SUBSYSTEM=="usb", ATTR{idVendor}=="2e8a", ATTR{idProduct}=="0004", MODE:="666"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference really goes to using a group, rather than the satanic MODE.
But as long as the safer alternatives are suggested (line 7-8) I'm fine with this, as it's simpler for naïve users.
This is more a general comment, as all the .rules files here follow the same pattern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. I just followed the STLink rules that were created by ST. We could change all of the rules to use groups? Just need to add some instructions in comments on how to set up the group for users that don't know, and maybe the MODE based rules, commented out, as an alternative. This would be a separate PR, though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The good thing with the rules as they are now is that zero knowledge or extra actions are needed for the user, just drop them in and they work.
A group (or username) based rule needs the user to tailor it according their identity.

Probably, an username rule is easier - as it would not involve:

  • Creating an ad-hoc group or selecting an existing one (but hey vary across distributions)
  • Making sure the user belongs to the group

Only this step would be needed:

  • put the username in the right place in the rule

I might try to write a template this WE, depending on available time - no guarantee.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure that's why ST chose MODE based (and it made sense for me).

The ultimate would be to have all 3 variants: "just works", user based, group based. Separated into different folders under ./udev/. That's probably overkill, though. 😁 If you find time, I will happily add your additions!

@lgtm-com
Copy link

lgtm-com bot commented Feb 25, 2021

This pull request introduces 4 alerts when merging 962d7ee into 74a0b3a - view on LGTM.com

new alerts:

  • 3 for Unused import
  • 1 for Except block handles 'BaseException'

flit and others added 13 commits February 25, 2021 17:53
- Added methods for sending sequence fragments.
- Added methods for specific SWD<->dormant<->JTAG transitions.
- Add DAP_SWD_Sequence command support to pyDAPAccess.
- Add swd_sequence() to DebugProbe.
- Add SWD_SEQUENCE probe capability.
- Update probe server and client.
- Supports HW reset in Picoprobe (if available)
- Safe (slow) or bulk (faster) SWD modes
- Tested with a Discovery F429 and a Nucleo L476
Picoprobe tested with Pico board from VS Code (cortex-debug):
- Flashing
- Read and write RAM and variables
- Breakpoints and single stepping
Trying to select a configration for an USB device that already has one
will raise an USBerror exception with "Resource Busy" on Linux  (but
not on Windows!). This is now accounted for.
@flit flit merged commit 8a60e35 into pyocd:master Feb 26, 2021
@flit flit deleted the feature/rp2040 branch July 11, 2021 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants