[270] | 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
|
---|
[331] | 15 | RAM (rw) : ORIGIN = 0x20004000, LENGTH = 0x000FC000
|
---|
| 16 | RAM_CMD (rwx) : ORIGIN = 0x20100000, LENGTH = 0x00800000
|
---|
| 17 | RAM_NC (rw) : ORIGIN = 0x20900000, LENGTH = 0x00100000
|
---|
[270] | 18 | }
|
---|
| 19 |
|
---|
| 20 | /* Linker script to place sections and symbol values. Should be used together
|
---|
| 21 | * with other linker script that defines memory regions FLASH and RAM.
|
---|
| 22 | * It references following symbols, which must be defined in code:
|
---|
| 23 | * Reset_Handler : Entry of reset handler
|
---|
| 24 | *
|
---|
| 25 | * It defines following symbols, which code can use without definition:
|
---|
| 26 | * __exidx_start
|
---|
| 27 | * __exidx_end
|
---|
| 28 | * __etext
|
---|
| 29 | * __data_start__
|
---|
| 30 | * __preinit_array_start
|
---|
| 31 | * __preinit_array_end
|
---|
| 32 | * __init_array_start
|
---|
| 33 | * __init_array_end
|
---|
| 34 | * __fini_array_start
|
---|
| 35 | * __fini_array_end
|
---|
| 36 | * __data_end__
|
---|
| 37 | * __bss_start__
|
---|
| 38 | * __bss_end__
|
---|
| 39 | * __end__
|
---|
| 40 | * end
|
---|
| 41 | * __HeapLimit
|
---|
| 42 | * __StackLimit
|
---|
| 43 | * __StackTop
|
---|
| 44 | * __stack
|
---|
| 45 | */
|
---|
| 46 | ENTRY(Reset_Handler)
|
---|
| 47 |
|
---|
| 48 | SECTIONS
|
---|
| 49 | {
|
---|
| 50 | .boot :
|
---|
| 51 | {
|
---|
| 52 | KEEP(*(.boot_loader))
|
---|
| 53 | } > BOOT_LOADER
|
---|
| 54 |
|
---|
| 55 | .text :
|
---|
| 56 | {
|
---|
| 57 |
|
---|
| 58 | Image$$VECTORS$$Base = .;
|
---|
| 59 | * (RESET)
|
---|
| 60 | Image$$VECTORS$$Limit = .;
|
---|
| 61 | . += 0x00000400;
|
---|
| 62 |
|
---|
| 63 | KEEP(*(.isr_vector))
|
---|
| 64 | *(SVC_TABLE)
|
---|
| 65 | *(.text*)
|
---|
| 66 |
|
---|
| 67 | KEEP(*(.init))
|
---|
| 68 | KEEP(*(.fini))
|
---|
| 69 |
|
---|
| 70 | /* .ctors */
|
---|
| 71 | *crtbegin.o(.ctors)
|
---|
| 72 | *crtbegin?.o(.ctors)
|
---|
| 73 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
---|
| 74 | *(SORT(.ctors.*))
|
---|
| 75 | *(.ctors)
|
---|
| 76 |
|
---|
| 77 | /* .dtors */
|
---|
| 78 | *crtbegin.o(.dtors)
|
---|
| 79 | *crtbegin?.o(.dtors)
|
---|
| 80 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
---|
| 81 | *(SORT(.dtors.*))
|
---|
| 82 | *(.dtors)
|
---|
| 83 |
|
---|
| 84 | Image$$RO_DATA$$Base = .;
|
---|
| 85 | *(.rodata*)
|
---|
| 86 | Image$$RO_DATA$$Limit = .;
|
---|
| 87 |
|
---|
| 88 | KEEP(*(.eh_frame*))
|
---|
| 89 | } > SFLASH
|
---|
| 90 |
|
---|
| 91 | .ARM.extab :
|
---|
| 92 | {
|
---|
| 93 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
---|
| 94 | } > SFLASH
|
---|
| 95 |
|
---|
| 96 | __exidx_start = .;
|
---|
| 97 | .ARM.exidx :
|
---|
| 98 | {
|
---|
| 99 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
---|
| 100 | } > SFLASH
|
---|
| 101 | __exidx_end = .;
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | .copy.table :
|
---|
| 105 | {
|
---|
| 106 | . = ALIGN(4);
|
---|
| 107 | __copy_table_start__ = .;
|
---|
| 108 | LONG (__etext)
|
---|
| 109 | LONG (__data_start__)
|
---|
| 110 | LONG (__data_end__ - __data_start__)
|
---|
| 111 | LONG (__etext2)
|
---|
| 112 | LONG (__nc_data_start)
|
---|
| 113 | LONG (__nc_data_end - __nc_data_start)
|
---|
| 114 | __copy_table_end__ = .;
|
---|
| 115 | } > SFLASH
|
---|
| 116 |
|
---|
| 117 | .zero.table :
|
---|
| 118 | {
|
---|
| 119 | . = ALIGN(4);
|
---|
| 120 | __zero_table_start__ = .;
|
---|
| 121 | LONG (__bss_start__)
|
---|
| 122 | LONG (__bss_end__ - __bss_start__)
|
---|
| 123 | LONG (__nc_bss_start)
|
---|
| 124 | LONG (__nc_bss_end - __nc_bss_start)
|
---|
| 125 | __zero_table_end__ = .;
|
---|
| 126 | } > SFLASH
|
---|
| 127 |
|
---|
| 128 | __etext = .;
|
---|
| 129 |
|
---|
| 130 | .ttb :
|
---|
| 131 | {
|
---|
| 132 | Image$$TTB$$ZI$$Base = .;
|
---|
| 133 | . += 0x00004000;
|
---|
| 134 | Image$$TTB$$ZI$$Limit = .;
|
---|
| 135 | } > L_TTB
|
---|
| 136 |
|
---|
| 137 | .data : AT (__etext)
|
---|
| 138 | {
|
---|
| 139 | Image$$RW_DATA$$Base = .;
|
---|
| 140 | __data_start__ = .;
|
---|
| 141 | *(vtable)
|
---|
| 142 | *(.data*)
|
---|
| 143 | Image$$RW_DATA$$Limit = .;
|
---|
| 144 |
|
---|
| 145 | . = ALIGN(4);
|
---|
| 146 | /* preinit data */
|
---|
| 147 | PROVIDE (__preinit_array_start = .);
|
---|
| 148 | KEEP(*(.preinit_array))
|
---|
| 149 | PROVIDE (__preinit_array_end = .);
|
---|
| 150 |
|
---|
| 151 | . = ALIGN(4);
|
---|
| 152 | /* init data */
|
---|
| 153 | PROVIDE (__init_array_start = .);
|
---|
| 154 | KEEP(*(SORT(.init_array.*)))
|
---|
| 155 | KEEP(*(.init_array))
|
---|
| 156 | PROVIDE (__init_array_end = .);
|
---|
| 157 |
|
---|
| 158 | . = ALIGN(4);
|
---|
| 159 | /* finit data */
|
---|
| 160 | PROVIDE (__fini_array_start = .);
|
---|
| 161 | KEEP(*(SORT(.fini_array.*)))
|
---|
| 162 | KEEP(*(.fini_array))
|
---|
| 163 | PROVIDE (__fini_array_end = .);
|
---|
| 164 |
|
---|
| 165 | . = ALIGN(4);
|
---|
| 166 | /* All data end */
|
---|
| 167 | __data_end__ = .;
|
---|
| 168 |
|
---|
| 169 | } > RAM
|
---|
| 170 |
|
---|
| 171 | .bss ALIGN(0x400):
|
---|
| 172 | {
|
---|
| 173 | Image$$ZI_DATA$$Base = .;
|
---|
| 174 | __bss_start__ = .;
|
---|
| 175 | *(.bss*)
|
---|
| 176 | *(COMMON)
|
---|
| 177 | __bss_end__ = .;
|
---|
| 178 | Image$$ZI_DATA$$Limit = .;
|
---|
| 179 | } > RAM
|
---|
| 180 |
|
---|
[331] | 181 | /* .stack_dummy section doesn't contains any symbols. It is only
|
---|
| 182 | * used for linker to calculate size of stack sections, and assign
|
---|
| 183 | * values to stack symbols later */
|
---|
| 184 | .stack_dummy :
|
---|
| 185 | {
|
---|
| 186 | *(.stack)
|
---|
| 187 | } > RAM
|
---|
| 188 |
|
---|
[270] | 189 | .heap :
|
---|
| 190 | {
|
---|
| 191 | __end__ = .;
|
---|
| 192 | end = __end__;
|
---|
| 193 | *(.heap*)
|
---|
| 194 | __HeapLimit = .;
|
---|
| 195 | } > RAM
|
---|
| 196 |
|
---|
[331] | 197 | .cmd_area :
|
---|
[270] | 198 | {
|
---|
[331] | 199 | __CmdBase = .;
|
---|
| 200 | Image$$CMD_AREA$$Base = .;
|
---|
| 201 | . = . + LENGTH(RAM_CMD);
|
---|
| 202 | __CmdLimit = .;
|
---|
| 203 | Image$$CMD_AREA$$Limit = .;
|
---|
| 204 | } > RAM_CMD
|
---|
[270] | 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 |
|
---|
| 229 | /* Set stack top to end of RAM, and stack limit move down by
|
---|
| 230 | * size of stack_dummy section */
|
---|
| 231 | __StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
---|
| 232 | __StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
---|
| 233 | PROVIDE(__stack = __StackTop);
|
---|
| 234 |
|
---|
| 235 | /* Check if data + heap + stack exceeds RAM limit */
|
---|
| 236 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
---|
| 237 |
|
---|
| 238 |
|
---|
| 239 | }
|
---|