esp-idf/tools/test_apps/system/g1_components
Ivan Grokhotkov 47659be5b8
build system: remove lwip from common requirements
lwip was added to common requirements list to provide "sys/socket.h"
header to all components without additional requirements specified.

However, lwip pulls in a lot of dependencies on other components.
This commit removes lwip from common requirements to reduce the number
of components in G1-only apps.

To compensate for this removal, the following changes are made:
- newlib (which is a common requirement) has a public dependency on
  lwip if lwip is present in the build. This ensures that sys/socket.h
  is available as long as lwip component is included into the build.
- lwip is now a public requirement of esp-tls since esp_tls.h includes
  sys/socket.h header.
- lwip is now a public requirement o esp_http_client because
  sys/socket.h is included from esp_http_client.h
- lwip is now a private requirement of esp_wifi for "smartconfig_ack"
- lwip is now a private requirement of mqtt for socket functions
- lwip is now a public requirement of tcp_transport because
  esp_transport_tcp.h includes sys/socket.h header.
- mbedtls checks if lwip component is present in the build. If yes,
  net_sockets.c is added to the build, along with the dependency on
  lwip. Previously lwip was a public requirement of mbedtls
  unconditionally.

system/g1_components test app is updated to reflect the changes

Default public dependencies of a component before and after this
change, except common requirements:

- esp_timer (public dependency of freertos)
- bootloader_support (public dependency of esp_hw_support)
- vfs (public dependency of lwip)
- esp_wifi (public dependency of lwip)
- esp_event (public dependency of esp_wifi)
- esp_netif (public dependency of esp_event)
- esp_eth (public dependency of esp_netif)
- esp_phy (public dependency of esp_wifi)

After:

- esp_timer (public dependency of freertos)
- bootloader_support (public dependency of esp_hw_support)

Altogether, the following components have been always added as
public requirements to all other components, and are not added now
([breaking-change]):

- lwip
- vfs
- esp_wifi
- esp_event
- esp_netif
- esp_eth
- esp_phy

Application components now need to explicitly declare dependencies on
these components.
2022-05-02 20:47:17 +02:00
..
main tools: add a test app to check "G1-only" build 2021-12-02 15:29:00 +01:00
CMakeLists.txt build system: remove lwip from common requirements 2022-05-02 20:47:17 +02:00
README.md esp8684: rename target to esp32c2 2022-01-19 11:08:57 +08:00

Supported Targets ESP32 ESP32-S2 ESP32-S3 ESP32-C3

ESP32-C2 Not support this test currently, because some of components have not been supported. IDF-4135

"G1"-components-only app

This test application checks the list of components included into the build when "G1" components are added to the build. If G1 components don't have any dependencies outside of G1, then only G1 components themselves should be built.

Currently, this is not the case, and many other components are added to the build. See extra_components_which_shouldnt_be_included list inside CMakeLists.txt.

The purpose of this example is to:

  • Document which extra components are known to be included into G1 build.
  • Fail the build if additional components are added to G1 build, preventing new dependencies outside of G1 from being added to G1 components.

Once all the unwanted dependencies of G1 components are removed, the extra_components_which_shouldnt_be_included list should become empty.

Please note, if an extra component B is already added to the build as a dependency of component A (A -> B), the build of this example will not fail when a new dependency onto the same component is added (C -> B). It will only fail when a new component is added to the build. Diff-ing build/component_deps.dot (see below) against a known-good one could be an alternative, but it will likely be quite fragile.

Using this test app

To check G1 components using this app, run:

idf.py reconfigure

(optionally, set IDF_TARGET to check this for a different target than the default one)

Troubleshooting

If you get a build error in this example,

Unexpected components list in G1 build. Expected: <list>. Actual: <list>.

it means that the list of extra components added to G1 build has changed compared to extra_components_which_shouldnt_be_included.

  • If "Expected" contains more components than "Actual" — great! You have simplified the build dependency graph. Identify the component which is no longer added to the build and remove it from extra_components_which_shouldnt_be_included.
  • If "Actual" contains more components than "Expected" — not so great. It means that some change has caused additional component to be "pulled into" the build. If you don't know which additional component was added, check component_deps.dot file in the build directory (see below).

Please try very hard not to increase the number of components in extra_components_which_shouldnt_be_included.

Component dependencies graph (component_deps.dot)

When this project is configured, component_deps.dot file in the build directory is generated. This file contains a Graphviz graph showing the component dependencies. You can visualize this graph (using dot tool or online at https://dreampuf.github.io/GraphvizOnline/) to see why an extra component got added. You can also build the project for the base branch, to compare the graph to a known good one.