34#pragma clang diagnostic ignored "-Wc++98-compat"
59#pragma GCC diagnostic push
60#pragma GCC diagnostic ignored "-Wpadded"
62 using main_args_t =
struct
68#pragma GCC diagnostic pop
70 static main_args_t main_args;
74 [[noreturn]]
static void
75 _main_trampoline (
void)
80 int code =
os_main (main_args.argc, main_args.argv);
102#if defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
108static std::aligned_storage<
sizeof(main_thread),
alignof(main_thread)>::type os_main_thread_;
116#if !defined(__APPLE__)
126 port::scheduler::greeting ();
131 thread::stack::default_size ());
132#if defined(OS_HAS_INTERRUPTS_STACK)
134 interrupts::stack ()->size ());
137#if defined(__clang__)
143#if defined(__EXCEPTIONS)
150 scheduler::initialize ();
153 main_args.argc = argc;
154 main_args.argv = argv;
156#if defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
162 new (&os_main_thread_) main_thread
163 {
"main",
reinterpret_cast<thread::func_t> (_main_trampoline),
nullptr};
172 "main",
reinterpret_cast<thread::func_t> (_main_trampoline),
nullptr,
177#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
190#if !defined(__APPLE__)
199#if !defined(OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS)
204#if defined(OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES)
215#if defined(OS_HAS_INTERRUPTS_STACK)
217 "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.
class 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.