Skip to content

Conversation

AnnsAnns
Copy link
Contributor

@AnnsAnns AnnsAnns commented Jun 10, 2025

Contribution description

This PR introduces the Raspberry Pi Pico 2 to Riot.

Currently the periph list is rather limited, it has GPIO and non-configurable extremely basic write only UART support. It does however, already configure the clocks using the XOSC and works well within the RIOT Ecosystem.

It supports OpenOCD, which I am currently using and (as introduced in #21269) Picotool for debugging/flashing. (And JLink though I did not test this)

One other big note is that we currently only support the Cortex M33 cores of the Pico 2, however, most of the code should reusable when adding support for the Pico 2s RISC-V cores.

There is still a lot to be done, the documentation is still "limited", however, I felt like it would make more sense to at least open the PR itself before continuing. Esp. to avoid potentially duplicated efforts from occurring.

image

I also took the liberty to already use #21515 for the license headers. I am not sure whether this is already the consensus.

Testing procedure

To showcase the current features I included a very minimal example, this is not intended to get merged but merely to showcase what is available as of now.

Issues/PRs references

@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: build system Area: Build system Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration labels Jun 10, 2025
@Teufelchen1 Teufelchen1 marked this pull request as draft June 10, 2025 10:39
@crasbe crasbe added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 10, 2025
@riot-ci
Copy link

riot-ci commented Jun 10, 2025

Murdock results

✔️ PASSED

359d3a9 boards: Raspberry Pi Pico 2 support

Success Failures Total Runtime
10560 0 10560 10m:34s

Artifacts

@AnnsAnns AnnsAnns marked this pull request as ready for review June 10, 2025 14:04
@AnnsAnns
Copy link
Contributor Author

Also Murdock is "failing" because of the example that will not be merged, please ignore that 😛

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Some mostly minor style comments. Speaking of comments, a lot of comments are still in the // style, which we don't use: https://github.com/RIOT-OS/RIOT/blob/master/CODING_CONVENTIONS.md#comments

Some defines and functions are not documented yet, but I'll have to review what Doxygen complains about. Also I have not checked the generated Doxygen documentation yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think RIOT already has a library of atomic commands. Perhaps @maribu knows more about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not know that this was something universal, the more you know

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I had this in mind: https://github.com/RIOT-OS/RIOT/tree/master/sys/include/atomic_utils.h

Sorry for not posting the link initially.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wont lie, that header is a bit overwhelming and complicated 😰 Is it something where you still need to write the functions for or is this just something that works out of the box.

Copy link
Member

Choose a reason for hiding this comment

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

It will work out of the box and provides atomic access, assuming all (potentially) concurrent accesses go via those functions.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand this correctly this would mean Id also have to adjust the shared UART code in the followup so Id rather avoid it and simply use the same method signatures that the rp2040 uses for atomic operations

@AnnsAnns AnnsAnns changed the title CPU/Boards: Add Raspberry Pi Pico 2 support CPU/Boards: Add Raspberry Pi Pico 2 (RP2350) support Jun 15, 2025
@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Jun 17, 2025

After investigating the feasibility of using shared components such as UART I have decided that it probably makes more sense to limit the scope of this PR. (Also mentioned here: #21545 (comment))

The idea of this PR is to add minimal support, and then later in a followup PR add support for the shared components such as the RP2040 UART Driver.

Doing this in this PR would most likely heavily impact reviewability, which I'd like to avoid, esp. when moving to a shared component would require major adjustments to some parts of the code.

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Again, mostly small stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I had this in mind: https://github.com/RIOT-OS/RIOT/tree/master/sys/include/atomic_utils.h

Sorry for not posting the link initially.

@github-actions github-actions bot removed the Area: examples Area: Example Applications label Jun 17, 2025
@github-actions github-actions bot removed the Area: examples Area: Example Applications label Jul 31, 2025
@crasbe
Copy link
Contributor

crasbe commented Jul 31, 2025

If you want to, you can also squash the comments down a bit. Just make sure not to accidentally squash in stuff you don't want to keep 😅

@AnnsAnns
Copy link
Contributor Author

If you want to, you can also squash the comments down a bit. Just make sure not to accidentally squash in stuff you don't want to keep 😅

Squashed everything before the PR cherry-pick (otherwise rebasing would probably become hell)

@crasbe crasbe removed the State: waiting for other PR State: The PR requires another PR to be merged first label Aug 1, 2025
@crasbe
Copy link
Contributor

crasbe commented Aug 1, 2025

You can rebase this now :)

@crasbe
Copy link
Contributor

crasbe commented Aug 3, 2025

Some of the files have the wrong indentation width (two spaces instead of four). I think VS Code can automagically fix that for you.

@github-actions github-actions bot removed Area: pkg Area: External package ports Area: tools Area: Supplementary tools labels Aug 4, 2025
@crasbe crasbe removed the State: needs rebase State: The codebase was changed since the creation of the PR, making a rebase necessary label Aug 4, 2025
@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Aug 4, 2025

Some of the files have the wrong indentation width (two spaces instead of four). I think VS Code can automagically fix that for you.

VSCode was really fighting back against me creating rubbish formatting and trying to gaslight me into believing that 2 spaces are actually 4 spaces in some files but I think Ive fixed all of the indentation issues now, ty for noticing

@crasbe
Copy link
Contributor

crasbe commented Aug 4, 2025

I think this had some unintended side-effects:
image

All the block comments are now incorrectly formatted 👀

@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Aug 4, 2025

I think this had some unintended side-effects: image

All the block comments are now incorrectly formatted 👀

fixed

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

This one block got missed. But other than that I think we went through everything enough times.

Do you still have anything left to do or is this ready?

@github-actions github-actions bot removed the Area: CI Area: Continuous Integration of RIOT components label Aug 4, 2025
@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Aug 4, 2025

This one block got missed. But other than that I think we went through everything enough times.

Do you still have anything left to do or is this ready?

Squashing time 😛

@crasbe crasbe enabled auto-merge August 4, 2025 09:32
@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Aug 4, 2025

Thank you for the countless reviews and patches over the last months 🥳

@crasbe crasbe added this pull request to the merge queue Aug 4, 2025
Merged via the queue into RIOT-OS:master with commit b6d2f40 Aug 4, 2025
26 checks passed
@crasbe
Copy link
Contributor

crasbe commented Aug 4, 2025

You're welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants