14#pragma clang diagnostic ignored "-Wempty-translation-unit"
19#if defined(__ARM_EABI__)
23#if defined(OS_USE_OS_APP_CONFIG_H)
24#include <cmsis-plus/os-app-config.h>
39#if defined(OS_TYPE_APPLICATION_MEMORY_RESOURCE)
46#if defined(OS_TYPE_RTOS_MEMORY_RESOURCE)
57#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
81void __attribute__((weak))
83 std::
size_t heap_size_bytes)
85 trace::printf (
"%s(%p,%u)\n", __func__, heap_address, heap_size_bytes);
87#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
91 {
"app", heap_address, heap_size_bytes };
102#pragma GCC diagnostic push
103#pragma GCC diagnostic ignored "-Wuseless-cast"
105 static_cast<char*
> (
static_cast<char*
> (heap_address) + heap_size_bytes)
106 -
static_cast<char*
> (
sbrk (0)));
107#pragma GCC diagnostic pop
109#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
136#if defined(OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE)
140 "Mutex pool size must be >1.");
148 rtos::memory::set_resource_typed<rtos::thread> (mr);
153#if defined(OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE)
157 "Mutex pool size must be >1.");
165 rtos::memory::set_resource_typed<rtos::condition_variable> (mr);
170#if defined(OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE)
174 "Mutex pool size must be >1.");
182 rtos::memory::set_resource_typed<rtos::event_flags> (mr);
187#if defined(OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE)
191 "Mutex pool size must be >1.");
199 rtos::memory::set_resource_typed<rtos::memory_pool> (mr);
204#if defined(OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE)
208 "Mutex pool size must be >1.");
216 rtos::memory::set_resource_typed<rtos::message_queue> (mr);
221#if defined(OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE)
225 "Mutex pool size must be >1.");
233 rtos::memory::set_resource_typed<rtos::mutex> (mr);
238#if defined(OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE)
242 "Semaphore pool size must be >1.");
250 rtos::memory::set_resource_typed<rtos::semaphore> (mr);
255#if defined(OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE)
259 "Mutex pool size must be >1.");
267 rtos::memory::set_resource_typed<rtos::timer> (mr);
290void __attribute__((weak))
296#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
313void __attribute__((weak))
Memory resource managing an internal pool. of same size blocks of type T.
Memory resource implementing the first fit, top-down allocation policies, using an existing arena.
Memory resource implementing the LIFO allocation/deallocation policies, using an existing arena.
POSIX compliant condition variable.
Synchronised event flags.
Memory resource manager (abstract class).
out_of_memory_handler_t out_of_memory_handler(out_of_memory_handler_t handler)
Set the out of memory handler.
Synchronised memory pool, using the default RTOS allocator.
POSIX compliant message queue, using the default RTOS allocator.
POSIX compliant semaphore.
POSIX compliant thread, using the default RTOS allocator.
User single-shot or periodic timer.
#define OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE
Define a pool of thread objects.
#define OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE
Define a pool of event flags objects.
#define OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE
Define a pool of semaphore objects.
#define OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE
Define a pool of condition variable objects.
#define OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE
Define a pool of mutex objects.
#define OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE
Define a pool of memory pool objects.
#define OS_TYPE_APPLICATION_MEMORY_RESOURCE
The type of the memory manager to be used for the application free store.
#define OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE
Define a pool of timer objects.
#define OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE
Define a pool of message queue objects.
#define OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES
Ask for separate RTOS dynamic memory and define its size.
#define OS_TYPE_RTOS_MEMORY_RESOURCE
The type of the memory manager to be used for the RTOS system area.
void os_rtos_application_out_of_memory_hook(void)
Hook to handle out of memory in the application free store.
void os_rtos_system_out_of_memory_hook(void)
Hook to handle out of memory in the RTOS dynamic memory.
int printf(const char *format,...)
Write a formatted string to the trace device.
memory_resource * set_default_resource(memory_resource *res) noexcept
Set the default RTOS system memory manager.
memory_resource * set_default_resource(memory_resource *res) noexcept
Set the default application memory manager.
static std::aligned_storage< sizeof(application_memory_resource), alignof(application_memory_resource)>::type application_free_store
os::memory::first_fit_top application_memory_resource
void os_startup_initialize_free_store(void *heap_address, std::size_t heap_size_bytes)
void * sbrk(ptrdiff_t incr)
void __throw_bad_alloc(void)