Memory definition on automatic build system

gusa86
Posts: 3
Joined: Mon Sep 20, 2021 1:19 pm

Memory definition on automatic build system

Postby gusa86 » Mon Sep 20, 2021 1:39 pm

Hello,

I have a problem setting partition memory files.

The objective is to create a project where I can choose between different hardware systems using "menu config tool". Each system will have a different memory size. This is why is important to select partition memory file.

Right now I am using "idf.py menuconfig" which let me select the file under "Partition Table". I would like to be able to make a menu that lets me choose hardware 1 and directly select the proper memory file without modifying parition_table component. The main problem is that I need to modify the variables that use partition_table component after the variables are set in "idf.py menuconfig" but before the component partition_table component starts executing.

As a workaround is it possible to set de sdkconfig file in the cmake but only before menuconfig variable where parsed so it is not a proper solution neither.

I am not sure if it is possible or not. Could you give me a clue on how to achieve it?

Kind regards.

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Memory definition on automatic build system

Postby ESP_igrr » Mon Sep 20, 2021 3:58 pm

Hi gusa86,

Unfortunately there doesn't seem to be a way in Kconfig to set a specific value of string option (CONFIG_PARTITION_TABLE_CUSTOM_FILENAME) in Kconfig based on a value of a choice option (e.g. CONFIG_MY_HARDWARE_TYPE).

It's not exactly the same solution as you are looking for, but if you can consider specifying the hardware type from the command line rather than menuconfig, this example project demonstrates how to do this: https://github.com/espressif/esp-idf/tr ... lti_config.

gusa86
Posts: 3
Joined: Mon Sep 20, 2021 1:19 pm

Re: Memory definition on automatic build system

Postby gusa86 » Tue Sep 21, 2021 6:51 am

Thank you for your fast reply ESP_igrr,

I have been thinking about different solutions:

I tried setting CONFIG_PARTITION_TABLE_CUSTOM_FILENAME in CMakeList.txt after and before calling with any success:

Code: Select all

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(${_project_name})
Second solution would be trying to set the value inside kconfig.projbuild from main based on partition_table component https://sourcegraph.com/github.com/espr ... .projbuild:

Code: Select all

menu "Hardware"

    choice HARDWARE_TYPE
        prompt "Hardware type"
        default HARDWARE_1
        help
            Choose the proper hardware device
        config HARDWARE_1
            bool "HARDWARE_1"
        config HARDWARE_2
            bool "HARDWARE_2"
        config HARDWARE_3
            bool "HARDWARE_3"
    endchoice

        config PARTITION_TABLE_CUSTOM_FILENAME
            string
            default "partitions_0.csv" if HARDWARE_1
            default "partitions_1.csv" if HARDWARE_2
            default "partitions_2.csv" if HARDWARE_3

endmenu
At the moment of calling build the variable is not set so of course it shows an error.

Do you see something that could work with these approaches? If not I will use you solution.

Thanks :D

Who is online

Users browsing this forum: ok-home and 90 guests