Normally main.c file doesn't have a header file, because it doesn't need to declare any interfaces to other modules. In this sample, it's better to put the shared variables in one place, and provide the interfaces to other modules, such as app_a, app_b, and main. Signed-off-by: Paul He <pawpawhe@gmail.com>
22 lines
607 B
C
22 lines
607 B
C
/*
|
|
* Copyright (c) 2019 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include "app_shared.h"
|
|
|
|
/* Define the shared partition, which will contain a memory region that
|
|
* will be accessible by both applications A and B.
|
|
*/
|
|
K_APPMEM_PARTITION_DEFINE(shared_partition);
|
|
|
|
/* Define a memory pool to place in the shared area.
|
|
*/
|
|
K_APP_DMEM(shared_partition) struct sys_heap shared_pool;
|
|
K_APP_DMEM(shared_partition) uint8_t shared_pool_mem[HEAP_BYTES];
|
|
|
|
/* queues for exchanging data between App A and App B */
|
|
K_QUEUE_DEFINE(shared_queue_incoming);
|
|
K_QUEUE_DEFINE(shared_queue_outgoing);
|