29#pragma clang diagnostic ignored "-Wempty-translation-unit"
34#if defined(__ARM_EABI__)
46#include <cmsis_device.h>
78#if !defined(OS_INCLUDE_STARTUP_GUARD_CHECKS)
79#define OS_BOOL_STARTUP_GUARD_CHECKS (true)
84#if !defined(OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS)
104extern unsigned int __data_regions_array_start;
105extern unsigned int __data_regions_array_end;
106extern unsigned int __bss_regions_array_start;
107extern unsigned int __bss_regions_array_end;
112extern unsigned long int __stack;
115main (
int argc,
char* argv[]);
128 unsigned int* region_end);
143inline __attribute__((always_inline))
146 unsigned int* region_end)
150 unsigned int *p = region_begin;
151 while (p < region_end)
157inline __attribute__((always_inline))
163 unsigned int *p = region_begin;
164 while (p < region_end)
185inline __attribute__((always_inline))
192 for (
int i = 0; i < count; i++)
203 for (
int i = 0; i < count; i++)
216 for (
int i = count; i > 0; i--)
227#if defined(DEBUG) && (OS_BOOL_STARTUP_GUARD_CHECKS)
232#define BSS_GUARD_BAD_VALUE (0xCADEBABA)
234static uint32_t
volatile __attribute__ ((section(
".bss_begin")))
236static uint32_t volatile __attribute__ ((section(".bss_end")))
239#define DATA_GUARD_BAD_VALUE (0xCADEBABA)
240#define DATA_BEGIN_GUARD_VALUE (0x12345678)
241#define DATA_END_GUARD_VALUE (0x98765432)
243static uint32_t
volatile __attribute__ ((section(
".data_begin")))
244__data_begin_guard = DATA_BEGIN_GUARD_VALUE;
246static uint32_t volatile __attribute__ ((section(".data_end")))
247__data_end_guard = DATA_END_GUARD_VALUE;
263__attribute__ ((section(
".after_vectors"),noreturn,weak))
285#if defined(DEBUG) && (OS_BOOL_STARTUP_GUARD_CHECKS)
287 __data_begin_guard = DATA_GUARD_BAD_VALUE;
288 __data_end_guard = DATA_GUARD_BAD_VALUE;
292#if !defined(OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS)
300 for (
unsigned int* p = &__data_regions_array_start;
301 p < &__data_regions_array_end;)
303 unsigned int* from = (
unsigned int *) (*p++);
304 unsigned int* region_begin = (
unsigned int *) (*p++);
305 unsigned int* region_end = (
unsigned int *) (*p++);
312#if defined(DEBUG) && (OS_BOOL_STARTUP_GUARD_CHECKS)
314 if ((__data_begin_guard != DATA_BEGIN_GUARD_VALUE)
315 || (__data_end_guard != DATA_END_GUARD_VALUE))
325#if defined(DEBUG) && (OS_BOOL_STARTUP_GUARD_CHECKS)
327 __bss_begin_guard = BSS_GUARD_BAD_VALUE;
328 __bss_end_guard = BSS_GUARD_BAD_VALUE;
332#if !defined(OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS)
340 for (
unsigned int *p = &__bss_regions_array_start;
341 p < &__bss_regions_array_end;)
343 unsigned int* region_begin = (
unsigned int*) (*p++);
344 unsigned int* region_end = (
unsigned int*) (*p++);
350#if defined(DEBUG) && (OS_BOOL_STARTUP_GUARD_CHECKS)
352 if ((__bss_begin_guard != 0) || (__bss_end_guard != 0))
386#if defined(OS_HAS_INTERRUPTS_STACK)
391 int code =
main (argc, argv);
401#if !defined(OS_USE_SEMIHOSTING_SYSCALLS)
406#pragma GCC diagnostic push
407#pragma GCC diagnostic ignored "-Wunused-parameter"
418void __attribute__((weak))
426 static char name[] =
"";
432 static char* argv[2] =
441#pragma GCC diagnostic pop
void set(stack::element_t *address, std::size_t size_bytes)
Set the stack address and size.
void os_startup_initialize_free_store(void *heap_address, size_t heap_size_bytes)
Initialise free store.
void os_startup_initialize_hardware_early(void)
Initialise hardware early.
void _start(void)
The standard C application entry point.
void os_startup_initialize_args(int *p_argc, char ***p_argv)
Initialise arguments.
void os_startup_initialize_hardware(void)
Initialise hardware.
class thread::stack * stack(void)
Get the interrupts stack.
Single file µOS++ RTOS definitions.
unsigned long int _Heap_Limit
int main(int argc, char *argv[])
Default implementation of main().
static void os_run_init_array(void)
unsigned int __bss_start__
void(* __fini_array_start[])(void)
static void os_initialize_data(unsigned int *from, unsigned int *region_begin, unsigned int *region_end)
void(* __init_array_start[])(void)
void(* __init_array_end[])(void)
void os_run_fini_array(void)
void(* __fini_array_end[])(void)
static void os_initialize_bss(unsigned int *region_begin, unsigned int *region_end)
void(* __preinit_array_start[])(void)
unsigned long int __stack
void(* __preinit_array_end[])(void)
void trace_initialize(void)
int trace_printf(const char *format,...)