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
  • Nick_RA said:
    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.

    Ah I see. Adding a new Kconfig is exactly what the snippet you shared did, so I thought that was the intention.

    If you want Kconfig fragment, you can just create a new .conf file with similar syntax to the familiar prj.conf, like this.

    c348718_custom_kconfig_250723_01.zip

    Nick_RA said:
    I wonder what you mean by wrong file type? Does it need to be a particular name and extension?

    Yes. Both file name and extension are significant to the build system. Please refer to both NCS and Zephyr application development guides:

    NCS: Application development
    Zephyr: Developing with Zephyr

Children
No Data
Related