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

Add initial support for the Raspberry Pi Pico 2 #77368

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

ajf58
Copy link
Contributor

@ajf58 ajf58 commented Aug 21, 2024

https://builds.zephyrproject.io/zephyr/pr/77368/docs/boards/index.html#name=pico+2

This is a PR to add support for the Raspberry Pi Pico 2 board, and the RP2350 SoC. See also the discussion at #77329

This should not be merged currently, as it includes changes that will break the clock control driver for the RP2040.

Dependencies

  1. west: hal_rpi_pico: Update Pico-SDK to 2.0.0 #76986
  2. Updating hal_rpi_pico incorporate the change for raspberrypi/pico-sdk@0e5ef0f

cc: @yonsch @soburi

@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 21, 2024

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_rpi_pico DNM This PR should not be merged (Do Not Merge) labels Aug 21, 2024
@soburi
Copy link
Member

soburi commented Aug 22, 2024

@ajf58
First, I've listed some points that caught my attention at a glance.
I haven't been able to check it thoroughly yet, so I'll look at it a bit more.

soc/raspberrypi/rp2xxx/Kconfig Outdated Show resolved Hide resolved
soc/raspberrypi/soc.yml Outdated Show resolved Hide resolved
@soburi
Copy link
Member

soburi commented Aug 22, 2024

modules/hal_rpi_pico/CMakeLists.txt Outdated Show resolved Hide resolved
dts/arm/rpi_pico/rpi_pico_2_common.dtsi Outdated Show resolved Hide resolved
soc/raspberrypi/CMakeLists.txt Outdated Show resolved Hide resolved
west.yml Outdated Show resolved Hide resolved
nordicjm
nordicjm previously approved these changes Aug 27, 2024
Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

Updates are OK. Though migration guide entry needed for the SoC symbol change

boards/raspberrypi/rpi_pico_2/rpi_pico_2-pinctrl.dtsi Outdated Show resolved Hide resolved
@ajf58 ajf58 force-pushed the add-rpi-pico-2-support branch 5 times, most recently from b4d5164 to f5d043c Compare August 29, 2024 07:25
@ajf58 ajf58 force-pushed the add-rpi-pico-2-support branch 2 times, most recently from be3d6b9 to 384b0ee Compare August 29, 2024 21:01
@ajf58
Copy link
Contributor Author

ajf58 commented Aug 30, 2024

Updates are OK. Though migration guide entry needed for the SoC symbol change

@nordicjm where should this update go? Is under boards in doc/releases/migration-guide-4.0.rst correct?

@nordicjm
Copy link
Collaborator

nordicjm commented Sep 2, 2024

Updates are OK. Though migration guide entry needed for the SoC symbol change

@nordicjm where should this update go? Is under boards in doc/releases/migration-guide-4.0.rst correct?

Yes

Add initial support for the RP2350's DMA peripheral, allow tests
under drivers/dma/loop_transfer to run on on the Raspberry Pi Pico 2,
and update the board's documentation.

Signed-off-by: Manuel Aebischer <[email protected]>
Signed-off-by: Andrew Featherstone <[email protected]>
Avoid referring to Pico 2 (the name of a board). In this context,
RPI_PICO is used to refer to the (Zephyr) `SOC_FAMILY` rather than the
Pico 1 board. This clarifies common numerical values between the RP2040
and RP2350 SoC series, and enables existing DTS files to be used with
RP2350-based boards with fewer changes.

Remove the use of Zehpyr's `CONFIG_` macros from the device tree files,
and replace them with `SOC_SERIES`-specific files. Update the driver
implementation to conditionally include the correct file. Update
documentation and samples to match.

