Skip to content

ports/rp2: Enable PPP for Pico W.#16445

Merged
dpgeorge merged 2 commits into
micropython:masterfrom
pimoroni:pico-w-ppp
Jun 23, 2026
Merged

ports/rp2: Enable PPP for Pico W.#16445
dpgeorge merged 2 commits into
micropython:masterfrom
pimoroni:pico-w-ppp

Conversation

@Gadgetoid

@Gadgetoid Gadgetoid commented Dec 18, 2024

Copy link
Copy Markdown
Contributor

Enables MICROPY_PY_NETWORK_PPP_LWIP for Pico W so that it can take advantage of PPP-supporting networking modules.

This would probably be too onerous for a regular Pico build. Even though it could work, I suspect the networking stack will blow the tight firmware allocation.

Edit: Woof! That's quite a bit more code bloat than I'd expected!

@github-actions

github-actions Bot commented Dec 18, 2024

Copy link
Copy Markdown

Code size report:

Reference:  tools/mpy_ld.py: Allow overriding the internal MPY file name. [b49f098]
Comparison: rp2: Enable PPP for Pico W. [merge of 533a154]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2: +24632 +2.669% RPI_PICO_W[incl +752(bss)]
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Comment thread ports/rp2/boards/RPI_PICO_W/mpconfigboard.h Outdated
Comment thread ports/rp2/boards/RPI_PICO_W/mpconfigboard.h Outdated
@Gadgetoid

Gadgetoid commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

Update to enable in mpconfigport.h by default, with the option to set MICROPY_PY_NETWORK_PPP_LWIP and disable it.

Looks like there's a significant code size overhead, though!

Edit: Looks like I need to limit to ports with LWIP enabled 🤦

[  2%] Generating genhdr/pins.h, pins_ARDUINO_NANO_RP2040_CONNECT.c
[  2%] Generating genhdr/qstr.i.last
/home/runner/work/micropython/micropython/micropython repo/extmod/network_ppp_lwip.c:38:10: fatal error: lwip/dns.h: No such file or directory
   38 | #include "lwip/dns.h"
      |          ^~~~~~~~~~~~

Actually or maybe I have an order of operations thing going on in the header.

Edit: I think this is the classic disagreement in patterns between:

  1. Include all source files and use .h defines to determine whether their contents are enabled
  2. Conditionally include things based on CMake options and then set a define, eg:
    if (MICROPY_PY_LWIP)
    target_link_libraries(${MICROPY_TARGET} micropy_lib_lwip)
    target_include_directories(${MICROPY_TARGET} PRIVATE
    lwip_inc
    )
    target_compile_definitions(${MICROPY_TARGET} PRIVATE
    MICROPY_PY_LWIP=1
    )
    endif()

@Gadgetoid

Copy link
Copy Markdown
Contributor Author

Wait a minute, what's the diference between:

MICROPY_PY_LWIP_PPP - https://github.com/search?q=repo%3Amicropython%2Fmicropython%20MICROPY_PY_LWIP_PPP&type=code

and

MICROPY_PY_NETWORK_PPP_LWIP - https://github.com/search?q=repo%3Amicropython%2Fmicropython+MICROPY_PY_NETWORK_PPP_LWIP&type=code

The latter seems to be set just for lwipopts_common.h -

#if MICROPY_PY_LWIP_PPP

@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (b49f098) to head (533a154).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16445   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files         176      176           
  Lines       22904    22904           
=======================================
  Hits        22563    22563           
  Misses        341      341           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dpgeorge

Copy link
Copy Markdown
Member

@Gadgetoid this PR looks good now, but you still have it in draft status. Any reason it's in draft?

If you move it out of draft and rebase, it should be good to merge.

@dpgeorge

Copy link
Copy Markdown
Member

@Gadgetoid see above.

@Gadgetoid Gadgetoid marked this pull request as ready for review June 22, 2026 06:39
@Gadgetoid

Copy link
Copy Markdown
Contributor Author

Any reason it's in draft?

PR anxiety! And a dash of completely forgetting I raised this.

Rebased and converted.

Comment thread ports/rp2/mpconfigport.h Outdated
#define MICROPY_VFS_ROM (MICROPY_HW_ROMFS_BYTES > 0)
#define MICROPY_SSL_MBEDTLS (1)
#define MICROPY_PY_LWIP_PPP (MICROPY_PY_NETWORK_PPP_LWIP)
#define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is no longer needed, see 7c1f1c4

Instead, you want to remove the previous line MICROPY_PY_LWIP_PPP.

Comment thread ports/stm32/mpconfigport.h Outdated
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
#define MICROPY_PY_TIME_INCLUDEFILE "ports/stm32/modtime.c"
#define MICROPY_PY_LWIP_PPP (MICROPY_PY_NETWORK_PPP_LWIP)
#define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same comment as above.

@dpgeorge

Copy link
Copy Markdown
Member

PR anxiety! And a dash of completely forgetting I raised this.

😄

I think some wires got crossed during the rebase, see comments above.

@Gadgetoid

Copy link
Copy Markdown
Contributor Author

Okay these commits being conceptually backwards really hurt my brain, I've swapped them and hopefully fixed them too.

Comment thread ports/rp2/mpconfigport.h Outdated
#ifndef MICROPY_PY_NETWORK_PPP_LWIP
#define MICROPY_PY_NETWORK_PPP_LWIP (0)
#endif
#define MICROPY_PY_NETWORK_PPP_LWIP (1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

missing #endif

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm clearly having a bad day. 🤦

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, third time's a charm, the cleanup commit hid that endif removal so I stared at the enable commit for a solid minute scratching my head before the penny dropped.

Sorry. I've been burning the midnight oil trying to land those GC changes, thanks for bearing with me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably needs to be MICROPY_PY_LWIP instead of 1.

(The GC improvements look really good!)

MICROPY_PY_LWIP_PPP is used in only one place and is generally set to
the value of MICROPY_PY_NETWORK_PPP_LWIP. Remove the former.

extmod/lwip-include/lwipopts_common.h: Replace MICROPY_PY_LWIP_PPP
                                  with MICROPY_PY_NETWORK_PPP_LWIP.
ports/mimxrt/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.
ports/rp2/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP,
                          default MICROPY_PY_NETWORK_PPP_LWIP to
                          MICROPY_PY_LWIP.
ports/stm32/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.

Signed-off-by: Phil Howard <github@gadgetoid.com>
@Gadgetoid

Gadgetoid commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

thousand yard stare

😭

edit: Okay I had confused this in my head with enable LWIP PPP for all Pico boards, since we have PPP-based modules that could conceivably run on a Pico, Pico 2 and CYW43 support is tangental to that. As such I changed the mpconfigport.h from a conditional enable to always enable 🤦 Fixed!

Of course this built locally for me because I didn't try a non-W build.

Th... fo.. fifth time lucky?

mpconfigport.h: Default MICROPY_PY_NETWORK_PPP_LWIP to 1.

Signed-off-by: Phil Howard <github@gadgetoid.com>

@dpgeorge dpgeorge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's green!

@dpgeorge dpgeorge merged commit 533a154 into micropython:master Jun 23, 2026
72 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.

2 participants