Skip to content

Add Pico 2 W port and update Pico SDK version #16313

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

Merged
merged 7 commits into from
Dec 19, 2024

Conversation

peterharperuk
Copy link
Contributor

Summary

Add Pico 2 W port and changes made in pico-sdk 2.1.0. This fixes issues with lightsleep associated with sev handling and alarm pool problems.

Testing

Ran all the micropython tests

@peterharperuk
Copy link
Contributor Author

I've split these changes out from this PR #16057

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.57%. Comparing base (f4e4599) to head (a70a90c).
Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16313   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files         164      164           
  Lines       21349    21349           
=======================================
  Hits        21045    21045           
  Misses        304      304           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Nov 27, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2: -1952 -0.214% RPI_PICO_W[incl +4(bss)]
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge dpgeorge added this to the release-1.25.0 milestone Dec 3, 2024
Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

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

Thanks for this, it's a relatively concise PR!

@peterharperuk peterharperuk force-pushed the pico2_w_only branch 2 times, most recently from ea6014a to 2d4b02b Compare December 6, 2024 21:12
@mattytrentini
Copy link
Contributor

For anyone that wants to test but doesn't want to build the firmware, here is a zipped UF2 file for the ARM build of 2d4b02b.

@lgb-this
Copy link

I have a project with different topics (webserver, I2C, buttons, asynio, WLAN, MQTT, neo led, logging, ...) and this firmware runs stable for me. I could run the project without any modifications from the Pico W.

@scruss
Copy link
Contributor

scruss commented Dec 13, 2024

Requesting a look at #16180 (and related #16181), a confirmed lightsleep regression for Pico W and Pico 2 W

@projectgus projectgus self-requested a review December 17, 2024 00:26
Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

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

These changes look good to me, thanks @peterharperuk . I don't have a 2 W to run this code myself, but I've ordered one.

Do I understand correctly that this pico-sdk version still has a buggy alarm pool, but after we update to 2.2.0 then we'd be able to switch the soft timer implementation back to the alarm pool if we wish? (Thanks to your PR raspberrypi/pico-sdk#2127)

@dpgeorge
Copy link
Member

I did a full test of this PR on:

  • Pico
  • Pico W
  • Pico2, in ARM and RISCV mode
  • Pico2 W, in ARM and RISCV mode

Everything seems to work as it should except the following:

  • There are some known failures, like using the native emitter to run tests/thread/stress_schedule.py.
  • tests/extmod/machine1.py test fails due to the issue fixed by tests/run-tests.py: Set name of injected test module to '__main__'. #16433.
  • tests/ports/rp2/rp2_dma.py fails on Pico2 W because the DMA channel that's allocated to Python in this test is different to the expected one, I guess because the expected DMA channel is used by the WiFi driver. To fix this, that test should probably be rewritten to use unittest.
  • tests/thread/thread_stdin.py locks up the Pico2 W when in RISCV mode. I'm not sure why, but I'm happy to let this through and fix it separately.

@peterharperuk
Copy link
Contributor Author

Should we include unittest in the list of installed modules? To avoid having to remember to manually install it to run the tests

@dpgeorge
Copy link
Member

Should we include unittest in the list of installed modules? To avoid having to remember to manually install it to run the tests

I'd rather not do that. The unittest package is pretty large when frozen in to firmware and not all ports have the space for it. Also, it's not a very common package for users to use, so takes up flash space unnecessarily.

If you're using a particular board for running the MicroPython test suite, it's relatively easy to do mpremote mip install unittest once on that board and then leave it installed. Then it will work with the tests from then on.

peterharperuk and others added 7 commits December 19, 2024 16:51
Brings in support for Pico 2 W, among other things.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
The cyw43 pins used to be hardcoded and `CYW43_PIN_WL_HOST_WAKE` and
`CYW43_PIN_WL_REG_ON` were in the `pico_w.h` board header.

This has been changed so the board header just defines the "default
version of the pins, e.g. `CYW43_DEFAULT_PIN_WL_HOST_WAKE`,
`CYW43_DEFAULT_PIN_WL_REG_ON` etc.

Set the pin values in `cyw43_configport.`h so `cyw43-driver` sees them and
allow them to be changed at runtime (dynamic) if required.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
As cyw43 pins might be dynamic, add a function that returns if a pin is
reserved.  This is used by `MICROPY_HW_PIN_RESERVED` to prevent the pin IRQ
from being reset across a soft-reset.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
Build with:

    make BOARD=RPI_PICO2_W BOARD_VARIANT=RISCV

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
@dpgeorge
Copy link
Member

I squashed down the last two changes you made @peterharperuk . This looks good now, it's very clean thank you!

@dpgeorge dpgeorge merged commit a70a90c into micropython:master Dec 19, 2024
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants