Skip to content

Commit 52afdb8

Browse files
Damian-Nordicrlubos
authored andcommitted
applications: protocols_serialization: refactor snippets
...to ease logging. Reorganize the protocols serialization client and server snippets to be able to test logging over RPC without verbose nRF RPC core & transport logging. In ps_client: 1. Enable logging by default. 2. Make "debug" snippet only enable nRF RPC logs and other debug features. In protocols_serialization: 1. Make "log_rpc" snippet enable logging over RPC and OpenThread logs. 2. Make "debug" snippet enable (addtionally) logging over UART console. Make other Kconfig adjustments to remove build warnings and reduce config duplication. Signed-off-by: Damian Krolik <[email protected]>
1 parent 61c5f84 commit 52afdb8

File tree

12 files changed

+59
-55
lines changed

12 files changed

+59
-55
lines changed

applications/protocols_serialization/Kconfig

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,30 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
menu "Protocols serialization server"
8+
9+
choice LOG_MODE
10+
default LOG_MODE_DEFERRED
11+
endchoice
12+
13+
config LOG_BUFFER_SIZE
14+
default 8192
15+
16+
config LOG_FUNC_NAME_PREFIX_DBG
17+
default n
18+
19+
config LOG_BACKEND_RTT
20+
default n
21+
22+
config LOG_BACKEND_UART
23+
default n
24+
25+
module = NRF_PS_SERVER
26+
module-str = nrf_ps_server
27+
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
28+
29+
endmenu # "Protocols serialization server"
30+
731
menu "Zephyr Kernel"
832
source "Kconfig.zephyr"
933
endmenu
10-
11-
module = NRF_RPC_REMOTE
12-
module-str = nrf_rpc_remote
13-
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

applications/protocols_serialization/prj.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#
66
CONFIG_HEAP_MEM_POOL_SIZE=4096
77

8-
CONFIG_THREAD_CUSTOM_DATA=y
9-
108
CONFIG_NRF_RPC=y
119
CONFIG_NRF_RPC_CBOR=y
1210
CONFIG_NRF_RPC_ZCBOR_BACKUPS=1

applications/protocols_serialization/snippets/debug/debug.conf

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,18 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
# Enable multithread support in gdb
7+
# Reduce optimization level for easier debugging
88
CONFIG_DEBUG=y
99

1010
# Enable asserts
1111
CONFIG_ASSERT=y
12-
#CONFIG_ASSERT_NO_COND_INFO=y
1312

13+
# Enable UART console
1414
CONFIG_LOG=y
15-
16-
# Use separate thread for logging
17-
CONFIG_LOG_MODE_DEFERRED=y
18-
CONFIG_LOG_BUFFER_SIZE=4096
19-
CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n
20-
CONFIG_LOG_BACKEND_RTT=n
2115
CONFIG_LOG_BACKEND_UART=y
2216

23-
# Increase max log level to informative
24-
CONFIG_LOG_MAX_LEVEL=4
25-
26-
CONFIG_NRF_RPC_REMOTE_LOG_LEVEL_DBG=y
17+
# Enable verbose logging
18+
CONFIG_NRF_PS_SERVER_LOG_LEVEL_DBG=y
2719
CONFIG_NRF_RPC_TR_LOG_LEVEL_DBG=y
2820
CONFIG_NRF_RPC_LOG_LEVEL_DBG=y
2921
CONFIG_NRF_RPC_OS_LOG_LEVEL_DBG=y
30-
CONFIG_NET_L2_IEEE802154_LOG_LEVEL_ERR=y

applications/protocols_serialization/snippets/log_rpc/log_rpc.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
CONFIG_LOG=y
78
CONFIG_LOG_BACKEND_RPC=y
89
CONFIG_LOG_BACKEND_RPC_CRASH_LOG=y
910

1011
# nRF RPC requires slightly bigger stack than default
1112
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024
13+
14+
# Enable OpenThread logs along with logging over RPC
15+
CONFIG_OPENTHREAD_DEBUG=y
16+
CONFIG_OPENTHREAD_LOG_LEVEL_INFO=y

