sdkconfig for multiple projects with common code components

jesper
Posts: 26
Joined: Thu Nov 09, 2017 4:38 pm

sdkconfig for multiple projects with common code components

Postby jesper » Thu Jun 27, 2024 7:37 am

I have roughly this setup.


Code: Select all

[size=85]- common_code/
        - component1/ 
                - include/ - component1.h
                - Kconfig
                - src1.c
        - component2/ 
                - include/ - component2.h
                - Kconfig
                - src2.c
                                  
- Project_1/
        - build/
        - main/       
            - src3.c
            - src4.c
            - CMakeLists.txt
        - CMakeLists.txt
        - sdkconfig

- Project_2/
        - build/
        - main/       
            - src5.c
            - src6.c
            - CMakeLists.txt
        - CMakeLists.txt
        - sdkconfig[/size]

The common_code folder contains various hardware drivers that are used by both Project_1 and Project_2.
However, the GPIO configurations and some other parameters are different.
The Kconfig in each component folder contains a “default” configuration.
This is an example of the Kconfig for the accelerometer component.

Code: Select all

[size=85]menu "Accelerometer Component Configuration"

    menu "Accelerometer Configuration"
        config ACCELEROMETER_I2C_ADDRESS
            int "Accelerometer I2C Addess"
            default 24
            range 0 255
            help
                I2C Address of accelerometer.

        config ACCELEROMETER_INTERRUPT_GPIO
            int "Accelerometer Interrupt Pin Number"
            default 4
            range 0 31
            help
                Pin number of accelerometer interrupt GPIO.
    endmenu

endmenu[/size]

I had hoped to be able to open the sdkconfig in each project in the sdkconfig editor (Espressif IDE) and configure the specific settings.
However, when I build the project, the sdkconfig settings are overwritten by the Kconfig settings.
I could, of course, have a sdkconfig.default or so in each Project folder, but that would require this to be created/copied manually and
if a new setting is added to a component, all projects needs to have their sdkconfig.default files updated manually.

As it is now, it looks smooth, the component setting show up in sdkconfig.
But sadly, it doesn’t work, as I cannot change the config, per project.



Any ideas how to accomplish this?


Did I miss something?
MagicMicros Co., Ltd. - Rayong, Thailand
Electronics design, PCB layout & programming.

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: sdkconfig for multiple projects with common code components

Postby ESP_Sprite » Thu Jun 27, 2024 8:37 am

I think some of the ESP-IDF examples or testcases do this; they use their own KConfig files to force certain values in the general menuconfig. You may want to browse through that for inspiration.

jesper
Posts: 26
Joined: Thu Nov 09, 2017 4:38 pm

Re: sdkconfig for multiple projects with common code components

Postby jesper » Thu Jun 27, 2024 11:20 am

Ignore post, stupid mistake, I couldn't see the forest for the trees.
Problem solved, it DOES work as planned.
MagicMicros Co., Ltd. - Rayong, Thailand
Electronics design, PCB layout & programming.

Who is online

Users browsing this forum: gamename and 65 guests