Custom KCONFIG variable with custom board revisions

Hi,

I'm having an issue getting KCONFIG to work with multiple board revisions. I have defined a custom board. It has all the files needed and we can build product code on that. We are now making some hardware changes and want to have a C flag defined in the newer board versions. I have tried defining the flag in different places but build still seems to fail.

I want to have a flag like #define APP_TOUCH_PT8041. The code works when I do this in a C code file. I check the flag with a macro like this COND_CODE_1(CONFIG_APP_TOUCH_PT8041, (), (iqs323_sleep();)). Now what I want to do is have this flag defined in KCONFIG instead of doing it in the C code files. And what I really want is to use the board revision files to define this flag. So lets say my board is called plank. I have a lot of things defined in plank.defconfig but for each revision of my board there are two files (plank_1_0_0.overlay and plank_1_0_0.conf) - my understanding is that I can use the plank_1_0_0.conf file to define flags specific to that board revision. But whatever I do I can't seem to get the build system to accept my flag like this. I have tried putting the following thing in many different places but so far it has not worked.

config APP_TOUCH_PT8041
    bool "Board version using the older PT8041 touch chip"
    default n

I want this flag to be defined and default to "n" in all versions of my board except for specific ones where I put CONFIG_APP_TOUCH_PT8041 = y in the board revision conf file.

Is this possible or or should I just check the revision information in a code file and do the definition there. I think this would be kind of ugly but that seems to work. 

Tiit

Parents
  • Hi Tiit,

    First you can include additional conf files in the build for the specific revisions, including references to specific kconfig files, you can also have nested kconfig files specific to the subfolders.

    Based on your description, looks like a configuration issue between build script, conf and kconfig files (and of course CMakeFiles). Start by adding custom config with y to project main kconfig and see if you access it in C code, using either #ifdef or #if defined or IS_ENABLED macros.

    Would suggest deriving from a simple sample (Empty project).

    Reuven

Reply
  • Hi Tiit,

    First you can include additional conf files in the build for the specific revisions, including references to specific kconfig files, you can also have nested kconfig files specific to the subfolders.

    Based on your description, looks like a configuration issue between build script, conf and kconfig files (and of course CMakeFiles). Start by adding custom config with y to project main kconfig and see if you access it in C code, using either #ifdef or #if defined or IS_ENABLED macros.

    Would suggest deriving from a simple sample (Empty project).

    Reuven

Children
  • I can add a custom config to the main kconfig and I can access that in the c code. But doing the same thing through the board revision files fails in all sorts of fun ways. I have no previous kconfig (or any Zephyr/Linux build experience) so I really have no idea how to debug this. Is it possible to privately send you the project files and you can see what is wrong there? I got to a point now where I can build my project successfully for some board versions (where I don't set APP_TOUCH_PT8041=y) but versions that do set that will fail with completely unrelated issues. Right now I'm getting errors from devicetree, mcuboot and an undefined CONFIG_BOARD error when setting APP_TOUCH_PT8041=y. It does not seem related at all so I'm guessing something is failing in kconfig causing everything to be misconfigured.

    Tiit

Related