Include component strategy on large configurable projects

Dav_FR
Posts: 14
Joined: Mon Mar 27, 2017 8:14 am

Include component strategy on large configurable projects

Postby Dav_FR » Fri Sep 25, 2020 9:56 pm

Dear all,

I would like to know if someone can share with me the most correct cmake component inclusion strategy for a large project. Maybe I missed something understanding the official guide.

I'm managing a project with around 50 components in which there are low-level integration components (basic , peripheral controllers component(several kind of sensors), protocol components(mqtt, ...), service components (ia, ...), ...

These presents chained in requirements, for instance, a "integration_sht35" (basic low level access via i2c to an sht35 to extract values) is required by "integration_peripheral_temperature_internal_sht35" (specialization), at the same time, "integration_peripheral_temperature_internal_sht35" component is required by the "peripheralcontroller_temperature_internal_sht35" (loop to extract periodically and report via event to other components, ...), "peripheralcontroller_temperature_internal_sht35" is required by "protocol_mqtt" component, and "protocol_mqtt" is runned by the "connectivity_management" component, which is started from main.

Depending on the device hardware configuration (build through enable protocols, peripherals, services on the main Kconfig), it's required to enable specific components. The options for all the peripherals are in a unique kconfig on main in order to concentrate the different options on a single menu.

I'm right now trying to port the project from old make (v3.3.2) to CMake to use v4.1. ccache raises errors related with not found files or undefined reference during link arises.

Code: Select all

cmd.exe /C "cd . && C:\msys32\opt\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe  -mlongcalls -Wno-frame-address   @CMakeFiles\prod-esp32.elf.rsp  -o prod-esp32.elf  && cd ."
c:/msys32/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/integration_perphtest/libintegration_perphtest.a(peripheral_temperature_humidity_aq_hood_sht35.c.obj):(.literal.Peripheral_Temperature_Humidity_AQ_Hood_SHT35_Get_Values+0x0): undefined reference to `Peripheral_I2C_SHT35_Read_Sensor'
c:/msys32/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/integration_perphtest/libintegration_perphtest.a(peripheral_temperature_humidity_aq_hood_sht35.c.obj): in function `Peripheral_Temperature_Humidity_AQ_Hood_SHT35_Get_Values':

Code: Select all

ccache: error: Failed to create temporary file for esp-idf/integration_peripheral_temperature_humidity_external_sht35/CMakeFiles/__idf_integration_peripheral_temperature_humidity_external_sht35.dir/src/peripheral_temperature_humidity_external_sht35.c.obj: No such file or directory
At the end I have manage the following kind of files:
- CMakeLists.txt
- main/CMakeLists.txt
- components/integration_sht35/CMakeLists.txt
- components/integration_peripheral_temperature_internal_sht35/CMakeLists.txt
- components/peripheralcontroller_temperature_internal_sht35/CMakeLists.txt
- components/protocol_mqtt/CMakeLists.txt

I tried with several strategies,
- automatically select inclusion of required components with IF clause on CMakeList (seems not working since kconfig is not processed before to create the get requirements)
- include all components and later exclude with OBJECTEXCLUDE or similar (seems not supported right now)
- Include required components on each components and try to exclude .c and .h with if clause when selecting the sources

Right now I'm working on the latest strategy which seem the best way from my point of view but i'm not being able to successfully configure CMake for some peripherals (3-4).

Right now I'm testing a theory about a relation of the compilation errors with the usage of a component required by several components as the fail cause.

Some idea/recommendation?

P.D: The project compiles and run with old make method without problems after update some API and includes.

Best regards and thank you in advance

Who is online

Users browsing this forum: acsoprana, Google [Bot] and 90 guests