Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>

Macros

#define TIMEOUT_MS   500
 
#define POOL_SIZE   28672
 
#define STACK_OBJ_SIZE   K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)
 
#define MAX_HEAP_STACKS   (POOL_SIZE / STACK_OBJ_SIZE)
 

Functions

 K_HEAP_DEFINE (stack_heap, 28672)
 
static void func (void *arg1, void *arg2, void *arg3)
 
 ZTEST_USER (dynamic_thread_stack, test_dynamic_thread_stack_userspace_dyn_obj)
 Check we can create a thread from userspace, using dynamic objects.
 
 ZTEST (dynamic_thread_stack, test_dynamic_thread_stack_pool)
 Exercise the pool-based thread stack allocator.
 
 ZTEST (dynamic_thread_stack, test_dynamic_thread_stack_alloc)
 Exercise the heap-based thread stack allocator.
 
 K_SEM_DEFINE (perm_sem, 0, 1)
 
static void set_fault (unsigned int reason)
 
void k_sys_fatal_error_handler (unsigned int reason, const struct arch_esf *pEsf)
 Fatal error policy handler.
 
static void perm_func (void *arg1, void *arg2, void *arg3)
 
static void perm_func_violator (void *arg1, void *arg2, void *arg3)
 
 ZTEST (dynamic_thread_stack, test_dynamic_thread_stack_permission)
 Exercise stack permissions.
 
static void * dynamic_thread_stack_setup (void)
 
 ZTEST_SUITE (dynamic_thread_stack, NULL, dynamic_thread_stack_setup, NULL, NULL, NULL)
 

Variables

ZTEST_DMEM bool tflag [MAX(CONFIG_DYNAMIC_THREAD_POOL_SIZE,(28672/K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)))]
 
static ZTEST_BMEM volatile bool expect_fault
 
static ZTEST_BMEM volatile unsigned int expected_reason
 

Macro Definition Documentation

◆ MAX_HEAP_STACKS

#define MAX_HEAP_STACKS   (POOL_SIZE / STACK_OBJ_SIZE)

◆ POOL_SIZE

#define POOL_SIZE   28672

◆ STACK_OBJ_SIZE

#define STACK_OBJ_SIZE   K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)

◆ TIMEOUT_MS

#define TIMEOUT_MS   500

Function Documentation

◆ dynamic_thread_stack_setup()

static void * dynamic_thread_stack_setup ( void  )
static

◆ func()

static void func ( void *  arg1,
void *  arg2,
void *  arg3 
)
static

◆ K_HEAP_DEFINE()

K_HEAP_DEFINE ( stack_heap  ,
28672   
)

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( perm_sem  ,
,
 
)

◆ perm_func()

static void perm_func ( void *  arg1,
void *  arg2,
void *  arg3 
)
static

◆ perm_func_violator()

static void perm_func_violator ( void *  arg1,
void *  arg2,
void *  arg3 
)
static

◆ set_fault()

static void set_fault ( unsigned int  reason)
static

◆ ZTEST() [1/3]

ZTEST ( dynamic_thread_stack  ,
test_dynamic_thread_stack_alloc   
)

Exercise the heap-based thread stack allocator.

◆ ZTEST() [2/3]

ZTEST ( dynamic_thread_stack  ,
test_dynamic_thread_stack_permission   
)

Exercise stack permissions.

◆ ZTEST() [3/3]

ZTEST ( dynamic_thread_stack  ,
test_dynamic_thread_stack_pool   
)

Exercise the pool-based thread stack allocator.

◆ ZTEST_SUITE()

ZTEST_SUITE ( dynamic_thread_stack  ,
NULL  ,
dynamic_thread_stack_setup  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_USER()

ZTEST_USER ( dynamic_thread_stack  ,
test_dynamic_thread_stack_userspace_dyn_obj   
)

Check we can create a thread from userspace, using dynamic objects.

Variable Documentation

◆ expect_fault

ZTEST_BMEM volatile bool expect_fault
static

◆ expected_reason

ZTEST_BMEM volatile unsigned int expected_reason
static

◆ tflag

ZTEST_DMEM bool tflag[MAX(CONFIG_DYNAMIC_THREAD_POOL_SIZE,(28672/ K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)))]