Skip to content

Commit 5616857

Browse files
celinakalusrlubos
authored andcommitted
[nrf fromtree] samples: ipc: icmsg: Add received bytes metric
By adding this metric, any problem with the remote core sending messages is observable. Signed-off-by: Celina Sophie Kalus <[email protected]> (cherry picked from commit 9e0d4ef)
1 parent 130840c commit 5616857

File tree

1 file changed

+7
-0
lines changed
  • samples/subsys/ipc/ipc_service/icmsg/src

1 file changed

+7
-0
lines changed

samples/subsys/ipc/ipc_service/icmsg/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ K_SEM_DEFINE(bound_sem, 0, 1);
2323
static unsigned char expected_message = 'A';
2424
static size_t expected_len = PACKET_SIZE_START;
2525

26+
static size_t received;
27+
2628
static void ep_bound(void *priv)
2729
{
30+
received = 0;
31+
2832
k_sem_give(&bound_sem);
2933
LOG_INF("Ep bounded");
3034
}
@@ -38,6 +42,7 @@ static void ep_recv(const void *data, size_t len, void *priv)
3842
__ASSERT(len == expected_len, "Unexpected length. Expected %zu, got %zu",
3943
expected_len, len);
4044

45+
received += len;
4146
expected_message++;
4247
expected_len++;
4348

@@ -131,6 +136,8 @@ int main(void)
131136
LOG_INF("Wait 500ms. Let remote core finish its sends");
132137
k_msleep(500);
133138

139+
LOG_INF("Received %zu [Bytes] in total", received);
140+
134141
#if defined(CONFIG_SOC_NRF5340_CPUAPP)
135142
LOG_INF("Stop network core");
136143
nrf53_cpunet_enable(false);

0 commit comments

Comments
 (0)