File size: 1,198 Bytes
829b19c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* ARM Boot Linker Script - Stage 1 Bootloader */

INCLUDE memory.ld
INCLUDE sections.ld

/* Boot-specific settings */

OUTPUT_FORMAT(elf32-littlearm)
TARGET(elf32-littlearm)

ENTRY(_start)

/* Force sections to load at specific addresses */
SECTIONS
{
  /* Ensure boot code starts at SRAM origin */
  . = 0x00000000;

  .reset_vectors : ALIGN(4) {
    KEEP(*(.vectors))
    KEEP(*(.vector_table))
    . = ALIGN(32);
  }

  /* Stage 1 bootloader must be compact */
  .stage1 : {
    KEEP(*(.stage1_start))
    *(.text.stage1)
    *(.rodata.stage1)
    . = ALIGN(4);
  }

  /* Everything else follows */
  .text : {
    *(.text)
    *(.text.*)
  }

  .rodata : {
    *(.rodata)
    *(.rodata.*)
  }

  .data : {
    *(.data)
    *(.data.*)
    . = ALIGN(4);
  }

  .bss (NOLOAD) : {
    *(.bss)
    *(.bss.*)
    *(COMMON)
    . = ALIGN(4);
  }

  /* Stack at fixed location for bootloader */
  .stack (NOLOAD) : ALIGN(16) {
    . = 0x20010000;  /* Stack at DRAM boundary */
    . += 0x4000;
  }
}

/* Stage2 handoff location */
__stage2_load_addr = 0x30000000;
__stage2_entry = 0x30000000;

/* Boot configuration */
__reset_vector = 0xFFF00000;
__stack_base = 0x20010000;
__stack_top = 0x20014000;