Hi,
To compile my project for esp32 and esp32s3 (with a display), I use idf.py set-target and a KConfig depends on IDF_TARGET_ESP32S3 combined with if/endif clauses in my CMakeLists.txt.
This works great, but the contents of idf_component.yml are always parsed/downloaded/compiled, even though they are not added to my REQUIRES/idf_component_register. So the components are build, although never used/linked.
Is some logic possible to use a KConfig variable or a method like sdkconfig.defaults.<target> to select different idf components, based on a selection?
Conditional usage of idf_component.yml ?
-
- Posts: 1735
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Conditional usage of idf_component.yml ?
Is this what you need?
The if field supports idf_version and target variables. The idf_version variable contains the version of ESP-IDF that is used to build the component. The target variable contains the current target selected for the project.
Re: Conditional usage of idf_component.yml ?
I read that page yesterday and was under the impression that the format specified is for components in the registry, not when using them: The idf_component.yml file is a YAML file that describes the component.
After adding a few items from the registry using idf.py add-dependency, I got a file idf_component.yml.
These components are only relevant, when my target is set to esp32s3. When the target is esp32, they are not used, but the build system does download them, hence my search for some target dependency magic.
When I add matches or rules, idf.py starts complaining:
After adding a few items from the registry using idf.py add-dependency, I got a file idf_component.yml.
Code: Select all
dependencies:
lvgl/lvgl: "^8.3.7"
espressif/esp_lcd_touch_gt911: "==1.0.7~1"
idf:
version: ">=4.1.0"
When I add matches or rules, idf.py starts complaining:
Maybe my syntax in the yml file is not correct, or my approach is not supported (right now).Unknown string field "if" in the manifest file that may affect build result
Invalid manifest format
Invalid dependency format
Dependency version spec format is invalid
"rules" version have unknown format. Should be either version string or
dictionary with details
SUGGESTION: This component may be using a newer version of the component
manager.
Re: Conditional usage of idf_component.yml ?
A small change in syntax resolved my issues. Thanks for your time.
Code: Select all
dependencies:
lvgl/lvgl:
version: "^8.3.7"
rules:
- if: "target == esp32s3"
espressif/esp_lcd_touch_gt911:
version: "==1.0.7~1"
rules:
- if: "target == esp32s3"
idf:
version: ">=4.1.0"
Who is online
Users browsing this forum: dzungpv and 70 guests