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