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 Reply
  • I think I found the issue and got it working now. I never paid attention to it but I had spaces around the equals sign in the "CONFIG_APP_TOUCH_PT8041 = y" part. This causes it to fail. It has to be "CONFIG_APP_TOUCH_PT8041=y". I can't put anything in the Kconfig.board file without everything breaking in the weirdest ways possible. But putting the definition and default value for the config in the Kconfig.defconfig file works now and I can read the flag in code. As far as I'm concerned this fixes the issue and I have a solution to my problem.

Children
Related