Skip to content

Commit 34097b7

Browse files
xyzzy42dpgeorge
authored andcommitted
esp32/network_ppp: Make PPP support optional.
PPP is not that commonly used, let it be turned off in the board config to save space. It is still on by default. On an basic ESP32-S3 build, turning off PPP with LWIP still on saves ~35 kB of codend 4 kB of data. text data bss dec hex filename 1321257 304296 2941433 4566986 45afca before-ppp-off.elf 1285101 299920 2810305 4395326 43113e after-ppp-off.elf ------------------------------- -36156 -4376 -56 Note that the BSS segment size includes all NOBITS sections in ELF file. Some of these are aligned to 64kB chunk sized dummy blocks, I think for alignment to MMU boundaries, and these went down by 1 block each, so 128 kiB of BSS is not really part of the binary size reduction. Signed-off-by: Trent Piepho <[email protected]>
1 parent 00ba6aa commit 34097b7

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Diff for: ports/esp32/modnetwork_globals.h

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#if MICROPY_PY_NETWORK_LAN
88
{ MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&esp_network_get_lan_obj) },
99
#endif
10+
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP) && defined(CONFIG_LWIP_PPP_SUPPORT)
1011
{ MP_ROM_QSTR(MP_QSTR_PPP), MP_ROM_PTR(&esp_network_ppp_make_new_obj) },
12+
#endif
1113
{ MP_ROM_QSTR(MP_QSTR_phy_mode), MP_ROM_PTR(&esp_network_phy_mode_obj) },
1214

1315
#if MICROPY_PY_NETWORK_WLAN

Diff for: ports/esp32/network_ppp.c

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "lwip/dns.h"
4444
#include "netif/ppp/pppapi.h"
4545

46+
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP) && defined(CONFIG_LWIP_PPP_SUPPORT)
47+
4648
#define PPP_CLOSE_TIMEOUT_MS (4000)
4749

4850
typedef struct _ppp_if_obj_t {
@@ -341,3 +343,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
341343
MP_TYPE_FLAG_NONE,
342344
locals_dict, &ppp_if_locals_dict
343345
);
346+
347+
#endif

Diff for: ports/esp32/ppp_set_auth.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "ppp_set_auth.h"
1111

12-
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
12+
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP) && defined(CONFIG_LWIP_PPP_SUPPORT)
1313

1414
#include "netif/ppp/pppapi.h"
1515

0 commit comments

Comments
 (0)