zephyr/subsys/net/lib/lwm2m/Kconfig
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00

197 lines
5.3 KiB
Text

#
# Copyright (c) 2017 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
menuconfig LWM2M
bool "OMA LWM2M protocol stack"
select COAP
select NET_APP_CLIENT
select HTTP_PARSER_URL
help
This option adds logic for managing OMA LWM2M data
if LWM2M
config SYS_LOG_LWM2M_LEVEL
int "LWM2M log level"
depends on SYS_LOG
default 1
range 0 4
help
Set the log level for the LWM2M library.
config LWM2M_ENGINE_STACK_SIZE
int "LWM2M engine stack size"
default 1536 if NET_LOG_GLOBAL
default 1024
help
Set the stack size for the LWM2M library engine (used for handling
OBSERVE and NOTIFY events)
config LWM2M_ENGINE_MAX_MESSAGES
int "LWM2M engine max. message object"
default 10
help
Set the maximum message objects for the LWM2M library client
config LWM2M_ENGINE_MAX_PENDING
int "LWM2M engine max. pending objects"
default 5
help
Set the maximum pending objects for the LWM2M library client
config LWM2M_ENGINE_MAX_REPLIES
int "LWM2M engine max. reply objects"
default 5
help
Set the maximum reply objects for the LWM2M library client
config LWM2M_ENGINE_MAX_OBSERVER
int "Maximum # of observable LWM2M resources"
default 10
range 5 200
help
This value sets the maximum number of resources which can be
added to the observe notification list.
config LWM2M_ENGINE_DEFAULT_LIFETIME
int "LWM2M engine default server connection lifetime"
default 30
range 15 65535
help
Set the default lifetime (in seconds) for the LWM2M library engine
config LWM2M_LOCAL_PORT
int "LWM2M client port"
default 0
help
This is the client port for LWM2M communication. The default
setting of 0 sets a random port for the client to be used for
outgoing communication.
config LWM2M_SECURITY_INSTANCE_COUNT
int "Maximum # of LWM2M Security object instances"
default 1
range 1 10
help
This setting establishes the total count of LWM2M Security instances
available to the client.
config LWM2M_SERVER_INSTANCE_COUNT
int "Maximum # of LWM2M Server object instances"
default 1
range 1 10
help
This setting establishes the total count of LWM2M Server instances
available to the client (including: bootstrap and regular servers).
config LWM2M_RD_CLIENT_SUPPORT
bool "support for LWM2M client bootstrap/registration state machine"
default y
help
Client will use registration state machine to locate and connect to
LWM2M servers (including bootstrap server support)
config LWM2M_PEER_PORT
int "LWM2M server port"
depends on LWM2M_RD_CLIENT_SUPPORT
default 5683
help
This is the server port to connect to for LWM2M communication
config LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT
bool "Firmware Update object support"
default y
help
Include support for LWM2M Firmware Update Object (ID 5)
config LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
bool "Firmware Update object pull support"
default y
depends on LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT
depends on (HTTP_PARSER || HTTP_PARSER_URL)
help
Include support for pulling a file from a remote server via
block transfer and "FIRMWARE PACKAGE URI" resource. This option
adds another UDP context and packet handling.
config LWM2M_FIRMWARE_UPDATE_PULL_LOCAL_PORT
int "LWM2M client firmware pull local port"
default 0
depends on LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
help
This is the client port for LWM2M firmware download. The default
setting of 0 sets a random port for the client to be used for
outgoing communication.
config LWM2M_COAP_BLOCK_SIZE
int "LWM2M CoAP block-wise transfer size"
default 64 if NET_L2_BT
default 64 if NET_L2_IEEE802154
default 256
range 16 1024
help
CoAP block size used by LWM2M when performing block-wise
transfers. Possible values: 16, 32, 64, 128, 256, 512 and 1024.
config LWM2M_NUM_BLOCK1_CONTEXT
int "Maximum # of LWM2M block1 contexts"
default 3
help
This value sets up the maximum number of block1 contexts for
CoAP block-wise transfer we can handle at the same time.
config LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_SUPPORT
bool "Firmware Update object pull via CoAP-CoAP/HTTP proxy support"
depends on LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
help
Include support for pulling firmware file via a CoAP-CoAP/HTTP proxy.
if LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_SUPPORT
config LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_ADDR
string "CoAP proxy network address"
help
Network address of the CoAP proxy server.
endif # LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_SUPPORT
config LWM2M_RW_JSON_SUPPORT
bool "support for JSON writer"
default y
help
Include support for writing JSON data
config LWM2M_DEVICE_PWRSRC_MAX
int "Maximum # of device power source records"
default 5
range 1 20
help
This value sets the maximum number of power source data that a device
can store. These are displayed via the "Device" object /3/0/6,
/3/0/7 and /3/0/8 resources.
config LWM2M_DEVICE_ERROR_CODE_MAX
int "Maximum # of device obj error codes to store"
default 10
range 1 20
help
This value sets the maximum number of error codes that the device
object will store before ignoring new values.
config LWM2M_NUM_ATTR
int "Maximum # of LWM2M attributes"
default 20
help
This value sets up the maximum number of LwM2M attributes that
we can handle at the same time.
menu "IPSO Alliance Smart Object Support"
source "subsys/net/lib/lwm2m/Kconfig.ipso"
endmenu
endif # LWM2M