Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
crt.c File Reference
#include "crt.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for crt.c:

Go to the source code of this file.

Functions

void __libc_fini_array (void)
 
void CRTStartup (void)
 

Variables

int __bss_start__
 
int __bss_end__
 
void(* __preinit_array_start [])(void)
 

Function Documentation

◆ __libc_fini_array()

void __libc_fini_array ( void  )

Definition at line 30 of file crt.c.

31 {
32  size_t count = __fini_array_end - __fini_array_start;
33  for(size_t i = count - 1; i > 0; i--)
34  {
35  __fini_array_start[i]();
36  }
37 }

◆ CRTStartup()

void CRTStartup ( void  )

Definition at line 39 of file crt.c.

40 {
41  memset(&__bss_start__, 0, (uintptr_t)&__bss_end__ - (uintptr_t)&__bss_start__);
42 
44 
45  // TODO: handle relocs?
46 }
int __bss_end__
void * memset(void *dest, int c, size_t n)
Copies the value c into each of the first n characters of the object pointed to by dest.
void __libc_init_array(void)
int __bss_start__

References __bss_end__, __bss_start__, __libc_init_array(), and memset().

Variable Documentation

◆ __bss_end__

int __bss_end__

Referenced by CRTStartup().

◆ __bss_start__

int __bss_start__

Referenced by CRTStartup().

◆ __preinit_array_start

void(* __preinit_array_start[])(void)