Skip to content

Commit

Permalink
ESP32: Provision to place the app_main in other than main component (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp authored and pull[bot] committed Sep 17, 2024
1 parent 87c9884 commit 2513362
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ if (CONFIG_ENABLE_ENCRYPTED_OTA)
list(APPEND chip_libraries $<TARGET_FILE:${esp_encrypted_img_lib}>)
endif()

idf_component_get_property(main_lib main COMPONENT_LIB)
# Let user set EXECUTABLE_COMPONENT_NAME and defaults to main if not specified
if (NOT EXECUTABLE_COMPONENT_NAME)
set(EXECUTABLE_COMPONENT_NAME "main")
endif()
idf_component_get_property(main_lib ${EXECUTABLE_COMPONENT_NAME} COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${main_lib}>)

if (CONFIG_SEC_CERT_DAC_PROVIDER)
Expand Down
15 changes: 15 additions & 0 deletions docs/guides/esp32/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ Configure below options through `idf.py menuconfig` and build the app.
CONFIG_DISABLE_IPV4=y
CONFIG_LWIP_IPV4=n
```

### Executable component not in "main" component

The ESP-IDF framework allows renaming the main component, which can be useful if
you want to place the app_main() function in a different component.

For required changes in the executable component, please refer to the
[esp-idf documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html#renaming-main-component).

If you're building applications that support Matter and want to place app_main()
in a component other than main, use the following command:

```
idf.py -DEXECUTABLE_COMPONENT_NAME="your_component" build
```

0 comments on commit 2513362

Please sign in to comment.