fix include paths
[rpi-open-firmware.git] / arm_chainloader / main.c
1 #include <stdint.h>
2 #include <chainloader.h>
3 #include <hardware.h>
4
5 extern uintptr_t* __init_array_start;
6 extern uintptr_t* __init_array_end;
7
8 #define logf(fmt, ...) printf("[startup::%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);
9
10 void cxx_init() {
11 unsigned ctor_count = (unsigned)(&__init_array_end - &__init_array_start);
12 void (*static_ctor)();
13
14 logf("calling %d static constructors (0x%X - 0x%X) ...\n", ctor_count, &__init_array_start, &__init_array_end);
15
16 for (unsigned i = 0; i < ctor_count; i++) {
17 uintptr_t* ptr = (((uintptr_t*)&__init_array_start) + i);
18 static_ctor = (void*)*ptr;
19 static_ctor();
20 }
21 }
22
23 void main() {
24 logf("started on ARM, continuing boot from here ...\n", __FUNCTION__);
25
26 /* c++ runtime */
27 cxx_init();
28
29 printf("Done ");
30 for(;;) {
31 printf(".");
32 udelay(1000000);
33 }
34 }
This page took 0.066027 seconds and 4 git commands to generate.