Skip to content

NCS: stubs remove symbol dependencies for MEMFAULT_NRF_CONNECT_SDK=n #112

@JordanYates

Description

@JordanYates

The Kconfig stubs added in v1.37.0, while they work to suppress Kconfig linting errors, remove all symbol dependencies from those symbols when MEMFAULT_NRF_CONNECT_SDK=n.

# Provide placeholder definitions for symbols that are only defined when
# MEMFAULT_NRF_CONNECT_SDK is enabled, to avoid Kconfig lints about missing
# symbols in other Zephyr configurations.

The linting workaround defines new instances of each symbol with inherited dependencies of !MEMFAULT_NRF_CONNECT_SDK, e.g.

config MODEM_KEY_MGMT
	bool
	depends on !MEMFAULT_NRF_CONNECT_SDK

which sits alongside the definition from sdk-nrf:

config MODEM_KEY_MGMT
	bool "nRF9160 modem key management library"
	depends on NRF_MODEM_LIB

Since Kconfig dependencies between re-declarations of the same symbol are treated independently, this mean that if MEMFAULT_NRF_CONNECT_SDK is disabled, the NRF_MODEM_LIB dependency disappears.

My personal situation is that I import a few libraries from NCS (for example NRF_MODEM_LIB) but don't use NCS itself, which means that any of these symbols with default values end up pulled to y despite the real dependencies not being met.

I suspect the same issue will appear if the Memfault project is imported, but CONFIG_MEMFAULT=n.
Since CONFIG_MEMFAULT=n, MEMFAULT_NRF_CONNECT_SDK=n, and the dependencies will disappear.

I should have kept quite about the initial linting errors, because actual compile errors are worse :).

Note that I don't think there is actually a way to resolve this issue properly in Kconfig itself, since you have one repo that is intended to be used from two different contexts (Native Zephyr vs NCS). I believe the best way to resolve the original linting error, and this follow on problem, is to extend the linting checks to take a list of symbols that should be ignored from the warnings. Unfortunately that requires changes to Zephyr itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions