10000 Enable IPv4 or IPv4/IPv6 stacks, Ethernet class by earlephilhower · Pull Request #695 · earlephilhower/arduino-pico · GitHub
[go: up one dir, main page]

Skip to content

Enable IPv4 or IPv4/IPv6 stacks, Ethernet class #695

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
Jul 21, 2022
Merged

Conversation

earlephilhower
Copy link
Owner

IPv4-only mode saves 20KB+ of flash memory.

Add some backwards compatibility with the global Arduino Ethernet
class when running in IPv4 only mode.

Fixes #687

IPv4-only mode saves 20KB+ of flash memory.

Add some backwards compatibility with the global Arduino Ethernet
class when running in IPv4 only mode.

Fixes #687
@earlephilhower earlephilhower changed the title Enable IP4v4 or IPv4/IPv6 stacks, Ethernet class Enable IPv4 or IPv4/IPv6 stacks, Ethernet class Jul 21, 2022
LIBS=[File(os.path.join(FRAMEWORK_DIR, "lib", "libpico-ipv6.a"))])
else:
env.Append(CPPDEFINES=[("LWIP_IPV6",0)],
LIBS=[File(os.path.join(FRAMEWORK_DIR, "lib", "libpico.a"))])
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably not finished yet, just notes for later: If LWIP_IPv6 is in cpp_defines, then it's already in env["CPPDEFINES"]. We could rename the "checking macro" to PIO_FRAMEWORK_ARDUINO_ENABLE_IPV6 with this style. Also, if the libpico library changes, we need to remove the unconiditional adding of libpico.a. And very likely linking order matters, so I think we need to compute the right libpico library to use pretty much at the start and before the main env.Append() and adapt the static string there.

But you can also leave the PlatformIO builder script to me if you want :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think it's cleaned up with the current push. FWIW, I have the logic for IPV6 in 2 places: before the libs and in the config-net-defines. The reason is that the order of libs on the command line can sometimes cause issues, so I wanted to keep the libpico(-ipv6).a in its current position before others.

("LWIP_IPV6", 1),
("LWIP_IPV4", 1),
("LWIP_IGMP", 1),
("LWIP_LWIP_CHECKSUM_CTRL_PER_NETIF", 1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, now I know why the original builder script didn't work, there was a double LWIP_LWIP here. Good catch, I accidentally duplicated them in my PR then, but you removed them here so that it can happen in configure_network_flags().

@maxgerhardt
Copy link
Contributor

PIO builder script changes look good now. We'd also need to document this option in docs/platformio.rst. I'd propose to add undernearth the USB stack section:

IP Stack
---------

The lwIP stack can be configured to support only IPv4 (default) or additionally IPv6. To activate IPv6 support, add 

.. code:: ini

    ; IPv6
    build_flags = -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6

to the ``platformio.ini``.

@earlephilhower earlephilhower merged commit 0e18f09 into master Jul 21, 2022
@earlephilhower earlephilhower deleted the ipv4ipv6 branch July 21, 2022 18:57
schkovich pushed a commit to schkovich/arduino-pico that referenced this pull request May 24, 2025
Issue:
    irq wait 0
    irq 0
are translated as:
    irq(wait, 0)                          # 0
    irq(nowait, 0)                        # 1
wait/nowait are incorrect, should be block or ommited (alt: noblock).

After change:
    irq(block, 0)                         # 0
    irq(0)                                # 1
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.

Problem using the Ethernet libraries
2 participants
0