From 09e89c867c8dc14adee298176a0a4c72d8f32245 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Tue, 7 Aug 2012 16:54:36 +0200 Subject: Split out reusable parts into the laks project. --- entry.cpp | 63 --------------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 entry.cpp (limited to 'entry.cpp') diff --git a/entry.cpp b/entry.cpp deleted file mode 100644 index ae58404..0000000 --- a/entry.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -int main(); - -typedef void (*funcp_t)(); - -// Symbols from linker script. -extern uint32_t _data_rom; -extern uint32_t _data_start; -extern uint32_t _data_end; -extern uint32_t _bss_start; -extern uint32_t _bss_end; -extern funcp_t _init_array_start; -extern funcp_t _init_array_end; -extern funcp_t _fini_array_start; -extern funcp_t _fini_array_end; - -void __attribute__((naked)) entry() { - // Initialize HAL. - hal_init(); - - // Load .data from rom image. - uint32_t* rp = &_data_rom; - uint32_t* wp = &_data_start; - - while(wp < &_data_end) { - *wp++ = *rp++; - } - - // Clear .bss. - wp = &_bss_start; - - while(wp < &_bss_end) { - *wp++ = 0; - } - - // Call constructors. - funcp_t* fp = &_init_array_start; - - while(fp < &_init_array_end) { - (*fp++)(); - } - - // Call main(). - main(); - - // Call destructors. - fp = &_fini_array_start; - - while(fp < &_fini_array_end) { - (*fp++)(); - } - - // Halt. - while(1); -} - -extern "C" void __cxa_pure_virtual() { - while (1); -} - -void* __dso_handle = 0; -- cgit v1.2.3