1# Copyright (c) 2021 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menu "Misc"
5
6config LOG_DOMAIN_ID
7	int "Domain ID [DEPRECATED]"
8	depends on !LOG_MODE_MINIMAL
9	default 0
10	range 0 7
11	help
12	  Deprecated. It is not used in the code.
13
14config LOG_CMDS
15	bool "Shell commands"
16	depends on SHELL
17	depends on !LOG_FRONTEND_ONLY && !LOG_MODE_MINIMAL
18
19config LOG_TEST_CLEAR_MESSAGE_SPACE
20	bool "Clear message after allocation"
21	default y
22	depends on ZTEST
23	help
24	  Used in testing to simplify message comparision if message contains
25	  paddings.
26
27config LOG_USE_VLA
28	bool "Using variable length arrays"
29	default y if !MISRA_SANE
30	help
31	  Using VLA slightly decreases stack usage in some cases it may not be
32	  supported. Note that VLA are used for arrays which size is resolved at
33	  compile time so at runtime arrays have fixed size.
34
35config LOG_SIMPLE_MSG_OPTIMIZE
36	bool "Optimize simple messages for size"
37	depends on !64BIT && !CBPRINTF_PACKAGE_HEADER_STORE_CREATION_FLAGS
38	default y
39	help
40	  Dedicated code for handling simple log messages (0-2 32 bit word arguments).
41	  Approximately, 70%-80% log messages in the application fit into that category.
42	  Depending on the architecture code size reduction is from 0-40% (highest seen on
43	  RISCV32) and execution time also up to 40%.
44
45config LOG_ALWAYS_RUNTIME
46	bool "Always use runtime message creation (v2)"
47	default y if NO_OPTIMIZATIONS
48	default y if LOG_MODE_IMMEDIATE
49	default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "xcc"
50	help
51	  If enabled, runtime method is always used for message creation. Static
52	  creation relies on compiler being able to optimize and remove code
53	  based on information known at compile time. Runtime only approach must
54	  be used when optimization is disabled because some compilers
55	  (seen on arm_cortex_m and x86) were using unrealistic amount of stack
56	  for dead code. It is also required in immediate mode since it requires
57	  less stack than static message creation and speed has lower priority
58	  in that mode.
59
60config LOG_FMT_SECTION
61	bool "Keep log strings in dedicated section"
62	help
63	  When enabled, logs are kept in dedicated memory section. It allows
64	  removing strings from final binary and should be used for dictionary
65	  logging.
66
67config LOG_FMT_SECTION_STRIP
68	bool "Strip log strings from binary"
69	depends on LOG_DICTIONARY_SUPPORT
70	depends on LOG_FMT_SECTION
71	depends on LINKER_DEVNULL_SUPPORT
72	imply LINKER_DEVNULL_MEMORY
73	imply LOG_FMT_STRING_VALIDATE
74
75config LOG_FMT_STRING_VALIDATE
76	bool "Validate logging strings"
77	help
78	  Logging strings cannot use %p with character pointers. They should be
79	  casted to the pointer of another type (e.g. void *). With this feature
80	  enabled, at compile time, the preprocessor detects strings with %p
81	  without casting and reports an error at runtime.
82
83config LOG_USE_TAGGED_ARGUMENTS
84	bool "Using tagged arguments for packaging"
85	depends on !PICOLIBC
86	select CBPRINTF_PACKAGE_SUPPORT_TAGGED_ARGUMENTS
87	select LOG_ALWAYS_RUNTIME
88	help
89	  If enabled, packaging uses tagged arguments.
90
91config LOG_MEM_UTILIZATION
92	bool "Tracking maximum memory utilization"
93	depends on LOG_MODE_DEFERRED
94	default y if LOG_CMDS
95	help
96	  When enabled, maximum usage of memory used for log messages in deferred
97	  mode is tracked. It can be used to trim LOG_BUFFER_SIZE.
98
99config LOG_DICTIONARY_DB
100	bool
101
102config LOG_MSG_APPEND_RO_STRING_LOC
103	bool
104	help
105	  Enable this option to force log messages to always append location of
106	  read-only string arguments in the package. This should be selected by
107	  backends if required.
108
109config LOG_FAILURE_REPORT_PERIOD
110	int "Failure report period (in milliseconds)"
111	default 1000
112	depends on LOG_MODE_DEFERRED
113	help
114	  Determines how often failures are reported. Report contains number
115	  of dropped messages. It may contain additional information depending
116	  on the mode.
117
118config LOG_DOMAIN_NAME
119	string "Domain name"
120	default ""
121
122if LOG_MULTIDOMAIN
123
124config LOG_REMOTE_DOMAIN_MAX_COUNT
125	int "Maximum number of link domains"
126	default 4
127	help
128	  Number of domains that can be handled by a link
129
130endif
131endmenu
132