[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);
|
---|
[374] | 6 | PROVIDE(IRQ_NestLevel = _kernel_excpt_nest_count);
|
---|
[352] | 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 |
|
---|
| 60 | KEEP(*(.isr_vector))
|
---|
| 61 | *(SVC_TABLE)
|
---|
| 62 | *(.text*)
|
---|
| 63 |
|
---|
| 64 | KEEP(*(.init))
|
---|
| 65 | KEEP(*(.fini))
|
---|
| 66 |
|
---|
| 67 | /* .ctors */
|
---|
| 68 | *crtbegin.o(.ctors)
|
---|
| 69 | *crtbegin?.o(.ctors)
|
---|
| 70 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
---|
| 71 | *(SORT(.ctors.*))
|
---|
| 72 | *(.ctors)
|
---|
| 73 |
|
---|
| 74 | /* .dtors */
|
---|
| 75 | *crtbegin.o(.dtors)
|
---|
| 76 | *crtbegin?.o(.dtors)
|
---|
| 77 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
---|
| 78 | *(SORT(.dtors.*))
|
---|
| 79 | *(.dtors)
|
---|
| 80 | Image$$VECTORS$$Limit = .;
|
---|
| 81 |
|
---|
| 82 | Image$$RO_DATA$$Base = .;
|
---|
| 83 | *(.rodata*)
|
---|
| 84 | Image$$RO_DATA$$Limit = .;
|
---|
| 85 |
|
---|
| 86 | KEEP(*(.eh_frame*))
|
---|
| 87 | } > SFLASH
|
---|
| 88 |
|
---|
| 89 | .ARM.extab :
|
---|
| 90 | {
|
---|
| 91 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
---|
| 92 | } > SFLASH
|
---|
| 93 |
|
---|
| 94 | __exidx_start = .;
|
---|
| 95 | .ARM.exidx :
|
---|
| 96 | {
|
---|
| 97 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
---|
| 98 | } > SFLASH
|
---|
| 99 | __exidx_end = .;
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | .copy.table :
|
---|
| 103 | {
|
---|
| 104 | . = ALIGN(4);
|
---|
| 105 | __copy_table_start__ = .;
|
---|
| 106 | LONG (__etext)
|
---|
| 107 | LONG (__data_start__)
|
---|
| 108 | LONG (__data_end__ - __data_start__)
|
---|
| 109 | LONG (__etext2)
|
---|
| 110 | LONG (__nc_data_start)
|
---|
| 111 | LONG (__nc_data_end - __nc_data_start)
|
---|
[374] | 112 | LONG (LOADADDR(.ram_code))
|
---|
| 113 | LONG (ADDR(.ram_code))
|
---|
| 114 | LONG (SIZEOF(.ram_code))
|
---|
[352] | 115 | __copy_table_end__ = .;
|
---|
| 116 | } > SFLASH
|
---|
| 117 |
|
---|
| 118 | .zero.table :
|
---|
| 119 | {
|
---|
| 120 | . = ALIGN(4);
|
---|
| 121 | __zero_table_start__ = .;
|
---|
| 122 | LONG (__bss_start__)
|
---|
| 123 | LONG (__bss_end__ - __bss_start__)
|
---|
| 124 | LONG (__nc_bss_start)
|
---|
| 125 | LONG (__nc_bss_end - __nc_bss_start)
|
---|
| 126 | __zero_table_end__ = .;
|
---|
| 127 | } > SFLASH
|
---|
| 128 |
|
---|
[374] | 129 | .ram_code : ALIGN( 0x4 ) {
|
---|
| 130 | __ram_code_load = .;
|
---|
| 131 | __ram_code_start = LOADADDR(.ram_code) + ( __ram_code_load - ADDR(.ram_code) );
|
---|
| 132 |
|
---|
| 133 | *(RAM_CODE)
|
---|
| 134 |
|
---|
| 135 | *(RAM_CONST)
|
---|
| 136 |
|
---|
| 137 | . = ALIGN( 0x4 );
|
---|
| 138 | __ram_code_end = LOADADDR(.ram_code) + ( . - ADDR(.ram_code) );
|
---|
| 139 | } > RAM AT > SFLASH
|
---|
| 140 |
|
---|
| 141 | Load$$SEC_RAM_CODE$$Base = LOADADDR(.ram_code);
|
---|
| 142 | Image$$SEC_RAM_CODE$$Base = ADDR(.ram_code);
|
---|
| 143 | Load$$SEC_RAM_CODE$$Length = SIZEOF(.ram_code);
|
---|
| 144 |
|
---|
[352] | 145 | .ttb :
|
---|
| 146 | {
|
---|
| 147 | Image$$TTB$$ZI$$Base = .;
|
---|
| 148 | . += 0x00004000;
|
---|
| 149 | Image$$TTB$$ZI$$Limit = .;
|
---|
| 150 | } > L_TTB
|
---|
| 151 |
|
---|
[374] | 152 | __etext = Load$$SEC_RAM_CODE$$Base + SIZEOF(.ram_code);
|
---|
| 153 |
|
---|
[352] | 154 | .data : AT (__etext)
|
---|
| 155 | {
|
---|
| 156 | Image$$RW_DATA$$Base = .;
|
---|
| 157 | __data_start__ = .;
|
---|
| 158 | *(vtable)
|
---|
| 159 | *(.data*)
|
---|
| 160 | Image$$RW_DATA$$Limit = .;
|
---|
| 161 |
|
---|
| 162 | . = ALIGN(4);
|
---|
| 163 | /* preinit data */
|
---|
| 164 | PROVIDE (__preinit_array_start = .);
|
---|
| 165 | KEEP(*(.preinit_array))
|
---|
| 166 | PROVIDE (__preinit_array_end = .);
|
---|
| 167 |
|
---|
| 168 | . = ALIGN(4);
|
---|
| 169 | /* init data */
|
---|
| 170 | PROVIDE (__init_array_start = .);
|
---|
| 171 | KEEP(*(SORT(.init_array.*)))
|
---|
| 172 | KEEP(*(.init_array))
|
---|
| 173 | PROVIDE (__init_array_end = .);
|
---|
| 174 |
|
---|
[374] | 175 |
|
---|
[352] | 176 | . = ALIGN(4);
|
---|
| 177 | /* finit data */
|
---|
| 178 | PROVIDE (__fini_array_start = .);
|
---|
| 179 | KEEP(*(SORT(.fini_array.*)))
|
---|
| 180 | KEEP(*(.fini_array))
|
---|
| 181 | PROVIDE (__fini_array_end = .);
|
---|
| 182 |
|
---|
| 183 | . = ALIGN(4);
|
---|
| 184 | /* All data end */
|
---|
| 185 | __data_end__ = .;
|
---|
| 186 |
|
---|
| 187 | } > RAM
|
---|
| 188 |
|
---|
| 189 | .bss ALIGN(0x10):
|
---|
| 190 | {
|
---|
| 191 | Image$$RW_IRAM1$$Base = .;
|
---|
| 192 | __bss_start__ = .;
|
---|
| 193 | *(.bss*)
|
---|
| 194 | *(COMMON)
|
---|
| 195 | __bss_end__ = .;
|
---|
| 196 | Image$$RW_IRAM1$$Limit = .;
|
---|
| 197 | } > RAM
|
---|
| 198 |
|
---|
| 199 | .heap :
|
---|
| 200 | {
|
---|
| 201 | __end__ = .;
|
---|
| 202 | end = __end__;
|
---|
| 203 | *(.heap*)
|
---|
| 204 | } > RAM
|
---|
| 205 |
|
---|
| 206 | /* .stack_dummy section doesn't contains any symbols. It is only
|
---|
| 207 | * used for linker to calculate size of stack sections, and assign
|
---|
| 208 | * values to stack symbols later */
|
---|
| 209 | .stack_dummy (COPY):
|
---|
| 210 | {
|
---|
| 211 | *(.stack*)
|
---|
| 212 | } > RAM
|
---|
| 213 |
|
---|
| 214 | /* Set stack top to end of RAM, and stack limit move down by
|
---|
| 215 | * size of stack_dummy section */
|
---|
| 216 | __StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
---|
| 217 | _estack = __StackTop;
|
---|
| 218 | __StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
---|
| 219 | __HeapLimit = __StackLimit;
|
---|
| 220 | PROVIDE(__stack = __StackTop);
|
---|
| 221 |
|
---|
| 222 | /* Check if data + heap + stack exceeds RAM limit */
|
---|
| 223 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
---|
| 224 |
|
---|
| 225 | __etext2 = __etext + SIZEOF(.data);
|
---|
| 226 | .nc_data : AT (__etext2)
|
---|
| 227 | {
|
---|
| 228 | Image$$RW_DATA_NC$$Base = .;
|
---|
| 229 | __nc_data_start = .;
|
---|
| 230 | *(NC_DATA)
|
---|
| 231 |
|
---|
| 232 | . = ALIGN(4);
|
---|
| 233 | __nc_data_end = .;
|
---|
| 234 | Image$$RW_DATA_NC$$Limit = .;
|
---|
| 235 | } > RAM_NC
|
---|
| 236 |
|
---|
| 237 | .nc_bss (NOLOAD) :
|
---|
| 238 | {
|
---|
| 239 | Image$$ZI_DATA_NC$$Base = .;
|
---|
| 240 | __nc_bss_start = .;
|
---|
| 241 | *(NC_BSS)
|
---|
| 242 |
|
---|
| 243 | . = ALIGN(4);
|
---|
| 244 | __nc_bss_end = .;
|
---|
| 245 | Image$$ZI_DATA_NC$$Limit = .;
|
---|
| 246 | } > RAM_NC
|
---|
| 247 | }
|
---|