13#if defined(OS_USE_OS_APP_CONFIG_H)
14#include <cmsis-plus/os-app-config.h>
23#pragma clang diagnostic ignored "-Wc++98-compat"
48#pragma GCC diagnostic push
50#pragma clang diagnostic ignored "-Wpadded"
51#elif defined(__GNUC__)
52#pragma GCC diagnostic ignored "-Wpadded"
55 using main_args_t =
struct
61#pragma GCC diagnostic pop
63 static main_args_t main_args;
67 [[noreturn]]
static void
68 _main_trampoline (
void)
73 int code =
os_main (main_args.argc, main_args.argv);
95#if defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
101static std::aligned_storage<
sizeof(main_thread),
alignof(main_thread)>::type os_main_thread_;
109#if !defined(__APPLE__)
119 port::scheduler::greeting ();
124 thread::stack::default_size ());
125#if defined(OS_HAS_INTERRUPTS_STACK)
127 interrupts::stack ()->size ());
130#if defined(__clang__)
136#if defined(__EXCEPTIONS)
143 scheduler::initialize ();
146 main_args.argc = argc;
147 main_args.argv = argv;
149#if defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
155 new (&os_main_thread_) main_thread
156 {
"main",
reinterpret_cast<thread::func_t> (_main_trampoline),
nullptr};
165 "main",
reinterpret_cast<thread::func_t> (_main_trampoline),
nullptr,
170#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
183#if !defined(__APPLE__)
192#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
197#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
208#if defined(OS_HAS_INTERRUPTS_STACK)
210 "Interrupts stack: %u/%u bytes used\n",
static constexpr uint32_t frequency_hz
SysTick frequency in Hz.
void trace_print_statistics(void)
Print a long message with usage statistics.
std::size_t th_stack_size_bytes
Size of the user defined storage for the thread stack, in bytes.
std::size_t size(void)
Get the stack size.
std::size_t available(void)
Compute how much available stack remains.
Template of a POSIX compliant thread with local stack.
POSIX compliant thread, using the default RTOS allocator.
void *(*)(func_args_t args) func_t
Type of thread function.
thread::stack & stack(void)
Get the thread context stack.
#define OS_INTEGER_RTOS_MAIN_STACK_SIZE_BYTES
Define the main thread stack size, in bytes.
void os_startup_create_thread_idle(void)
Create the idle thread.
void os_terminate_goodbye(void)
Display statistics and say goodbye before terminating.
int puts(const char *s)
Write the string and a line terminator to the trace device.
int printf(const char *format,...)
Write a formatted string to the trace device.
void dump_args(int argc, char *argv[])
Write the argv[] array to the trace device.
int os_main(int argc, char *argv[])
Application entry point, running on the main thread context.
class thread::stack * stack(void)
Get the interrupts stack.
memory_resource * get_default_resource(void) noexcept
Get the default RTOS system memory manager.
memory_resource * get_default_resource(void) noexcept
Get the default application memory manager.
int main(int argc, char *argv[])
Default implementation of main().
rtos::thread * os_main_thread
#define OS_STRING_RTOS_IMPL_YEAR
#define OS_STRING_RTOS_IMPL_VERSION
Single file µOS++ RTOS definitions.