How to add custom config lines to a Kconfig fragment?

Using NCS 3.0.2 I have multiple build variants of my project, based on the same custom PCB but with different parts fitted, and different functionality. So I have create different build configs with custom dts files - this works OK.

I would like to add some of my own custom config entries, so I'm trying to use a Kconfig fragment, but whatever I try I get a "ignoring malformed text" error

Here's an example:

config FOO
  bool "foobar"
  default n

Cwarning: ignoring malformed line 'config FOO_BAR'
Cwarning: ignoring malformed line '  bool "foobar"'
Cwarning: ignoring malformed line '  default n'

Where am I going wrong...?

Parents Reply
  • I wonder what you mean by wrong file type? Does it need to be a particular name and extension?

    What you seem to have done is made a config for the application; what I need to do is add extra fragments to different build configurations so each build has its own Kconfig add-on.

    I saved your config into a text file, then added it to a test build configuration as an Extra Kconfig fragment like so:

    source "Kconfig.zephyr"
    
    menu "Custom Kconfig file"
    
    config FOO
      bool "foobar"
      default n
    
    endmenu

    but this gives the same result.

    (by the way, are the source, menu/endmenu required?)

Children
No Data
Related