Skip to content

Commit

Permalink
[nrf fromtree] samples: ipc: icmsg: Add received bytes metric
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
celinakalus authored and masz-nordic committed Jul 29, 2024
1 parent b96ad6f commit 492be49
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions samples/subsys/ipc/ipc_service/icmsg/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ K_SEM_DEFINE(bound_sem, 0, 1);
static unsigned char expected_message = 'A';
static size_t expected_len = PACKET_SIZE_START;

static size_t received;

static void ep_bound(void *priv)
{
received = 0;

k_sem_give(&bound_sem);
LOG_INF("Ep bounded");
}
Expand All @@ -38,6 +42,7 @@ static void ep_recv(const void *data, size_t len, void *priv)
__ASSERT(len == expected_len, "Unexpected length. Expected %zu, got %zu",
expected_len, len);

received += len;
expected_message++;
expected_len++;

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

LOG_INF("Received %zu [Bytes] in total", received);

#if defined(CONFIG_SOC_NRF5340_CPUAPP)
LOG_INF("Stop network core");
nrf53_cpunet_enable(false);
Expand Down

0 comments on commit 492be49

Please sign in to comment.