Signed-off-by: Andrew Featherstone <[email protected]>
From the API documentation, `dma_api_chan_filter`` can be given a value
of NULL for `filter_param`. Match the behaviour of most implementations,
and return true. This removes misleading error messages logged during
tests (e.g. `test_tst_dma0_m2m_loop`).

Signed-off-by: Andrew Featherstone <[email protected]>
Increase test coverage for Raspberry Pi's SoCs. Use the `socs` folder
rather than `boards` to enable these tests to run on any boards with the
same SoCs.

Signed-off-by: Andrew Featherstone <[email protected]>
The RP2350's PWM peripheral is largely unchanged from the RP2040's, but
the higher clock frequency means the long blink delay must be lower.

Signed-off-by: Andrew Featherstone <[email protected]>
Assume that users want to run a dual Cortex-M33 on the Pico 2, and
update various parts of the codebase to match. I expect the majority of
the soc's definition will move from `dts/arm/raspberrypi` to
`dts/common/raspberrypi` if/when support is added for the Hazard3 cores.

Some parts of the codebase can cope without encoding the cluster in the
filename (e.g. Twister seems to use the identifier in
`boards/raspberrypi/rpi_pico2/rpi_pico2.yaml` rather than the filename
itself), others can't (e.g. `rpi_pico2_m33_defconfig`) which itself is
a form of <board>_<cpucluster>_defconfig and doesn't refer to the SoC.
Despite this, some files have been given the verbose fully-specified
name because this matches the current documentation.

Update documentation to try to highlight the capabilities and
limitations of the current support within Zephyr for the Pico 2 board
and the underlying SoC.

Update `.overlay` and `.conf` files in `samples/` and `tests/` to match
the new requirement.

Limited tested locally with no issues found.

Signed-off-by: Andrew Featherstone <[email protected]>
Copy link
Contributor Author

@ajf58 ajf58 left a comment

Choose a reason for hiding this comment

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

File name fettling has been done. Please note the commit message did (and still does) highlight that in several cases this wasn't required.

Since this is now not going into v4.0, I've also modified the relevant commit so that the documentation updates target v4.1's release notes.

Please note my comment regarding the squashing of rp2350: Define and implement a cpucluster of Cortex-M33s. I'm not going to do that for the reasons I've already outlined above.

boards/raspberrypi/rpi_pico2/rpi_pico2_m33.dts Outdated Show resolved Hide resolved
boards/raspberrypi/rpi_pico2/rpi_pico2_m33.dts Outdated Show resolved Hide resolved
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Andrew Featherstone <[email protected]>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please can you mark this "conversation" as resolved? I don't think there's any more discussion to be had here.

Copy link
Member

@soburi soburi left a comment

Choose a reason for hiding this comment

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

LGTM

@nordicjm
Copy link
Collaborator

Please note my comment regarding the squashing of rp2350: Define and implement a cpucluster of Cortex-M33s. I'm not going to do that for the reasons I've already outlined above.

This is clearly defined in the zephyr contribution guidelines, the exact point of which you have been made aware of earlier https://docs.zephyrproject.org/latest/contribute/guidelines.html#contribution-workflow

If reviewers do request changes to your patch, you can interactively rebase commit(s) to fix review issues. In your development repo:

git rebase -i <offending-commit-id>^

In the interactive rebase editor, replace pick with edit to select a specific commit (if there’s more than one in your pull request), or remove the line to delete a commit entirely. Then edit files to fix the issues in the review.

As before, inspect and test your changes. When ready, continue the patch submission:

git add [file(s)]
git rebase --continue

Update commit comment if needed, and continue:

git push --force origin fix_comment_typo

History has nothing to do with it, you're trying to claim if someone submits a PR with C code changes that do not compile, instead of fixing them in the original commit, they should add a new commit which fixes them on top of it to preserve the history, this makes absolutely no sense.

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

Squash requested changes into original commits

@kartben
Copy link
Collaborator

kartben commented Nov 11, 2024

... you're trying to claim if someone submits a PR with C code changes that do not compile

@nordicjm that's not at all what @ajf58 is saying (let alone "claiming"). Please, pretty please, refrain from telling people what they are saying "make no sense", especially if you're going into a straw man argument.

The commit that's left "unsquashed" is transitioning from a working state to another working state, AFAICT, and reflecting changes along the lines of "initial support" --> "slightly improved initial support". That last commit would have likely been a different, follow-up, PR in other circumstances.

@nordicjm
Copy link
Collaborator

... you're trying to claim if someone submits a PR with C code changes that do not compile

@nordicjm that's not at all what @ajf58 is saying (let alone "claiming"). Please, pretty please, refrain from telling people what they are saying "make no sense", especially if you're going into a straw man argument.

The C part is applying the same logic here to code instead of a dts file. See #80707 (review)

The commit that's left "unsquashed" is transitioning from a working state to another working state, AFAICT, and reflecting changes along the lines of "initial support" --> "slightly improved initial support". That last commit would have likely been a different, follow-up, PR in other circumstances.

Because we don't rebase history that has been merged, this has not been merged, you submit a clean PR which does what is needed, not add commits that you later fix up in the same PR, and this isn't even a zephyr this, this is a common sense thing with projects and git in general

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Nov 11, 2024

The commit that's left "unsquashed" is transitioning from a working state to another working state, AFAICT, and reflecting changes along the lines of "initial support" --> "slightly improved initial support". That last commit would have likely been a different, follow-up, PR in other circumstances.

That is not how code review works here, or in Linux (which the process is inspired from), or I imagine in any other project with a maintainer structure. Fixups go in the commit that introduced a file, sure in other circumstances it would be fine, but this is not that and the fixup commit makes the stack incredibly hard to review and the whole PR evolution very VERY hard to follow, leading to this being delayed further. There's a reason why that's the process documented in the contribution guidelines.

@soburi
Copy link
Member

soburi commented Nov 11, 2024

@ajf58

The commit content should not include the discussion process that led to this point, but rather revise it to a direct commit that reflects the final conclusion and commit it.
Also, please try to avoid making modifications to the same file within a PR as much as possible.

I have sorted it out. Please check it out. (Need to clone the repository)
https://github.com/soburi/zephyr/tree/pr77368_squash

There are some parts in the revision process that use my name,
so please use git format-patch and git am to revise and use it.

@ajf58
Copy link
Contributor Author

ajf58 commented Nov 12, 2024

Do Not Merge @soburi 's branch.

@kartben's comment is absolutely correct at #77368 (comment) .

When @fabiobaltieri says:

fixups go in the commit that introduced a file

There is no fixup commit.

Again, kartben is absolutely spot on. This PR could have been merged as-is without the last commit. I don't endorse it, but it has to have my sign off because the "signed off by" process mandates it.

I have sorted it out. Please check it out. (Need to clone the repository)
https://github.com/soburi/zephyr/tree/pr77368_squash

@soburi the branch you've created now really is wrong. At the very least:

  1. because you've squashed at least one commit together, but failed to correctly change the commit message, the commit message is wrong.
  2. You've messed up the committer and author on at least one commit.
  3. You've created commits that will fail the Compliance Checks.

There are some parts in the revision process that use my name,
so please use git format-patch and git am to revise and use it.

No, absolutely not. You cannot take my work, break it, give it back to me, and expect me to fix it.

@nordicjm
Copy link
Collaborator

Had a quick look at @soburi's branch and looks ok.

because you've squashed at least one commit together, but failed to correctly change the commit message, the commit message is wrong.

He's correctly squashed requested changes into the base commits

You've messed up the committer and author on at least one commit.

Have you ever actually used git before? This is what happens when you rebase, even if you make no changes, go and rebase and git commit --amend --reset-author to fix.

You've created commits that will fail the Compliance Checks.

Where?

@soburi
Copy link
Member

soburi commented Nov 12, 2024

@ajf58

and expect me to fix it.

That's true.
That's why I'm not presenting this in a mergeable form.
But I think it's useful enough to show what I, @nordicjm and @fabiobaltieri expect.
Explaining this in words would be too long, so it's better to show an example, which is what I'm doing here.

@soburi
Copy link
Member

soburi commented Nov 12, 2024

@ajf58

Do Not Merge @soburi 's branch.

No one said my branch to merge.
In the first place, how can anyone merge something that isn't even a PR?

No, absolutely not. You cannot take my work, break it, give it back to me, and expect me to fix it.

Ok, of course, I'd welcome you to solve the problem your way.

@soburi
Copy link
Member

soburi commented Nov 12, 2024

I share @fabiobaltieri 's concern.
Even if policy changes as the PR branch evolves, the ultimately merged commits should be easy to read and organized based on the final policy.
Because the source code is usually "Write once, read many times."
As pointed out, the guideline's statement that we should rebase and force push also makes it undesirable to have "intermediate states" in a PR, I think.

@soburi
Copy link
Member

soburi commented Nov 18, 2024

@ajf58 @nordicjm @fabiobaltieri @kartben

Everyone,

Thank you for joining this lengthy discussion.

Now, the issue of rebasing commits has been raised,
and I think this is the last issue.
I don't think any implementation issues remain with the final code.

However, this "rebase and clean up the history before committing" is
a norm practiced by many people in Zephyr's development.
It is also explicitly stated in the guidelines, so I need to respect this from a maintainer's perspective.
In other words, the rules that everyone else follows must be followed.

@kartben 's comment is correct, but I think It needs stronger evidence against the clearly written rules.

So, my first hope is that this will be changed.
However, it is also true that @ajf58 is exhausted.
Looking at the long history so far, I also want to finish it soon.
I think we need to find a compromise.

  1. Can it be approved in its current state?

It would be better to fix it from the perspective of the community's standards.
However, the negative impact would be limited and not a severe problem.

It would involve some compromise, but is this possible? > @nordicjm, @fabiobaltieri

  1. If it needs to be fixed

If not, it needs to be fixed.

However, as already mentioned, @ajf58 is also quite exhausted.

Even if a fix is ​​necessary, we must consider how to make it as easy for him as possible.
We need to follow the community's rules, but I want to avoid asking for repeated fixes on this issue.

Can we proceed with the following process?

  1. Present an acceptable fix policy (@nordicjm, @fabiobaltieri, @soburi, @kartben)
  2. Submit the fix (@ajf58)
  3. If a correction is needed, provide feedback with a directly applicable form (@nordicjm, @fabiobal, @soburi, @kartben)

It will be a burden for @ ajf58, but the rebase, force push, and clean-up of the history procedures are necessary if you commit to Zephyr, so I would like you to get used to it.

First of all, I would like to hear your opinion.

@nordicjm
Copy link
Collaborator

The rules are there in plain text for everyone to follow for the benefit of the project, no exceptions to these base rules (which are arguably rules for any git project in general, there's nothing zephyr specific about them)

@kartben
Copy link
Collaborator

kartben commented Nov 18, 2024

AFAICT commit granularity also has a lot to do with maintainers' preferences (just like commit message labels, which are definitely not consistent across all areas), and as @soburi has now approved the PR here many times, I think it's safe to say that they, as the maintainer of this area, can probably live with the way things are currently split.

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Nov 18, 2024

Sure listen, it's no big deal, we merge off process changes that miss proper review all the time, this is fine. But the platform maintainer (@soburi) thinks it should be squashed, the buildsystem collab (@nordicjm, without whom the whole board infrastructure would be an unmanageable dumpster fire, which is arguably a bigger problem for the project) thinks it should be squashed, the process says it should be squashed. I'd be fine going off process if the maintainer(s) agreed not do, but it's not the case. So my suggestion is, pretty please, squash the commit and move on.

For the record, if this was Linux, that has a much better structured hierarchy pull request process, this would be a non-issue, the maintainer would have the option to take the patches in whatever form and massage them in shape in their working branch before opening a pull request themselves for integration, which is exactly what @soburi did. Also:

Explaining this in words would be too long, so it's better to show an example, which is what I'm doing here.

Amen.

@soburi
Copy link
Member

soburi commented Nov 19, 2024

@nordicjm @kartben @fabiobaltieri

Thank you for your opinion.

It's a tough decision, but I will proceed with the following process.

First of all, I would like to ask @ajf58 to deal with squash.
Of course, this is only a request, not an order.
However, I would be grateful if he would accept this,
and I think this would be the way to finish this PR most amicably.

If not, that is, if my request is not accepted, I will proceed with the approval as this PR is.
(In other words, I will remove the NACK by force.)
It may not be the best process, but as @kartben says, I think it is within the scope of discretion.
I also think that the log of this discussion is a sufficient record of what was confirmed to be okay
and what was compromised. It is possible to look back.

@ajf58 is probably very exhausted and may not be in a situation to respond.
It might be a little long, but I will wait until next week, and if there is no response by then,
I will exercise the above policy.
If any necessary responses or requests arise after that, I will handle them.

@fabiobaltieri
Copy link
Member

If not, that is, if my request is not accepted, I will proceed with the approval as this PR is.
(In other words, I will remove the NACK by force.)

There's a fairly well defined process for review dismissal by the assignee (https://docs.zephyrproject.org/latest/project/project_roles.html#assignee), it eventually resolves up to the technical escalation. More discussions, more meetings, more arguing about what is ultimately a rather simple feedback about following the process. Or you could squash the commit @ajf58.

Anyway @soburi what I'm trying to say is that I appreciate and admire the strong stance to wrap this but I'd rather you not dismiss a non stale, non incorrect blocker as that may result into an endless series of process wg discussions about dmissial rules that I would have to endure. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.