Misc changes
[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 extern uintptr_t* _end;
8
9 #define logf(fmt, ...) printf("[BRINGUP:%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);
10
11 static void cxx_init() {
12 unsigned ctor_count = (unsigned)(&__init_array_end - &__init_array_start);
13 void (*static_ctor)();
14
15 logf("calling %d static constructors (0x%X - 0x%X) ...\n", ctor_count, &__init_array_start, &__init_array_end);
16
17 for (unsigned i = 0; i < ctor_count; i++) {
18 uintptr_t* ptr = (((uintptr_t*)&__init_array_start) + i);
19 static_ctor = (void*)*ptr;
20 static_ctor();
21 }
22 }
23
24 static void heap_init() {
25 void* start_of_heap = (void*)&_end;
26 size_t hs = 0x100000;
27
28 logf("Initializing heap at 0x%x with size 0x%x\n", start_of_heap, hs);
29
30 init_memory_pool(hs, start_of_heap);
31 }
32
33 void main() {
34 logf("Started on ARM, continuing boot from here ...\n", __FUNCTION__);
35
36 heap_init();
37
38 /* c++ runtime */
39 //cxx_init();
40
41 /* poke the VPU */
42 printf("Poking the VPU..\n");
43 while( (mmio_read32(0x2000B898) & 0x80000000) != 0);
44 mmio_write32(0x2000B8A0, 0xA1755A01);
45
46 panic("Nothing else to do!");
47
48 #if 0
49 printf("Done ");
50 for(;;) {
51 printf(".");
52 udelay(1000000);
53 }
54 #endif
55 }
This page took 0.069237 seconds and 4 git commands to generate.