Ethernet no longer can be enabled/disabled?

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Ethernet no longer can be enabled/disabled?

Postby cmorgan » Thu Sep 21, 2017 6:44 pm

The ethernet component no longer has a top level enable/disable in menuconfig but there are options below it such as the number of RX and TX DMA buffers that say they are statically allocated. I haven't checked to see if codespace is increased.

I see the commit in the history that removed the option:

commit bb7d5fc10f90da1e77e0ab44451a8d744d0bd748
Merge: b354b75e 4c1c62a4
Author: Ivan Grokhotkov <ivan@espressif.com>
Date: Fri Aug 18 18:45:49 2017 +0800

Merge branch 'feature/remove_ethernet_config_option' into 'master'

ethernet: remove CONFIG_ETHERNET

See merge request !1116


But can't find the reasoning behind doing so.

Chris

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Ethernet no longer can be enabled/disabled?

Postby ESP_Angus » Thu Sep 21, 2017 10:57 pm

That's correct. In the forthcoming IDF V3.0, both Wifi & Ethernet are only enabled if you call a function in the applicable component (usually this means if your code calls esp_wifi_init() or esp_eth_init().)

During linking, only used functions and static variables are linked into the final binary. So no code size or static memory for a component will be used if that component isn't referenced somewhere by your firmware.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Ethernet no longer can be enabled/disabled?

Postby cmorgan » Fri Sep 22, 2017 2:15 am

ESP_Angus wrote:That's correct. In the forthcoming IDF V3.0, both Wifi & Ethernet are only enabled if you call a function in the applicable component (usually this means if your code calls esp_wifi_init() or esp_eth_init().)

During linking, only used functions and static variables are linked into the final binary. So no code size or static memory for a component will be used if that component isn't referenced somewhere by your firmware.
Ahh very cool, thanks for the explanation. Enabling link time optimization (lto) for that?

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Ethernet no longer can be enabled/disabled?

Postby ESP_Angus » Fri Sep 22, 2017 3:04 am

cmorgan wrote: Ahh very cool, thanks for the explanation. Enabling link time optimization (lto) for that?
We're hoping to support LTO for IDF in the future, but for now this is a combination of two bits of linker behaviour:
  • We link all components as libraries (-lcomponentname), which means the linker only searches them when it has an undefined symbol it needs to resolve. This means only the object files (.o files) in each library which have at least one required symbol are linked in.
  • We compile all IDF code with "-ffunction-sections -fdata-sections" and use --gc-sections in the link. This means that even if one symbol in an object file is referenced, any totally unreferenced code/functions/variables in that same object file will not be linked into the final binary.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Ethernet no longer can be enabled/disabled?

Postby cmorgan » Fri Sep 22, 2017 8:28 pm

Very good, thank you for the details!

Who is online

Users browsing this forum: No registered users and 138 guests