Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Macros | |
#define | STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE) |
#define | ALLOC_SIZE_1 1024 |
#define | ALLOC_SIZE_2 1536 |
#define | ALLOC_SIZE_3 2049 |
Functions | |
K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACKSIZE)) | |
K_HEAP_DEFINE (k_heap_test, 2048) | |
static void | tIsr_kheap_alloc_nowait (void *data) |
static void | thread_alloc_heap (void *p1, void *p2, void *p3) |
K_HEAP_DEFINE (tiny_heap, 1) | |
void | test_k_heap_min_size (void) |
Test a minimum-size static k_heap. More... | |
void | test_k_heap_alloc (void) |
Test to demonstrate k_heap_alloc() and k_heap_free() API usage. More... | |
void | test_k_heap_alloc_fail (void) |
Test to demonstrate k_heap_alloc() and k_heap_free() API usage. More... | |
void | test_k_heap_free (void) |
Test to demonstrate k_heap_free() API functionality. More... | |
void | test_kheap_alloc_in_isr_nowait (void) |
Validate allocation and free heap memory in isr context. More... | |
void | test_k_heap_alloc_pending (void) |
Validate the k_heap support wait between different threads. More... | |
Variables | |
struct k_thread | tdata |
volatile uint32_t | heap_guard0 |
volatile uint32_t | heap_guard1 |
#define ALLOC_SIZE_1 1024 |
#define ALLOC_SIZE_2 1536 |
#define ALLOC_SIZE_3 2049 |
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE) |
K_HEAP_DEFINE | ( | k_heap_test | , |
2048 | |||
) |
K_HEAP_DEFINE | ( | tiny_heap | , |
1 | |||
) |
K_THREAD_STACK_DEFINE | ( | tstack | , |
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
Test to demonstrate k_heap_alloc() and k_heap_free() API usage.
The test allocates 1024 bytes from 2048 byte heap, and checks if allocation is successful or not
Test to demonstrate k_heap_alloc() and k_heap_free() API usage.
The test allocates 2049 bytes, which is greater than the heap size(2048 bytes), and checks for NULL return from k_heap_alloc
Test to demonstrate k_heap_free() API functionality.
The test validates k_heap_free() API, by using below steps
Test a minimum-size static k_heap.
Create a minimum size (1-byte) static heap, verify that it works to allocate that byte at runtime and that it doesn't overflow its memory bounds.
volatile uint32_t heap_guard0 |
volatile uint32_t heap_guard1 |
struct k_thread tdata |