Mouse code for the MacroRat
mbed-dev/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822_UNIFIED/device/TOOLCHAIN_GCC_ARM/TARGET_MCU_NRF51_16K_S130/NRF51822.ld@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /* Linker script to configure memory regions. */ |
sahilmgandhi | 18:6a4db94011d3 | 2 | |
sahilmgandhi | 18:6a4db94011d3 | 3 | MEMORY |
sahilmgandhi | 18:6a4db94011d3 | 4 | { |
sahilmgandhi | 18:6a4db94011d3 | 5 | FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000 |
sahilmgandhi | 18:6a4db94011d3 | 6 | RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 |
sahilmgandhi | 18:6a4db94011d3 | 7 | } |
sahilmgandhi | 18:6a4db94011d3 | 8 | |
sahilmgandhi | 18:6a4db94011d3 | 9 | OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") |
sahilmgandhi | 18:6a4db94011d3 | 10 | |
sahilmgandhi | 18:6a4db94011d3 | 11 | /* Linker script to place sections and symbol values. Should be used together |
sahilmgandhi | 18:6a4db94011d3 | 12 | * with other linker script that defines memory regions FLASH and RAM. |
sahilmgandhi | 18:6a4db94011d3 | 13 | * It references following symbols, which must be defined in code: |
sahilmgandhi | 18:6a4db94011d3 | 14 | * Reset_Handler : Entry of reset handler |
sahilmgandhi | 18:6a4db94011d3 | 15 | * |
sahilmgandhi | 18:6a4db94011d3 | 16 | * It defines following symbols, which code can use without definition: |
sahilmgandhi | 18:6a4db94011d3 | 17 | * __exidx_start |
sahilmgandhi | 18:6a4db94011d3 | 18 | * __exidx_end |
sahilmgandhi | 18:6a4db94011d3 | 19 | * __etext |
sahilmgandhi | 18:6a4db94011d3 | 20 | * __data_start__ |
sahilmgandhi | 18:6a4db94011d3 | 21 | * __preinit_array_start |
sahilmgandhi | 18:6a4db94011d3 | 22 | * __preinit_array_end |
sahilmgandhi | 18:6a4db94011d3 | 23 | * __init_array_start |
sahilmgandhi | 18:6a4db94011d3 | 24 | * __init_array_end |
sahilmgandhi | 18:6a4db94011d3 | 25 | * __fini_array_start |
sahilmgandhi | 18:6a4db94011d3 | 26 | * __fini_array_end |
sahilmgandhi | 18:6a4db94011d3 | 27 | * __data_end__ |
sahilmgandhi | 18:6a4db94011d3 | 28 | * __bss_start__ |
sahilmgandhi | 18:6a4db94011d3 | 29 | * __bss_end__ |
sahilmgandhi | 18:6a4db94011d3 | 30 | * __end__ |
sahilmgandhi | 18:6a4db94011d3 | 31 | * end |
sahilmgandhi | 18:6a4db94011d3 | 32 | * __HeapLimit |
sahilmgandhi | 18:6a4db94011d3 | 33 | * __StackLimit |
sahilmgandhi | 18:6a4db94011d3 | 34 | * __StackTop |
sahilmgandhi | 18:6a4db94011d3 | 35 | * __stack |
sahilmgandhi | 18:6a4db94011d3 | 36 | */ |
sahilmgandhi | 18:6a4db94011d3 | 37 | ENTRY(Reset_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 38 | |
sahilmgandhi | 18:6a4db94011d3 | 39 | SECTIONS |
sahilmgandhi | 18:6a4db94011d3 | 40 | { |
sahilmgandhi | 18:6a4db94011d3 | 41 | .text : |
sahilmgandhi | 18:6a4db94011d3 | 42 | { |
sahilmgandhi | 18:6a4db94011d3 | 43 | KEEP(*(.Vectors)) |
sahilmgandhi | 18:6a4db94011d3 | 44 | *(.text*) |
sahilmgandhi | 18:6a4db94011d3 | 45 | |
sahilmgandhi | 18:6a4db94011d3 | 46 | KEEP(*(.init)) |
sahilmgandhi | 18:6a4db94011d3 | 47 | KEEP(*(.fini)) |
sahilmgandhi | 18:6a4db94011d3 | 48 | |
sahilmgandhi | 18:6a4db94011d3 | 49 | /* .ctors */ |
sahilmgandhi | 18:6a4db94011d3 | 50 | *crtbegin.o(.ctors) |
sahilmgandhi | 18:6a4db94011d3 | 51 | *crtbegin?.o(.ctors) |
sahilmgandhi | 18:6a4db94011d3 | 52 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
sahilmgandhi | 18:6a4db94011d3 | 53 | *(SORT(.ctors.*)) |
sahilmgandhi | 18:6a4db94011d3 | 54 | *(.ctors) |
sahilmgandhi | 18:6a4db94011d3 | 55 | |
sahilmgandhi | 18:6a4db94011d3 | 56 | /* .dtors */ |
sahilmgandhi | 18:6a4db94011d3 | 57 | *crtbegin.o(.dtors) |
sahilmgandhi | 18:6a4db94011d3 | 58 | *crtbegin?.o(.dtors) |
sahilmgandhi | 18:6a4db94011d3 | 59 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
sahilmgandhi | 18:6a4db94011d3 | 60 | *(SORT(.dtors.*)) |
sahilmgandhi | 18:6a4db94011d3 | 61 | *(.dtors) |
sahilmgandhi | 18:6a4db94011d3 | 62 | |
sahilmgandhi | 18:6a4db94011d3 | 63 | *(.rodata*) |
sahilmgandhi | 18:6a4db94011d3 | 64 | |
sahilmgandhi | 18:6a4db94011d3 | 65 | KEEP(*(.eh_frame*)) |
sahilmgandhi | 18:6a4db94011d3 | 66 | } > FLASH |
sahilmgandhi | 18:6a4db94011d3 | 67 | |
sahilmgandhi | 18:6a4db94011d3 | 68 | |
sahilmgandhi | 18:6a4db94011d3 | 69 | .ARM.extab : |
sahilmgandhi | 18:6a4db94011d3 | 70 | { |
sahilmgandhi | 18:6a4db94011d3 | 71 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
sahilmgandhi | 18:6a4db94011d3 | 72 | } > FLASH |
sahilmgandhi | 18:6a4db94011d3 | 73 | |
sahilmgandhi | 18:6a4db94011d3 | 74 | __exidx_start = .; |
sahilmgandhi | 18:6a4db94011d3 | 75 | .ARM.exidx : |
sahilmgandhi | 18:6a4db94011d3 | 76 | { |
sahilmgandhi | 18:6a4db94011d3 | 77 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
sahilmgandhi | 18:6a4db94011d3 | 78 | } > FLASH |
sahilmgandhi | 18:6a4db94011d3 | 79 | __exidx_end = .; |
sahilmgandhi | 18:6a4db94011d3 | 80 | |
sahilmgandhi | 18:6a4db94011d3 | 81 | __etext = .; |
sahilmgandhi | 18:6a4db94011d3 | 82 | |
sahilmgandhi | 18:6a4db94011d3 | 83 | .data : AT (__etext) |
sahilmgandhi | 18:6a4db94011d3 | 84 | { |
sahilmgandhi | 18:6a4db94011d3 | 85 | __data_start__ = .; |
sahilmgandhi | 18:6a4db94011d3 | 86 | *(vtable) |
sahilmgandhi | 18:6a4db94011d3 | 87 | *(.data*) |
sahilmgandhi | 18:6a4db94011d3 | 88 | |
sahilmgandhi | 18:6a4db94011d3 | 89 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 90 | /* preinit data */ |
sahilmgandhi | 18:6a4db94011d3 | 91 | PROVIDE_HIDDEN (__preinit_array_start = .); |
sahilmgandhi | 18:6a4db94011d3 | 92 | KEEP(*(.preinit_array)) |
sahilmgandhi | 18:6a4db94011d3 | 93 | PROVIDE_HIDDEN (__preinit_array_end = .); |
sahilmgandhi | 18:6a4db94011d3 | 94 | |
sahilmgandhi | 18:6a4db94011d3 | 95 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 96 | /* init data */ |
sahilmgandhi | 18:6a4db94011d3 | 97 | PROVIDE_HIDDEN (__init_array_start = .); |
sahilmgandhi | 18:6a4db94011d3 | 98 | KEEP(*(SORT(.init_array.*))) |
sahilmgandhi | 18:6a4db94011d3 | 99 | KEEP(*(.init_array)) |
sahilmgandhi | 18:6a4db94011d3 | 100 | PROVIDE_HIDDEN (__init_array_end = .); |
sahilmgandhi | 18:6a4db94011d3 | 101 | |
sahilmgandhi | 18:6a4db94011d3 | 102 | |
sahilmgandhi | 18:6a4db94011d3 | 103 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 104 | /* finit data */ |
sahilmgandhi | 18:6a4db94011d3 | 105 | PROVIDE_HIDDEN (__fini_array_start = .); |
sahilmgandhi | 18:6a4db94011d3 | 106 | KEEP(*(SORT(.fini_array.*))) |
sahilmgandhi | 18:6a4db94011d3 | 107 | KEEP(*(.fini_array)) |
sahilmgandhi | 18:6a4db94011d3 | 108 | PROVIDE_HIDDEN (__fini_array_end = .); |
sahilmgandhi | 18:6a4db94011d3 | 109 | |
sahilmgandhi | 18:6a4db94011d3 | 110 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 111 | PROVIDE(__start_fs_data = .); |
sahilmgandhi | 18:6a4db94011d3 | 112 | KEEP(*(.fs_data)) |
sahilmgandhi | 18:6a4db94011d3 | 113 | PROVIDE(__stop_fs_data = .); |
sahilmgandhi | 18:6a4db94011d3 | 114 | |
sahilmgandhi | 18:6a4db94011d3 | 115 | *(.jcr) |
sahilmgandhi | 18:6a4db94011d3 | 116 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 117 | /* All data end */ |
sahilmgandhi | 18:6a4db94011d3 | 118 | __data_end__ = .; |
sahilmgandhi | 18:6a4db94011d3 | 119 | |
sahilmgandhi | 18:6a4db94011d3 | 120 | } > RAM |
sahilmgandhi | 18:6a4db94011d3 | 121 | |
sahilmgandhi | 18:6a4db94011d3 | 122 | .noinit : |
sahilmgandhi | 18:6a4db94011d3 | 123 | { |
sahilmgandhi | 18:6a4db94011d3 | 124 | PROVIDE(__start_noinit = .); |
sahilmgandhi | 18:6a4db94011d3 | 125 | KEEP(*(.noinit)) |
sahilmgandhi | 18:6a4db94011d3 | 126 | PROVIDE(__stop_noinit = .); |
sahilmgandhi | 18:6a4db94011d3 | 127 | } > RAM |
sahilmgandhi | 18:6a4db94011d3 | 128 | |
sahilmgandhi | 18:6a4db94011d3 | 129 | .bss : |
sahilmgandhi | 18:6a4db94011d3 | 130 | { |
sahilmgandhi | 18:6a4db94011d3 | 131 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 132 | __bss_start__ = .; |
sahilmgandhi | 18:6a4db94011d3 | 133 | *(.bss*) |
sahilmgandhi | 18:6a4db94011d3 | 134 | *(COMMON) |
sahilmgandhi | 18:6a4db94011d3 | 135 | . = ALIGN(4); |
sahilmgandhi | 18:6a4db94011d3 | 136 | __bss_end__ = .; |
sahilmgandhi | 18:6a4db94011d3 | 137 | } > RAM |
sahilmgandhi | 18:6a4db94011d3 | 138 | |
sahilmgandhi | 18:6a4db94011d3 | 139 | .heap (NOLOAD): |
sahilmgandhi | 18:6a4db94011d3 | 140 | { |
sahilmgandhi | 18:6a4db94011d3 | 141 | __end__ = .; |
sahilmgandhi | 18:6a4db94011d3 | 142 | end = __end__; |
sahilmgandhi | 18:6a4db94011d3 | 143 | __HeapBase = .; |
sahilmgandhi | 18:6a4db94011d3 | 144 | *(.heap*) |
sahilmgandhi | 18:6a4db94011d3 | 145 | . = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size; |
sahilmgandhi | 18:6a4db94011d3 | 146 | __HeapLimit = .; |
sahilmgandhi | 18:6a4db94011d3 | 147 | } > RAM |
sahilmgandhi | 18:6a4db94011d3 | 148 | |
sahilmgandhi | 18:6a4db94011d3 | 149 | /* .stack_dummy section doesn't contains any symbols. It is only |
sahilmgandhi | 18:6a4db94011d3 | 150 | * used for linker to calculate size of stack sections, and assign |
sahilmgandhi | 18:6a4db94011d3 | 151 | * values to stack symbols later */ |
sahilmgandhi | 18:6a4db94011d3 | 152 | .stack_dummy (NOLOAD): |
sahilmgandhi | 18:6a4db94011d3 | 153 | { |
sahilmgandhi | 18:6a4db94011d3 | 154 | *(.stack*) |
sahilmgandhi | 18:6a4db94011d3 | 155 | } > RAM |
sahilmgandhi | 18:6a4db94011d3 | 156 | |
sahilmgandhi | 18:6a4db94011d3 | 157 | /* Set stack top to end of RAM, and stack limit move down by |
sahilmgandhi | 18:6a4db94011d3 | 158 | * size of stack_dummy section */ |
sahilmgandhi | 18:6a4db94011d3 | 159 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
sahilmgandhi | 18:6a4db94011d3 | 160 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
sahilmgandhi | 18:6a4db94011d3 | 161 | PROVIDE(__stack = __StackTop); |
sahilmgandhi | 18:6a4db94011d3 | 162 | |
sahilmgandhi | 18:6a4db94011d3 | 163 | /* Check if data + heap + stack exceeds RAM limit */ |
sahilmgandhi | 18:6a4db94011d3 | 164 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
sahilmgandhi | 18:6a4db94011d3 | 165 | } |