applications/protocols_serialization/snippets/openthread/openthread.conf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
CONFIG_OPENTHREAD_SHELL=y
8-
9-
CONFIG_SHELL_ARGC_MAX=26
10-
CONFIG_SHELL_CMD_BUFF_SIZE=416
11-
127
# Enable OpenThread features set
138
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
149
CONFIG_OPENTHREAD_SOURCES=y

applications/protocols_serialization/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <nrf_rpc.h>
1010

11-
LOG_MODULE_REGISTER(nrf_rpc_remote, CONFIG_NRF_RPC_REMOTE_LOG_LEVEL);
11+
LOG_MODULE_REGISTER(nrf_ps_server, CONFIG_NRF_PS_SERVER_LOG_LEVEL);
1212

1313
static void err_handler(const struct nrf_rpc_err_report *report)
1414
{

samples/nrf_rpc/ps_client/Kconfig

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
mainmenu "Protocols serialization client"
7+
menu "Protocols serialization client"
8+
9+
config BT_CTLR
10+
default n
11+
12+
choice BT_NUS_LOG_LEVEL_CHOICE
13+
default BT_NUS_LOG_LEVEL_DBG if DEBUG
14+
endchoice
815

916
config RPC_CRASH_LOG_READ_BUFFER_SIZE
1017
int "Crash log read buffer size"
@@ -14,13 +21,12 @@ config RPC_CRASH_LOG_READ_BUFFER_SIZE
1421
Size of the stack buffer used for reading a single chunk of the crash
1522
log from the server device.
1623

17-
config BT_CTLR
18-
default n
24+
module = NRF_PS_CLIENT
25+
module-str = nrf_ps_client
26+
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
27+
28+
endmenu # "Protocols serialization client"
1929

2030
menu "Zephyr Kernel"
2131
source "Kconfig.zephyr"
2232
endmenu
23-
24-
module = NRF_PS_CLIENT
25-
module-str = nrf_ps_client
26-
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

samples/nrf_rpc/ps_client/prj.conf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#
66
CONFIG_HEAP_MEM_POOL_SIZE=4096
77

8-
CONFIG_THREAD_CUSTOM_DATA=y
9-
108
CONFIG_NRF_RPC=y
119
CONFIG_NRF_RPC_CBOR=y
1210
CONFIG_NRF_RPC_ZCBOR_BACKUPS=1
@@ -18,4 +16,9 @@ CONFIG_UART_LINE_CTRL=y
1816
CONFIG_UART_INTERRUPT_DRIVEN=y
1917

2018
CONFIG_SHELL=y
21-
CONFIG_NET_SHELL=y
19+
CONFIG_LOG=y
20+
CONFIG_LOG_MODE_DEFERRED=y
21+
CONFIG_LOG_BUFFER_SIZE=4096
22+
CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n
23+
CONFIG_LOG_BACKEND_RTT=n
24+
CONFIG_SHELL_LOG_BACKEND=y

samples/nrf_rpc/ps_client/snippets/debug/debug.conf

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,14 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
# Enable multithread support in gdb
7+
# Reduce optimization level for easier debugging.
88
CONFIG_DEBUG=y
99

1010
# Enable asserts
1111
CONFIG_ASSERT=y
12-
#CONFIG_ASSERT_NO_COND_INFO=y
13-
14-
CONFIG_LOG=y
15-
16-
# Use separate thread for logging
17-
CONFIG_LOG_MODE_DEFERRED=y
18-
CONFIG_LOG_BUFFER_SIZE=4096
19-
CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n
20-
CONFIG_LOG_BACKEND_RTT=n
21-
CONFIG_SHELL_LOG_BACKEND=y
22-
23-
# Increase max log level to informative
24-
CONFIG_LOG_MAX_LEVEL=4
2512

13+
# Enable verbose logging
2614
CONFIG_NRF_PS_CLIENT_LOG_LEVEL_DBG=y
2715
CONFIG_NRF_RPC_TR_LOG_LEVEL_DBG=y
2816
CONFIG_NRF_RPC_LOG_LEVEL_DBG=y
2917
CONFIG_NRF_RPC_OS_LOG_LEVEL_DBG=y
30-
CONFIG_BT_NUS_LOG_LEVEL_DBG=y

samples/nrf_rpc/ps_client/snippets/log_rpc/log_rpc.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
CONFIG_LOG=y
87
CONFIG_LOG_FORWARDER_RPC=y

0 commit comments

Comments
 (0)