29#pragma clang diagnostic ignored "-Wempty-translation-unit"
34#if defined(__ARM_EABI__)
50#if defined(OS_TYPE_APPLICATION_MEMORY_RESOURCE)
57#if defined(OS_TYPE_RTOS_MEMORY_RESOURCE)
68#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
92void __attribute__((weak))
94 std::
size_t heap_size_bytes)
96 trace::printf (
"%s(%p,%u)\n", __func__, heap_address, heap_size_bytes);
98#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
102 {
"app", heap_address, heap_size_bytes };
114 static_cast<char*
> (
static_cast<char*
> (heap_address) + heap_size_bytes)
115 -
static_cast<char*
> (
sbrk (0)));
117#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
144#if defined(OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE)
148 "Mutex pool size must be >1.");
156 rtos::memory::set_resource_typed<rtos::thread> (mr);
161#if defined(OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE)
165 "Mutex pool size must be >1.");
173 rtos::memory::set_resource_typed<rtos::condition_variable> (mr);
178#if defined(OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE)
182 "Mutex pool size must be >1.");
190 rtos::memory::set_resource_typed<rtos::event_flags> (mr);
195#if defined(OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE)
199 "Mutex pool size must be >1.");
207 rtos::memory::set_resource_typed<rtos::memory_pool> (mr);
212#if defined(OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE)
216 "Mutex pool size must be >1.");
224 rtos::memory::set_resource_typed<rtos::message_queue> (mr);
229#if defined(OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE)
233 "Mutex pool size must be >1.");
241 rtos::memory::set_resource_typed<rtos::mutex> (mr);
246#if defined(OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE)
250 "Semaphore pool size must be >1.");
258 rtos::memory::set_resource_typed<rtos::semaphore> (mr);
263#if defined(OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE)
267 "Mutex pool size must be >1.");
275 rtos::memory::set_resource_typed<rtos::timer> (mr);
298void __attribute__((weak))
304#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
321void __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)