The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 93:e188a91d3eaa 1 /* Linker script to configure memory regions. */
Kojto 93:e188a91d3eaa 2 MEMORY
Kojto 93:e188a91d3eaa 3 {
Kojto 93:e188a91d3eaa 4 /* 512KB FLASH, 80KB RAM, Reserve up till 0x13C. There are 0x73 vectors = 292
Kojto 93:e188a91d3eaa 5 * bytes (0x124) in RAM. But all GCC scripts seem to require BootRAM @0x138
AnnaBridge 171:3a7713b1edbc 6 * 8-byte aligned(0x13C) = 0x140
Kojto 93:e188a91d3eaa 7 */
Kojto 93:e188a91d3eaa 8 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512k
AnnaBridge 171:3a7713b1edbc 9 RAM (rwx) : ORIGIN = 0x20000140, LENGTH = 0x14000-0x140
Kojto 93:e188a91d3eaa 10 }
Kojto 93:e188a91d3eaa 11
Kojto 93:e188a91d3eaa 12 /* Linker script to place sections and symbol values. Should be used together
Kojto 93:e188a91d3eaa 13 * with other linker script that defines memory regions FLASH and RAM.
Kojto 93:e188a91d3eaa 14 * It references following symbols, which must be defined in code:
Kojto 93:e188a91d3eaa 15 * Reset_Handler : Entry of reset handler
Kojto 93:e188a91d3eaa 16 *
Kojto 93:e188a91d3eaa 17 * It defines following symbols, which code can use without definition:
Kojto 93:e188a91d3eaa 18 * __exidx_start
Kojto 93:e188a91d3eaa 19 * __exidx_end
Kojto 93:e188a91d3eaa 20 * __etext
Kojto 93:e188a91d3eaa 21 * __data_start__
Kojto 93:e188a91d3eaa 22 * __preinit_array_start
Kojto 93:e188a91d3eaa 23 * __preinit_array_end
Kojto 93:e188a91d3eaa 24 * __init_array_start
Kojto 93:e188a91d3eaa 25 * __init_array_end
Kojto 93:e188a91d3eaa 26 * __fini_array_start
Kojto 93:e188a91d3eaa 27 * __fini_array_end
Kojto 93:e188a91d3eaa 28 * __data_end__
Kojto 93:e188a91d3eaa 29 * __bss_start__
Kojto 93:e188a91d3eaa 30 * __bss_end__
Kojto 93:e188a91d3eaa 31 * __end__
Kojto 93:e188a91d3eaa 32 * end
Kojto 93:e188a91d3eaa 33 * __HeapLimit
Kojto 93:e188a91d3eaa 34 * __StackLimit
Kojto 93:e188a91d3eaa 35 * __StackTop
Kojto 93:e188a91d3eaa 36 * __stack
Kojto 93:e188a91d3eaa 37 * _estack
Kojto 93:e188a91d3eaa 38 */
Kojto 93:e188a91d3eaa 39 ENTRY(Reset_Handler)
Kojto 93:e188a91d3eaa 40
Kojto 93:e188a91d3eaa 41 SECTIONS
Kojto 93:e188a91d3eaa 42 {
Kojto 93:e188a91d3eaa 43 .text :
Kojto 93:e188a91d3eaa 44 {
Kojto 93:e188a91d3eaa 45 KEEP(*(.isr_vector))
Kojto 93:e188a91d3eaa 46 *(.text*)
Kojto 93:e188a91d3eaa 47 KEEP(*(.init))
Kojto 93:e188a91d3eaa 48 KEEP(*(.fini))
Kojto 93:e188a91d3eaa 49
Kojto 93:e188a91d3eaa 50 /* .ctors */
Kojto 93:e188a91d3eaa 51 *crtbegin.o(.ctors)
Kojto 93:e188a91d3eaa 52 *crtbegin?.o(.ctors)
Kojto 93:e188a91d3eaa 53 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
Kojto 93:e188a91d3eaa 54 *(SORT(.ctors.*))
Kojto 93:e188a91d3eaa 55 *(.ctors)
Kojto 93:e188a91d3eaa 56
Kojto 93:e188a91d3eaa 57 /* .dtors */
Kojto 93:e188a91d3eaa 58 *crtbegin.o(.dtors)
Kojto 93:e188a91d3eaa 59 *crtbegin?.o(.dtors)
Kojto 93:e188a91d3eaa 60 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
Kojto 93:e188a91d3eaa 61 *(SORT(.dtors.*))
Kojto 93:e188a91d3eaa 62 *(.dtors)
Kojto 93:e188a91d3eaa 63
Kojto 93:e188a91d3eaa 64 *(.rodata*)
Kojto 93:e188a91d3eaa 65
Kojto 93:e188a91d3eaa 66 KEEP(*(.eh_frame*))
Kojto 93:e188a91d3eaa 67 } > FLASH
Kojto 93:e188a91d3eaa 68
Kojto 93:e188a91d3eaa 69 .ARM.extab :
Kojto 93:e188a91d3eaa 70 {
Kojto 93:e188a91d3eaa 71 *(.ARM.extab* .gnu.linkonce.armextab.*)
Kojto 93:e188a91d3eaa 72 } > FLASH
Kojto 93:e188a91d3eaa 73
Kojto 93:e188a91d3eaa 74 __exidx_start = .;
Kojto 93:e188a91d3eaa 75 .ARM.exidx :
Kojto 93:e188a91d3eaa 76 {
Kojto 93:e188a91d3eaa 77 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
Kojto 93:e188a91d3eaa 78 } > FLASH
Kojto 93:e188a91d3eaa 79 __exidx_end = .;
Kojto 93:e188a91d3eaa 80
Kojto 93:e188a91d3eaa 81 __etext = .;
Kojto 93:e188a91d3eaa 82 _sidata = .;
Kojto 93:e188a91d3eaa 83
Kojto 93:e188a91d3eaa 84 .data : AT (__etext)
Kojto 93:e188a91d3eaa 85 {
Kojto 93:e188a91d3eaa 86 __data_start__ = .;
Kojto 93:e188a91d3eaa 87 _sdata = .;
Kojto 93:e188a91d3eaa 88 *(vtable)
Kojto 93:e188a91d3eaa 89 *(.data*)
Kojto 93:e188a91d3eaa 90
AnnaBridge 171:3a7713b1edbc 91 . = ALIGN(8);
Kojto 93:e188a91d3eaa 92 /* preinit data */
Kojto 93:e188a91d3eaa 93 PROVIDE_HIDDEN (__preinit_array_start = .);
Kojto 93:e188a91d3eaa 94 KEEP(*(.preinit_array))
Kojto 93:e188a91d3eaa 95 PROVIDE_HIDDEN (__preinit_array_end = .);
Kojto 93:e188a91d3eaa 96
AnnaBridge 171:3a7713b1edbc 97 . = ALIGN(8);
Kojto 93:e188a91d3eaa 98 /* init data */
Kojto 93:e188a91d3eaa 99 PROVIDE_HIDDEN (__init_array_start = .);
Kojto 93:e188a91d3eaa 100 KEEP(*(SORT(.init_array.*)))
Kojto 93:e188a91d3eaa 101 KEEP(*(.init_array))
Kojto 93:e188a91d3eaa 102 PROVIDE_HIDDEN (__init_array_end = .);
Kojto 93:e188a91d3eaa 103
Kojto 93:e188a91d3eaa 104
AnnaBridge 171:3a7713b1edbc 105 . = ALIGN(8);
Kojto 93:e188a91d3eaa 106 /* finit data */
Kojto 93:e188a91d3eaa 107 PROVIDE_HIDDEN (__fini_array_start = .);
Kojto 93:e188a91d3eaa 108 KEEP(*(SORT(.fini_array.*)))
Kojto 93:e188a91d3eaa 109 KEEP(*(.fini_array))
Kojto 93:e188a91d3eaa 110 PROVIDE_HIDDEN (__fini_array_end = .);
Kojto 93:e188a91d3eaa 111
Kojto 93:e188a91d3eaa 112 KEEP(*(.jcr*))
AnnaBridge 171:3a7713b1edbc 113 . = ALIGN(8);
Kojto 93:e188a91d3eaa 114 /* All data end */
Kojto 93:e188a91d3eaa 115 __data_end__ = .;
Kojto 93:e188a91d3eaa 116 _edata = .;
Kojto 93:e188a91d3eaa 117
Kojto 93:e188a91d3eaa 118 } > RAM
Kojto 93:e188a91d3eaa 119
Kojto 93:e188a91d3eaa 120 .bss :
Kojto 93:e188a91d3eaa 121 {
AnnaBridge 171:3a7713b1edbc 122 . = ALIGN(8);
Kojto 93:e188a91d3eaa 123 __bss_start__ = .;
Kojto 93:e188a91d3eaa 124 _sbss = .;
Kojto 93:e188a91d3eaa 125 *(.bss*)
Kojto 93:e188a91d3eaa 126 *(COMMON)
AnnaBridge 171:3a7713b1edbc 127 . = ALIGN(8);
Kojto 93:e188a91d3eaa 128 __bss_end__ = .;
Kojto 93:e188a91d3eaa 129 _ebss = .;
Kojto 93:e188a91d3eaa 130 } > RAM
Kojto 93:e188a91d3eaa 131
Kojto 93:e188a91d3eaa 132 .heap (COPY):
Kojto 93:e188a91d3eaa 133 {
Kojto 93:e188a91d3eaa 134 __end__ = .;
Kojto 93:e188a91d3eaa 135 end = __end__;
Kojto 93:e188a91d3eaa 136 *(.heap*)
Kojto 93:e188a91d3eaa 137 __HeapLimit = .;
Kojto 93:e188a91d3eaa 138 } > RAM
Kojto 93:e188a91d3eaa 139
Kojto 93:e188a91d3eaa 140 /* .stack_dummy section doesn't contains any symbols. It is only
Kojto 93:e188a91d3eaa 141 * used for linker to calculate size of stack sections, and assign
Kojto 93:e188a91d3eaa 142 * values to stack symbols later */
Kojto 93:e188a91d3eaa 143 .stack_dummy (COPY):
Kojto 93:e188a91d3eaa 144 {
Kojto 93:e188a91d3eaa 145 *(.stack*)
Kojto 93:e188a91d3eaa 146 } > RAM
Kojto 93:e188a91d3eaa 147
Kojto 93:e188a91d3eaa 148 /* Set stack top to end of RAM, and stack limit move down by
Kojto 93:e188a91d3eaa 149 * size of stack_dummy section */
Kojto 93:e188a91d3eaa 150 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
Kojto 93:e188a91d3eaa 151 _estack = __StackTop;
Kojto 93:e188a91d3eaa 152 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
Kojto 93:e188a91d3eaa 153 PROVIDE(__stack = __StackTop);
Kojto 93:e188a91d3eaa 154
Kojto 93:e188a91d3eaa 155 /* Check if data + heap + stack exceeds RAM limit */
Kojto 93:e188a91d3eaa 156 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
Kojto 93:e188a91d3eaa 157 }