tests: app_kernel: Add bench_mem_partition

Adds macros for placing variables into bench_mem_partition.
This partition will be used to place global data in the test
that will need to be accessed from user threads.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2023-10-18 09:49:20 -04:00 committed by Carles Cufí
commit bf2ab9be60
2 changed files with 23 additions and 7 deletions

View file

@ -32,7 +32,6 @@ char sline[SLINE_LEN + 1];
*/
uint32_t tm_off;
/********************************************************************/
/* static allocation */
@ -41,6 +40,10 @@ static struct k_thread recv_thread;
K_THREAD_STACK_DEFINE(test_stack, TEST_STACK_SIZE);
K_THREAD_STACK_DEFINE(recv_stack, RECV_STACK_SIZE);
#ifdef CONFIG_USERSPACE
K_APPMEM_PARTITION_DEFINE(bench_mem_partition);
#endif
K_MSGQ_DEFINE(DEMOQX1, 1, 500, 4);
K_MSGQ_DEFINE(DEMOQX4, 4, 500, 4);
K_MSGQ_DEFINE(MB_COMM, 12, 1, 4);
@ -72,6 +75,15 @@ static void test_thread_entry(void *p1, void *p2, void *p3)
ARG_UNUSED(p2);
ARG_UNUSED(p3);
PRINT_STRING("\n");
PRINT_STRING(dashline);
PRINT_STRING("| S I M P L E S E R V I C E "
"M E A S U R E M E N T S | nsec |\n");
#ifdef CONFIG_USERSPACE
PRINT_STRING((const char *)arg1);
#endif
PRINT_STRING(dashline);
message_queue_test();
sema_test();
mutex_test();
@ -91,12 +103,6 @@ int main(void)
bench_test_init();
PRINT_STRING("\n");
PRINT_STRING(dashline);
PRINT_STRING("| S I M P L E S E R V I C E "
"M E A S U R E M E N T S | nsec |\n");
PRINT_STRING(dashline);
k_thread_create(&test_thread, test_stack,
K_THREAD_STACK_SIZEOF(test_stack),
test_thread_entry, NULL, NULL, NULL,

View file

@ -21,6 +21,8 @@
#include <zephyr/sys/util.h>
#include <zephyr/app_memory/app_memdomain.h>
/* printf format defines. */
#define FORMAT "| %-65s|%10u|\n"
@ -35,6 +37,14 @@
#define NR_OF_PIPE_RUNS 256
#define SEMA_WAIT_TIME (5000)
#ifdef CONFIG_USERSPACE
#define BENCH_BMEM K_APP_BMEM(bench_mem_partition)
#define BENCH_DMEM K_APP_DMEM(bench_mem_partition)
#else
#define BENCH_BMEM
#define BENCH_DMEM
#endif
/* global data */
extern char msg[MAX_MSG];