[352] | 1 | /* Linker script for mbed RZ_A1H */
|
---|
| 2 | PROVIDE(hardware_init_hook = 0);
|
---|
| 3 | PROVIDE(software_init_hook = 0);
|
---|
| 4 | PROVIDE(software_term_hook = 0);
|
---|
| 5 | PROVIDE(IRQTable = _kernel_inh_table);
|
---|
| 6 | PROVIDE(IRQNestLevel = _kernel_excpt_nest_count);
|
---|
| 7 |
|
---|
| 8 | /* Linker script to configure memory regions. */
|
---|
| 9 | MEMORY
|
---|
| 10 | {
|
---|
| 11 | ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
|
---|
| 12 | BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000
|
---|
| 13 | SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000
|
---|
| 14 | L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
|
---|
| 15 | RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x008E0000
|
---|
| 16 | RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | /* Linker script to place sections and symbol values. Should be used together
|
---|
| 20 | * with other linker script that defines memory regions FLASH and RAM.
|
---|
| 21 | * It references following symbols, which must be defined in code:
|
---|
| 22 | * Reset_Handler : Entry of reset handler
|
---|
| 23 | *
|
---|
| 24 | * It defines following symbols, which code can use without definition:
|
---|
| 25 | * __exidx_start
|
---|
| 26 | * __exidx_end
|
---|
| 27 | * __etext
|
---|
| 28 | * __data_start__
|
---|
| 29 | * __preinit_array_start
|
---|
| 30 | * __preinit_array_end
|
---|
| 31 | * __init_array_start
|
---|
| 32 | * __init_array_end
|
---|
| 33 | * __fini_array_start
|
---|
| 34 | * __fini_array_end
|
---|
| 35 | * __data_end__
|
---|
| 36 | * __bss_start__
|
---|
| 37 | * __bss_end__
|
---|
| 38 | * __end__
|
---|
| 39 | * end
|
---|
| 40 | * __HeapLimit
|
---|
| 41 | * __StackLimit
|
---|
| 42 | * __StackTop
|
---|
| 43 | * __stack
|
---|
| 44 | */
|
---|
| 45 | ENTRY(Reset_Handler)
|
---|
| 46 |
|
---|
| 47 | SECTIONS
|
---|
| 48 | {
|
---|
| 49 | .boot :
|
---|
| 50 | {
|
---|
| 51 | KEEP(*(.boot_loader))
|
---|
| 52 | } > BOOT_LOADER
|
---|
| 53 |
|
---|
| 54 | .text :
|
---|
| 55 | {
|
---|
| 56 |
|
---|
| 57 | Image$$VECTORS$$Base = .;
|
---|
| 58 | * (RESET)
|
---|
| 59 | . += 0x00000400;
|
---|
| 60 |
|
---|
| 61 | KEEP(*(.isr_vector))
|
---|
| 62 | *(SVC_TABLE)
|
---|
| 63 | *(.text*)
|
---|
| 64 |
|
---|
| 65 | KEEP(*(.init))
|
---|
| 66 | KEEP(*(.fini))
|
---|
| 67 |
|
---|
| 68 | /* .ctors */
|
---|
| 69 | *crtbegin.o(.ctors)
|
---|
| 70 | *crtbegin?.o(.ctors)
|
---|
| 71 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
---|
| 72 | *(SORT(.ctors.*))
|
---|
| 73 | *(.ctors)
|
---|
| 74 |
|
---|
| 75 | /* .dtors */
|
---|
| 76 | *crtbegin.o(.dtors)
|
---|
| 77 | *crtbegin?.o(.dtors)
|
---|
| 78 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
---|
| 79 | *(SORT(.dtors.*))
|
---|
| 80 | *(.dtors)
|
---|
| 81 | Image$$VECTORS$$Limit = .;
|
---|
| 82 |
|
---|
| 83 | Image$$RO_DATA$$Base = .;
|
---|
| 84 | *(.rodata*)
|
---|
| 85 | Image$$RO_DATA$$Limit = .;
|
---|
| 86 |
|
---|
| 87 | KEEP(*(.eh_frame*))
|
---|
| 88 | } > SFLASH
|
---|
| 89 |
|
---|
| 90 | .ARM.extab :
|
---|
| 91 | {
|
---|
| 92 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
---|
| 93 | } > SFLASH
|
---|
| 94 |
|
---|
| 95 | __exidx_start = .;
|
---|
| 96 | .ARM.exidx :
|
---|
| 97 | {
|
---|
| 98 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
---|
| 99 | } > SFLASH
|
---|
| 100 | __exidx_end = .;
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | .copy.table :
|
---|
| 104 | {
|
---|
| 105 | . = ALIGN(4);
|
---|
| 106 | __copy_table_start__ = .;
|
---|
| 107 | LONG (__etext)
|
---|
| 108 | LONG (__data_start__)
|
---|
| 109 | LONG (__data_end__ - __data_start__)
|
---|
| 110 | LONG (__etext2)
|
---|
| 111 | LONG (__nc_data_start)
|
---|
| 112 | LONG (__nc_data_end - __nc_data_start)
|
---|
| 113 | __copy_table_end__ = .;
|
---|
| 114 | } > SFLASH
|
---|
| 115 |
|
---|
| 116 | .zero.table :
|
---|
| 117 | {
|
---|
| 118 | . = ALIGN(4);
|
---|
| 119 | __zero_table_start__ = .;
|
---|
| 120 | LONG (__bss_start__)
|
---|
| 121 | LONG (__bss_end__ - __bss_start__)
|
---|
| 122 | LONG (__nc_bss_start)
|
---|
| 123 | LONG (__nc_bss_end - __nc_bss_start)
|
---|
| 124 | __zero_table_end__ = .;
|
---|
| 125 | } > SFLASH
|
---|
| 126 |
|
---|
| 127 | __etext = .;
|
---|
| 128 |
|
---|
| 129 | .ttb :
|
---|
| 130 | {
|
---|
| 131 | Image$$TTB$$ZI$$Base = .;
|
---|
| 132 | . += 0x00004000;
|
---|
| 133 | Image$$TTB$$ZI$$Limit = .;
|
---|
| 134 | } > L_TTB
|
---|
| 135 |
|
---|
| 136 | .data : AT (__etext)
|
---|
| 137 | {
|
---|
| 138 | Image$$RW_DATA$$Base = .;
|
---|
| 139 | __data_start__ = .;
|
---|
| 140 | *(vtable)
|
---|
| 141 | *(.data*)
|
---|
| 142 | Image$$RW_DATA$$Limit = .;
|
---|
| 143 |
|
---|
| 144 | . = ALIGN(4);
|
---|
| 145 | /* preinit data */
|
---|
| 146 | PROVIDE (__preinit_array_start = .);
|
---|
| 147 | KEEP(*(.preinit_array))
|
---|
| 148 | PROVIDE (__preinit_array_end = .);
|
---|
| 149 |
|
---|
| 150 | . = ALIGN(4);
|
---|
| 151 | /* init data */
|
---|
| 152 | PROVIDE (__init_array_start = .);
|
---|
| 153 | KEEP(*(SORT(.init_array.*)))
|
---|
| 154 | KEEP(*(.init_array))
|
---|
| 155 | PROVIDE (__init_array_end = .);
|
---|
| 156 |
|
---|
| 157 | . = ALIGN(4);
|
---|
| 158 | /* finit data */
|
---|
| 159 | PROVIDE (__fini_array_start = .);
|
---|
| 160 | KEEP(*(SORT(.fini_array.*)))
|
---|
| 161 | KEEP(*(.fini_array))
|
---|
| 162 | PROVIDE (__fini_array_end = .);
|
---|
| 163 |
|
---|
| 164 | . = ALIGN(4);
|
---|
| 165 | /* All data end */
|
---|
| 166 | __data_end__ = .;
|
---|
| 167 |
|
---|
| 168 | } > RAM
|
---|
| 169 |
|
---|
| 170 | .bss ALIGN(0x10):
|
---|
| 171 | {
|
---|
| 172 | Image$$RW_IRAM1$$Base = .;
|
---|
| 173 | __bss_start__ = .;
|
---|
| 174 | *(.bss*)
|
---|
| 175 | *(COMMON)
|
---|
| 176 | __bss_end__ = .;
|
---|
| 177 | Image$$RW_IRAM1$$Limit = .;
|
---|
| 178 | } > RAM
|
---|
| 179 |
|
---|
| 180 | .heap :
|
---|
| 181 | {
|
---|
| 182 | __end__ = .;
|
---|
| 183 | end = __end__;
|
---|
| 184 | *(.heap*)
|
---|
| 185 | } > RAM
|
---|
| 186 |
|
---|
| 187 | /* .stack_dummy section doesn't contains any symbols. It is only
|
---|
| 188 | * used for linker to calculate size of stack sections, and assign
|
---|
| 189 | * values to stack symbols later */
|
---|
| 190 | .stack_dummy (COPY):
|
---|
| 191 | {
|
---|
| 192 | *(.stack*)
|
---|
| 193 | } > RAM
|
---|
| 194 |
|
---|
| 195 | /* Set stack top to end of RAM, and stack limit move down by
|
---|
| 196 | * size of stack_dummy section */
|
---|
| 197 | __StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
---|
| 198 | _estack = __StackTop;
|
---|
| 199 | __StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
---|
| 200 | __HeapLimit = __StackLimit;
|
---|
| 201 | PROVIDE(__stack = __StackTop);
|
---|
| 202 |
|
---|
| 203 | /* Check if data + heap + stack exceeds RAM limit */
|
---|
| 204 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
---|
| 205 |
|
---|
| 206 | __etext2 = __etext + SIZEOF(.data);
|
---|
| 207 | .nc_data : AT (__etext2)
|
---|
| 208 | {
|
---|
| 209 | Image$$RW_DATA_NC$$Base = .;
|
---|
| 210 | __nc_data_start = .;
|
---|
| 211 | *(NC_DATA)
|
---|
| 212 |
|
---|
| 213 | . = ALIGN(4);
|
---|
| 214 | __nc_data_end = .;
|
---|
| 215 | Image$$RW_DATA_NC$$Limit = .;
|
---|
| 216 | } > RAM_NC
|
---|
| 217 |
|
---|
| 218 | .nc_bss (NOLOAD) :
|
---|
| 219 | {
|
---|
| 220 | Image$$ZI_DATA_NC$$Base = .;
|
---|
| 221 | __nc_bss_start = .;
|
---|
| 222 | *(NC_BSS)
|
---|
| 223 |
|
---|
| 224 | . = ALIGN(4);
|
---|
| 225 | __nc_bss_end = .;
|
---|
| 226 | Image$$ZI_DATA_NC$$Limit = .;
|
---|
| 227 | } > RAM_NC
|
---|
| 228 | }
|
---|