Skip to content

Conversation

@earlephilhower
Copy link
Owner

In non-debug cases the string to panic() isn't actually sent to the Serial port, or anywhere in fact.

When there is no debug port defined, replace the panic(str) of LWIP_PLATFORM_ASSERT with panic("lwip") instead. This doesn't effect debugging because the source line of the LWIP_ASSERT will still show the full string (GDB shows the source).

Also, LWIP_DEBUG is a flag by definition, not value, so fix lwipopts.h to not define it or the LWIP_X debug defines unless LWIP_DEBUG is set by the compliation.

Saves 5480 bytes of flash for LWIP (Pico W, 2W, Ethernet) apps.

In non-debug cases the string to `panic()` isn't actually sent to the
Serial port, or anywhere in fact.

When there is no debug port defined, replace the panic(str) of
LWIP_PLATFORM_ASSERT with panic("lwip") instead.  This doesn't
effect debugging because the source line of the LWIP_ASSERT
will still show the full string (GDB shows the source).

Also, LWIP_DEBUG is a flag by definition, not value, so fix
lwipopts.h to not define it or the LWIP_X debug defines unless
LWIP_DEBUG is set by the compliation.

Saves 5480 bytes of flash for LWIP (Pico W, 2W, Ethernet) apps.
When -O3 is used to build LWIP, GCC emits a bogus error while compiling
DHCP.C:
>  ../dhcp.c:1453:30: error: writing 1 byte into a region of size 0

DHCP_OPTIONS_LEN was verified as being DHCP_MIN_OPTIONS_LEN (68U) and not
0 using #ifs and #errors in the dhcp.h header, but GCC somehow forgets
this while doing it's checks on O3.  Looks to be a bug in GCC to me,
so drop to -O2 for RP204 builds.
@earlephilhower
Copy link
Owner Author

Original CI failure seems to show a GCC bug for the M3 (Pico2) where it thinks the DHCP options[] is 0-length, while it is always set to the min (68U) (verified with #if DHCP_OPTIONS_LEN < 68 / #error manually added in my own testing. The M0+ (Pico) doesn't show the error even at -O3, so I have to conclude the ARM-M3 GCC has a bug with -O3...

@earlephilhower earlephilhower merged commit f62e680 into master Sep 25, 2025
28 checks passed
@earlephilhower earlephilhower deleted the mem1 branch September 25, 2025 20:59
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.

1 participant