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